5929 Commits

Author SHA1 Message Date
Andrew Kelley
c2ad78922a std.os.windows.ReadLink: add missing alignment of local data buffer 2023-01-09 14:47:00 -07:00
Jakub Konka
3b892f4316 libstd: skip problematic tests on aarch64-windows 2023-01-09 14:46:14 -07:00
Jakub Konka
fa30458e84 Merge pull request #13701 from ziglang/arm-win-more-features
Improve aarch64 feature detection based on the readouts from privileged system registers
2023-01-09 14:46:09 -07:00
Jakub Konka
1f61a00a41 Merge pull request #13659 from ziglang/arm-win-cpu-features
windows: add native CPU and features detection for Armv8 chips
2023-01-09 14:45:21 -07:00
Ryan Liptak
5404d06ea9 os.windows.OpenFile: Add USER_MAPPED_FILE as a possible error
Ran into this when using a program that uses CreateFileMapping and then trying to call `std.fs.createFile` on the mapped file. More info can be found here:

https://stackoverflow.com/questions/41844842/when-error-1224-error-user-mapped-file-occurs

Before:

```
error.Unexpected NTSTATUS=0xc0000243
C:\Users\Ryan\Programming\Zig\zig\lib\std\os\windows.zig:138:40: 0x7ff74e957466 in OpenFile (test.exe.obj)
        else => return unexpectedStatus(rc),
                                       ^
```

After:

```
FAIL (AccessDenied)
C:\Users\Ryan\Programming\Zig\zig\lib\std\os\windows.zig:137:30: 0x7ff7f5b776ea in OpenFile (test.exe.obj)
        .USER_MAPPED_FILE => return error.AccessDenied,
                             ^
```
2023-01-09 14:44:34 -07:00
zooster
f986cb1f90 std.Thread.Futex.PosixImpl.Address.from: fix alignment type
Fixes #13673
2023-01-09 14:44:14 -07:00
Jacob Young
2f11de4f51 std.big.int.Mutable: fix set(@as(DoubleLimb, 0))
Previously, this would set len to 1 but fail to initialize any limbs.
2023-01-09 14:44:09 -07:00
notcancername
e5d76176b9 document std.heap.StackFallbackAllocator 2023-01-09 14:44:05 -07:00
Igor Anić
76c729c967 stdlib: remove flaky test
fixes ziglang#13660
2023-01-09 14:43:43 -07:00
Andrew Kelley
d824471489 disable spuriously failing std lib test case
see tracking issue #13660
2023-01-09 14:43:33 -07:00
Cody Tapscott
fff7f15fb8 std.os: Fix std.os.chdir for WASI
Test coverage was lacking for chdir() on WASI, allowing this to
regress.

This change makes os.chdir() compile again, and improves the test
logic to use our standard CWD support for WASI.
2023-01-09 14:43:29 -07:00
Matt Chudleigh
ddfcf0246e Bug fix: Prevent uninitialized parse nodes
If a parse node is reserved but never set the node remains
uninitialized and can crash tools doing a linear scan of the nodes
(like ZLS) when switching on the tag.
2023-01-09 14:42:42 -07:00
Andrew Kelley
99f2ce5e91 Merge pull request #13577 from ianic/issue-12877
stdlib: fix condition variable broadcast FutexImpl
2023-01-09 14:39:20 -07:00
Andrew Kelley
06dfa88d3f fix CPU model detection for neoverse_n1 on aarch64-linux
see #10086
2023-01-09 14:34:40 -07:00
Ali Chraghi
1702404adf os: windows: fix unhandled error 2023-01-09 14:29:59 -07:00
remeh
a5bcdfd27e std.array_list: add a comment on every methods invalidating pointers.
While it is already mentioned on the `items` attributes of the structs, it is
interesting to comment in every method potentially invalidating pointers to items
that they may do so.
2023-01-09 14:18:45 -07:00
Guillaume Wenzek
91b8d9e370 fix Nvptx backend outputing files at the top level of zig-cache 2023-01-09 14:17:29 -07:00
Veikka Tuominen
4ed0cd51c0 Merge pull request #13558 from Vexu/stage2-fixes
Stage2 bug fixes to get third party projects building
2023-01-09 14:06:50 -07:00
GethDW
6494cec59c std.build: fix typo
This would only fail to compile when building *on* WASI.
2023-01-09 14:06:13 -07:00
Hayden Pope
2d623d7774 std.os.linux: Add setitimer and getitimer syscalls 2023-01-09 14:05:18 -07:00
Frank Denis
b239a178c5 crypto.bcrypt: fix massive speed regression when using stage2 (#13518)
state: State -> state: *const State
Suggested by @nektro

Fixes #13510
2023-01-09 14:03:11 -07:00
Jonathan
568a619251 pthread_sigmask 2023-01-09 14:01:57 -07:00
Jakub Konka
56195aa73c pdb: make SuperBlock def public 2023-01-09 14:00:21 -07:00
Veikka Tuominen
95ecd521b8 Merge pull request #13418 from ryanschneider/signal-alignment-13216
std.os: fix alignment of Sigaction.handler_fn
2023-01-09 13:56:41 -07:00
IntegratedQuantum
11c1ddfc97 Handle sentinel slices in std.mem.zeroes
Fixes #13256
2023-01-09 13:56:20 -07:00
bfredl
a0dd11c479 Fixes to linux/bpf/btf.zig
- the meaning of packed structs changed in zig 0.10. adjust accordingly.
  Use "extern struct" for the cases that directly map to C structs.

- Add new type info kinds, like enum64 and DeclTag

- change the Type enum to use the canonical names from libbpf.
  This is more predictable when comparing with external BPF
  documentation (than invented synonyms that need to be guessed)
2023-01-09 13:55:53 -07:00
Frank Denis
6a94bcbbc6 crypto.core.aes: process 6 block in parallel instead of 8 on aarch64 (#13473)
* crypto.core.aes: process 6 block in parallel instead of 8 on aarch64

At least on Apple Silicon, this is slightly faster than 8 blocks.

* AES: add parallel blocks for tigerlake, rocketlake, alderlake, zen3
2023-01-09 13:52:02 -07:00
Frank Denis
30d392a87e crypto.salsa20: make the number of rounds a comptime parameter (#13442)
...instead of hard-coding it to 20.

- This is consistent with the ChaCha implementation
- NaCl and libsodium, that this API is designed to interop with,
also support 8 and 12 round variants. The 12 round variant, in
particular, provides the same security level as the 20 round variant,
but is obviously faster.
- scrypt currently uses its own non optimized version of Salsa, just
because it use 8 rounds instead of 20. This will help remove code
duplication.

No behavior nor public API changes. The Salsa20 and XSalsa20 still
represent the 20-round variant.
2023-01-09 13:51:56 -07:00
r00ster91
5f74bec076 std.os.linux.T: translate more MIPS values
This fixes the broken terminal for me and thus fixes #13198.
2023-01-09 13:50:39 -07:00
delitako
3608b1d036 Improve doc comments for two functions (#13456)
* std.heap: fix function name in doc comment

* std.mem: document return value of `replace`
2023-01-09 13:49:43 -07:00
Veikka Tuominen
b511231f95 Merge pull request #13338 from Vexu/stage2-compile-errors
Improve some error messages
2023-01-09 13:48:34 -07:00
Yujiri
d8970de510 Add docstrings to some functions in std.meta 2023-01-09 13:46:58 -07:00
Frank Denis
72199c26b9 std.crypto.pwhash.bcrypt: inline the Feistel network function (#13416)
std/crypto/benchmark.zig results:

* Intel i5

before: 3.144 s/ops
 after: 1.922 s/ops

* Apple M1

before: 2.067 s/ops
 after: 1.373 s/ops
2023-01-09 13:46:46 -07:00
Nathan Bourgeois
ab4b538d91 Translate-C Remainder Macro Fix 2023-01-09 13:45:42 -07:00
Frank Denis
ee8af8cffb std.crypto.ed25519 incremental signatures: hash the fallback noise (#13643)
If the noise parameter was null, we didn't use any noise at all.

We unconditionally generated random noise (`noise2`) but didn't use it.

Spotted by @cryptocode, thanks!
2022-12-22 23:06:28 +01:00
Andrew Kelley
a0ac10d903 Merge pull request #13389 from jacobly0/fix-only-c
cbe: enough fixes for `-Donly-c` to be able to produce an executable
2022-11-02 14:11:31 -07:00
Andrew Kelley
57caec8585 Merge pull request #13368 from jacobly0/fix-aarch64-c 2022-11-02 14:09:45 -07:00
mnordine
5aa146c2d2 Fix variable name in documentation sample (#13391) 2022-11-02 14:09:30 -07:00
Frank Denis
5e4000ee69 ed25519: recommend using the seed to recover a key pair 2022-11-02 14:09:24 -07:00
Frank Denis
26e7d4c9a3 Ed25519.KeyPair.fromSecretKey() didn't compile after the API changes (#13386)
Fixes #13378
2022-11-02 14:09:18 -07:00
Andrew Kelley
d02242661e std.heap: make wasm32 PageAllocator handle large allocation
When a number of bytes to be allocated is so great that alignForward()
is not possible, return `error.OutOfMemory`.

Companion commit to 3f3003097cbf5a6ad9e0dfc29b2cafbe2e35dded.
2022-10-30 19:28:26 -07:00
Andrew Kelley
3f3003097c std.heap.PageAllocator: add check for large allocation
Instead of making the memory alignment functions more complicated, I
added more API documentation for their existing semantics.

closes #12118
closes #12135
2022-10-30 16:10:20 -07:00
Nameless
40e84a27d6
change uefi packed structs to new integer backed syntax (#13173)
* std.os.uefi: integer backed structs, add tests to catch regressions

device_path_protocol now uses extern structs with align(1) fields because
the transition to integer backed packed struct broke alignment

added comptime asserts that device_path_protocol structs do not violate
alignment and size specifications
2022-10-30 15:08:32 -04:00
Andrew Kelley
5339cac2ef std: re-enable auto hash test
It was temporarily disabled due to a self-hosted compiler
miscompilation.

closes #12178
2022-10-30 01:09:31 -07:00
Andrew Kelley
209a0d2a83
Merge pull request #13153 from squeek502/iterator-filename-limits
Windows: Fix Iterator name buffer size not handling all possible file name components
2022-10-29 23:50:37 -04:00
Andrew Kelley
5f5a20ebaf
Merge pull request #13093 from jacobly0/backend-fixes
C backend fixes
2022-10-29 23:06:59 -04:00
kkHAIKE
949cca9f2a Allocator: fix len_align calc in large type size case 2022-10-29 17:53:56 -04:00
Ryan Liptak
db80225a97 fs: Some NAME_MAX/MAX_NAME_BYTES improvements 2022-10-29 14:30:46 -07:00
Ryan Liptak
348f73502e Make MAX_NAME_BYTES on WASI equivalent to the max of the other platforms
Make the test use the minimum length and set MAX_NAME_BYTES to the maximum so that:
- the test will work on any host platform
- *and* the MAX_NAME_BYTES will be able to hold the max file name component on any host platform
2022-10-29 14:30:46 -07:00
Ryan Liptak
c5d23161fc Set wasi MAX_NAME_BYTES to minimum of the rest of the supported platforms
This is a slightly weird situation, because the 'real' value may depend on the host platform that the WASI is being executed on.
2022-10-29 14:30:45 -07:00