0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
Commit graph

14,618 commits

Author SHA1 Message Date
Alex Rønne Petersen
72222508bb
std.Target.DynamicLinker: define path for riscv64-hurd-gnu 2026-10-07 00:30:52 +02:00
Alex Rønne Petersen
e4c80ae695
std.debug.Dwarf: fix supportsUnwinding() for amdgcn
https://github.com/llvm/llvm-project/pull/183148
2026-10-07 00:30:52 +02:00
Alex Rønne Petersen
4b90a8e967
std.zig.system.x86: add jmpabs detection 2026-10-07 00:30:52 +02:00
Alex Rønne Petersen
22db242b79
std.zig.system.x86: add avx512bmm detection 2026-10-07 00:30:52 +02:00
Alex Rønne Petersen
fe188a3261
std.zig.system.x86: add hygon family CPU detection 2026-10-07 00:30:52 +02:00
Alex Rønne Petersen
b56c08c4c5
std.zig.system.x86: add znver6 CPU detection 2026-10-07 00:30:52 +02:00
Alex Rønne Petersen
0e4a98d969
std.zig.system.arm: add hip12 and rigel CPU detection 2026-10-07 00:30:52 +02:00
Alex Rønne Petersen
8c06a8dc8f
compiler: add loongarch(32,64)_preserve_none calling convention support 2026-10-07 00:30:52 +02:00
Alex Rønne Petersen
964e93dc47
move wcslen from libzigc to compiler-rt
Similar to strlen, LLVM 23+ will sometimes emit libcalls to this function even
when libc isn't linked.
2026-10-07 00:30:52 +02:00
Alex Rønne Petersen
45a40c4fa8
llvm: update address spaces to LLVM 23
Note: https://codeberg.org/ziglang/zig/issues/31190#issuecomment-20523923
2026-10-07 00:30:51 +02:00
Alex Rønne Petersen
16e1906e3d
std.zig.llvm.Builder: update data layout strings to LLVM 23 2026-10-07 00:30:51 +02:00
Alex Rønne Petersen
53173d25ab
std.Target: update CPU models and features to LLVM 23 2026-10-07 00:30:51 +02:00
Alex Rønne Petersen
6c78e9250d Merge pull request 'move no-libc ELF auxiliary vector and thread-local storage initialization to compiler-rt' (#36564) from alexrp/zig:compiler-rt-tls-auxv into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36564
2026-10-07 00:26:56 +02:00
Frank Denis
d6debf0de7 crypto.ff: remove unnecessary @as()
@truncate() was automatically converted into @as(...@truncate(...))
by `zig fmt` back in the days, but type inference is enough.
2026-10-06 10:49:39 +02:00
Frank Denis
c60dfbcc6e crypto.ff: add unit element helpers
Add isOne(), isMinusOne(), and subOne() helpers for quick constant-time
operations against the unit element, regardless of the representation.
2026-10-06 10:49:20 +02:00
Frank Denis
2ab329aed1 std.crypto.Blake3: add incremental parallel update
Add updateParallel(), so streaming input can be hashed using
multiple threads.
2026-10-06 10:49:00 +02:00
Frank Denis
a3b95e1b1a For single-chunk messages, just use regular TurboShake implementation
The local kangarootwelve version was just redundant code, and only
aborbed one byte at a time
2026-10-06 10:48:30 +02:00
Frank Denis
92d82e6a34 crypto.hash.kangarootwelve: add a parallel update function
Add an updateParallel() function to perform incremental updates
using multiple threads, and take it as an opportunity to slightly
simplify the code.
2026-10-06 10:48:30 +02:00
Frank Denis
fc9184e652 base64: properly compute the decoded size upper bound
First, the correct length for decoding should be computed with
/4*3 , not the other way round as when encoding.

But also, without padding, a string such as "Zg" is valid base64
(here, it's the character 'f', padded base64 would be "Zg==").

decodedLenUpperBound() returned 0 instead of 1 in that example.

Correctly fix the computation of the upper bound.
2026-10-06 10:44:11 +02:00
Frank Denis
a64a255335 crypto.aessiv: there's no special case for the empty string
Add a test for that case by the way.
2026-10-06 10:41:10 +02:00
Frank Denis
7151140bde crypto.sha3.tuplehash: fix XOF output length encoding
We should append TupleHashXOF's right_encode(0) marker directly
to the cSHAKE instance, not treat is as another tuple element.

The existing tests didn't catch this because they were using
TupleHash as a hash function, not as a XOF.
2026-10-06 10:39:21 +02:00
Brandon L Black
be8e7da103 Io.net.cmsg: Fix Iterator.Message.header alignment
Without this change, on some targets (e.g. aarch64-freebsd),
calling `cmsg.data()` with `Iterator.message.header` as the
argument would result in compilation failures like:

    error: expected type '*align(8) c.posix_cmsghdr', found '*c.posix_cmsghdr'
2026-10-06 07:31:14 +02:00
Ben Burkert
96b9286a1b zon: fix parse function name typos in doc comment 2026-10-05 10:43:56 -04:00
Alex Rønne Petersen
736d37ad16
move std.os.linux.tls to compiler_rt as __zig_elf_static_tls_*
As with __zig_elf_auxv, we need a canonical location for __tls_get_addr (or
__tls_get_offset on s390x), and compiler-rt is the obvious place. But that also
means that moving all of std.os.linux.tls there just makes sense. I decided not
to namespace this under linux because it's expected that most of this code will
apply to the BSDs too.

The ABI that std now expects is:

    extern fn __zig_elf_static_tls_init(phdrs: [*]elf.ElfN.Phdr, phnum: usize) void;
    extern fn __zig_elf_static_tls_fill(area: [*]u8) usize;
    extern var __zig_elf_static_tls: extern struct {
        size: usize,
        alignment: usize,
        gdt_entry_number: usize,
    };

Users can override all three weak symbols with strong symbols if they want to
provide their own ELF TLS implementation, which may be useful to do when doing
manual dynamic loading from a static executable. Note that __tls_get_addr (or
__tls_get_offset on s390x) must also be provided, per the ELF TLS specification.
2026-10-05 03:26:41 +02:00
Alex Rønne Petersen
292edd2440
move std.os.linux.elf_aux_maybe to compiler_rt as __zig_elf_auxv
This gets rid of the super confusing and (as far as I can tell) incorrect
getauxval logic in std.os.linux, and clarifies exactly who owns this state.

The ABI that std now expects is:

    extern var __zig_elf_auxv: [*]std.elf.Auxv;

Users can technically override this weak symbol with a strong symbol if they
wish, although I see no particularly useful reason to do so.

It is now a compile error to use std.os.linux.getauxval if libc is linked,
whereas previously it would just give useless results in some cases. I consider
this to be strictly an improvement. Just use std.c.getauxval when linking libc,
which std already does correctly where it needs getauxval.

This code is expected to be further simplified once our baseline Linux version
allows implementing https://codeberg.org/ziglang/zig/issues/31290.

closes https://codeberg.org/ziglang/zig/issues/36203
2026-10-05 03:26:41 +02:00
Alex Rønne Petersen
71590ad8c9
std.elf: fix Elf64_auxv_t layout on NetBSD and OpenBSD 2026-10-04 18:33:19 +02:00
Alex Rønne Petersen
5e754304de remove support for wasi-libc
closes https://github.com/ziglang/zig/issues/9342
closes https://github.com/ziglang/zig/issues/15005
closes https://github.com/ziglang/zig/issues/20747
closes https://github.com/ziglang/zig/issues/22570
closes https://codeberg.org/ziglang/zig/issues/30977
2026-10-04 18:23:18 +02:00
Alex Rønne Petersen
56023ff8fe Merge pull request 'std.Io.Threaded: only use spawnDarwin in processReplace when spawning is supported' (#37063) from enfipy/zig:std-threaded-ios-process-replace into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37063
Reviewed-by: Jacob Young <jacobly@ziglang.org>
2026-10-04 18:19:10 +02:00
Alex Rønne Petersen
59a501a9ac Merge pull request 'fix regressions caused by control data changes' (#37070) from hemisputnik/fix-control-data into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37070
2026-10-04 18:16:24 +02:00
Frank Denis
d7fe3b57fc Make valueBarrier a no-op on stage2_wasm 2026-10-04 16:56:00 +02:00
Frank Denis
ebc1c263b4 crypto.ff: hide constant-time selection masks from optimizer
Hide the selection mask so LLVM can't replace it with a branch
around the calling loop.

Fixes #37023
2026-10-04 16:56:00 +02:00
Frank Denis
0adecad9e6 Unroll for loops
Provides a 15% speedup on WebAssembly, both with wamstime and V8.
2026-10-04 14:03:54 +02:00
Frank Denis
e67cb2c7c9 Export the state alignment 2026-10-04 14:03:54 +02:00
Frank Denis
8b0f9360cf Add a test for specialized vs regular AEGIS state updates 2026-10-04 14:03:54 +02:00
Frank Denis
e782da3d89 crypto.aegis: add specialized implementation for CPUs without AES
On CPUs that don't support AES acceleration (and in environments
such as WebAssembly) we already use a generic bitsliced AES
implementation, via std.crypto.core.aes.

But AEGIS can be much faster by keeping the state bitsliced
(so we only set and extract the required bits to update the
state and get the keystream).

Rotating the state is also as simple as a 1-bit shift over the
entire bitsliced state.

This PR implements techniques described in
https://eprint.iacr.org/2026/1338 and makes AEGIS on CPUs without
AES acceleration 2x-3x faster.

On WebAssembly with SIMD, there's room for improvement (see
https://00f.net/2026/07/16/aes-with-simd-swizzles/) but that
requires swizzle operations that we don't support yet.
2026-10-04 14:03:54 +02:00
David
c92c8ef8cf std.process: match can_spawn and can_replace to Apple SDK availability 2026-10-04 10:39:43 +04:00
Alex Rønne Petersen
cfa82af363
std.os.linux.riscv(32,64): declare all vector registers as syscall clobbers
The kernel intentionally clobbers vector registers (by setting them to all 1s).
2026-10-04 04:52:13 +02:00
hemisputnik
78093ce4c8
Io.net.Stream: fix read post control data changes 2026-10-04 00:01:57 +03:00
hemisputnik
febc1d4cf7
Io.Threaded: fix wasi branch of netReadPosix post control data changes 2026-10-03 23:47:32 +03:00
whatisaphone
996321250d Fix simple_panic 2026-10-03 19:36:46 +02:00
David
0bfd34342b std.Io.Threaded: only use spawnDarwin in processReplace when spawning is supported
ios, tvos, visionos and watchos can't spawn processes, so their
null_file has no fd and spawnDarwin doesn't compile for them. The
vtable always references processReplace and the default panic handler
uses Threaded, so nearly every program for these targets failed to
compile. Fall back to posixExec there, as before 9fe0ebe108.

closes https://codeberg.org/ziglang/zig/issues/37061
2026-10-03 17:10:32 +04:00
Frank Denis
a57cf67863 crypto.ff: don't compare elements with different representations
Plain and Montgomery elements shouldn't compare equal just because
their limbs match.

Make eql require both the same limbs *and* the same form.

Also, comparison and parity checks don't make sense in Montgomery
form, so make sure the elements are in plain form for these operations.

Fix the plain-montgomery test by the way.
2026-10-03 14:36:13 +02:00
Frank Denis
21ce6e8451 crypto.ff: fix encoded exponent lengths
Use a buffer large enough for the field's full capacity.

For exponentiation with secret exponents, always encode the
exponents at the modulus public length, so that their length
doesn't act as a side channel.

And the public counterpart should use the exponent's public bit
length to include every byte needed for its highest set bit.
2026-10-03 14:35:42 +02:00
Alex Rønne Petersen
1926e8c679
std.Target: change generic CPU model for sparc to v8
closes https://codeberg.org/ziglang/zig/issues/37058
2026-10-03 02:02:04 +02:00
Alex Rønne Petersen
5a23bf4b27
std.Target: bump minimum glibc version for powerpc64le to 2.32
From https://lwn.net/Articles/828210/:

    * powerpc64le supports IEEE128 long double libm/libc redirects when
      using the -mabi=ieeelongdouble to compile C code on supported GCC
      toolchains.  It is recommended to use GCC 8 or newer when testing
      this option.
2026-10-03 01:02:56 +02:00
Andrew Kelley
eb20ecded8 Merge pull request 'std.Io.Operation: improve handling of control data' (#37035) from control-data into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37035
2026-10-01 23:28:24 +02:00
Meghan Denny
345b717936 std.crypto: add missing finalResult methods 2026-10-01 22:54:32 +02:00
Alex Rønne Petersen
f19259c85b
std.c: fix Sigaction layout for sparc64-linux-gnu 2026-10-01 16:04:29 +02:00
Frank Denis
a14e2cda63 Fix typo by the way: Endormorphism -> Endomorphism 2026-10-01 12:06:49 +02:00
Frank Denis
4e38cc5603 Simplify the test 2026-10-01 12:06:49 +02:00