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

40,128 commits

Author SHA1 Message Date
Jacob Young
207c883bfb runner: implement skip commands 2026-09-26 19:08:50 -04:00
Jacob Young
f63e8e802f Build: implement discovered inputs 2026-09-26 19:08:50 -04:00
Jacob Young
11958a306f test: implement new runner 2026-09-26 19:08:50 -04:00
mlugg
3cb5bbb36d Merge pull request 'remove internal and link_once global linkages' (#36956) from alexrp/zig:remove-weird-linkages into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36956
Reviewed-by: mlugg <mlugg@mlugg.co.uk>
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-09-27 00:42:37 +02:00
Matthew Lugg
9a810ff16e Sema: coerce value loaded from pointer at comptime
And add an assertion to `Sema.pointerDerefExtra` to hopefully catch this
kind of bug a little more easily next time: this bug actually snuck past
our existing assertions in many cases!

Resolves: https://codeberg.org/ziglang/zig/issues/36452
2026-09-26 19:55:52 +02:00
Alex Rønne Petersen
476efc5b70
remove internal and link_once global linkages
These have no clear use case, no coherent definition, and incomplete/broken
compiler and linker support.

If actually needed, they can be reintroduced if someone can present a reasonable
use case along with a plan for how they should be implemented consistently in
all backends and linkers.
2026-09-26 19:12:48 +02:00
Matthew Lugg
77568d3009
Elf2: fix UAV alignment override 2026-09-26 19:12:24 +02:00
Alex Rønne Petersen
474e908224
compiler-rt: remove some @export usage in favor of symbol() 2026-09-26 19:12:24 +02:00
Matthew Lugg
1b7a78122e Sema: disallow in-memory coercion of tuples with incompatible comptime field values
Resolves: https://codeberg.org/ziglang/zig/issues/36612
2026-09-26 18:58:35 +02:00
Matthew Lugg
d9c2b88591 incremental: don't map ZIR instructions when the tag changes
I don't think this technically used to matter for instructions other
than `struct_decl`/`union_decl`/`enum_decl`/`opaque_decl` (which were
already handled correctly), but it now does because of the recent
improvements to DWARF's line number tracking.

Resolves: https://codeberg.org/ziglang/zig/issues/36963
2026-09-26 18:58:16 +02:00
Matthew Lugg
62f13ef4ef Zcu: fix overriding weak export with strong
Our "multiple definitions" check in the frontend was a little
overzealous! The only case which should actually be an error is when
there are multiple *strong* definitions.

In the future we will eliminate this frontend check entirely, because
it's redundant with the check the linker will perform---but for now it's
worth keeping since our linkers do not yet print useful source location
information for Zig exports.

Resolves: https://codeberg.org/ziglang/zig/issues/36678
2026-09-26 18:57:55 +02:00
Alex Rønne Petersen
f94185e677
ci: update QEMU to 11.1.1.1
https://codeberg.org/ziglang/qemu-static/releases/tag/11.1.1.1

Required for https://codeberg.org/ziglang/zig/issues/31325.
2026-09-26 15:54:16 +02:00
Janne Hellsten
880d7add00 std.bit_set: add setAll/unsetAll to all bitsets, fix padding bug in Dynamic.setAll
- Add imperative setAll/unsetAll methods to all bitset types.
  Previously setAll/unsetAll were declared only for Dynamic.

- Fix a padding bug in Dynamic.setAll the last mask set to all ones.

- Add tests for previously untested setAll, unsetAll
2026-09-26 05:07:07 +02:00
Andrew Kelley
08e1138080 Merge pull request 'maker: serialize compilation errors of configurer over the build protocol' (#36959) from bsp-configure-ftbfs into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36959
2026-09-26 02:34:25 +02:00
Alex Rønne Petersen
5a263ea675 Compilation: for .S files, pass CPU features to both preprocessor and assembler
And delete the old workaround code that's no longer relevant.
2026-09-25 23:41:40 +02:00
Alex Rønne Petersen
1e770dbef6 std.zig.LibCInstallation: rename gcc_dir to cc_dir, clarify doc comments and errors
closes https://codeberg.org/ziglang/zig/issues/36948
2026-09-25 23:41:20 +02:00
Andrew Kelley
50cf87f8fc update callsites to std.zig.Client.serveErrorBundle
now it has to include the message tag
2026-09-25 12:07:52 -07:00
Andrew Kelley
d09c1aef02 maker: serialize compilation errors of configurer over the build protocol
serves an ErrorBundle as a configuration_failed message instead of
configuration message upon connection. at this point the protocol enters
an invalid state and the process will need to be restarted in order to
reconfigure. in the future, build server should outlive
reconfigurations.

closes #36389
2026-09-25 11:47:25 -07:00
Andrew Kelley
7cef4755c3 Merge pull request 'Maker: send generated file paths over build server protocol' (#36947) from bsp-generated-files into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36947
2026-09-25 20:04:07 +02:00
Andrew Kelley
480e3f89b2 Maker.Fuzz: fix memory leaks 2026-09-25 02:05:02 -07:00
Andrew Kelley
aaa314f6b2 Maker.Fuzz: fix computation of rebuilt exe path 2026-09-25 01:56:12 -07:00
Andrew Kelley
3d2207fc79 build server protocol: send generated file paths
closes #36403
2026-09-24 23:10:27 -07:00
Andrew Kelley
01eff30056 Maker: fix Step.FindProgram 2026-09-24 23:10:27 -07:00
Andrew Kelley
4853ea1bda Maker: store generated files differently
in preparation for sending them over the build server protocol (#36403),
they are now stored in the same format in memory: one byte for prefix
followed by the relative path.
2026-09-24 23:10:27 -07:00
Ryan Liptak
5b9147ed59 process.currentPathAlloc: deal with the reality that cwd can be larger than max_path_bytes
The assumption currentPathAlloc was making (that the path can never exceed max_path_bytes) was incorrect.
What exactly that means depends on (1) the system, (2) whether or not libc is linked, and (3) (if libc is linked) the libc implementation of `getcwd`.

The POSIX spec says that ERANGE is returned when the buffer is smaller than necessary.
https://pubs.opengroup.org/onlinepubs/9799919799/

However, on Linux, the getcwd *syscall* is limited by PATH_MAX, so the getcwd syscall will return ENAMETOOLONG if the syscall is unable to provide the full cwd path.
e4b2755318/fs/d_path.c (L406-L407)

That doesn't mean the full cwd path can't be gotten, but it means it would need to be reconstructed piece-by-piece by walking the filesystem.
Many libc implementations will do that filesystem walking automatically (musl doesn't; gnu libc, freebsd, etc do), so the libc being linked also determines whether or not ENAMETOOLONG is possible.

FreeBSD: https://cgit.freebsd.org/src/tree/lib/libc/gen/getcwd.c
GNU libc: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/posix/getcwd.c;h=91c6ffd4d8208a0a8efb9c3fcb9dca0ca1007f33;hb=HEAD

Instead of adding recovery to these APIs (e.g. expanding the buffer and retrying, or walking the filesystem to construct the path independently), `currentPathAlloc` is now explicitly a convenience function, and the error sets of both `currentPath` and `currentPathAlloc` have been expanded to give the caller the ability to disambiguate between the possible ways they may be able to recover and let them handle recovery if deeply nested cwd paths are something they want to support.

Closes #36928
2026-09-25 01:35:01 +02:00
Andrew Kelley
2a03d6b007 Maker: properly deinit compiler child procs
Problem was that when Maker.Step.Compile was deinitialized, it would
reap the memory for the child process, but not actually kill & wait for
the termination of the process. Leaving the extra processes running
caused "Reusing Cache Artifacts" deadlocks, not to mention wasting
resources.

closes #36513
2026-09-24 23:53:46 +02:00
Frank Denis
d037c6c19d Merge pull request 'crypto.x25519: recoverPublicKey and generateDeterministic cannot fail' (#36158) from jedisct1/zig:x25519smulterr into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36158
2026-09-24 20:07:01 +02:00
Frank Denis
c157ae2957 crypto.x25519: recoverPublicKey and generateDeterministic cannot fail
This performs a scalar multiplication of the base point by a clamped
scalar (a multiple of 8, so we end up in the prime order group), so
these functions cannot return an error.

Fixes #36154
2026-09-24 20:07:01 +02:00
Frank Denis
c34e2a6b88 Merge pull request 'crypto.ff: compare full Uint buffers and add a isOne() function' (#36925) from jedisct1/zig:ff-fixes2 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36925
2026-09-24 20:06:04 +02:00
Frank Denis
4c93bfe390 crypto.ff: compare full Uint buffers and add a isOne() function
Compare the full zero-padded buffers so we can support different
active widths and still keep the comparison length fixed at comptime.

Also add a constant-time isOne() check, which is quite useful for
a long of applications using finite field arithemtic.
2026-09-24 20:06:04 +02:00
Alex Rønne Petersen
392b171254
test: enable stack trace tests for sparc64-linux-gnu 2026-09-24 17:11:02 +02:00
Matthew Lugg
97ee88cbf3
Elf2: correctly pad debug sections even when there is no ZCU 2026-09-24 17:06:42 +02:00
Gabriel Sa
ae8532e95c Legalize: add expand_array_to_slice legalization (#36818)
see #36719

tried to follow the style of the existing legalizations

tested with `stage4/bin/zig build test -Dskip-release -Dskip-non-native`

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36818
Reviewed-by: Justus Klausecker <justusk@noreply.codeberg.org>
2026-09-23 21:22:58 +02:00
pentuppup
50850875bf fix comptimeness of &arr_ptr.ptr 2026-09-23 21:21:24 +02:00
Alex Rønne Petersen
0c8099a615
std.zig.system.linux.riscv: remove link to resolved kernel bug report
93a27367ba
2026-09-23 16:45:40 +02:00
Frank Denis
6f32ab16c2 Merge pull request 'std.crypto.HybridKem: fix deterministic encapsulation' (#36493) from jedisct1/zig:hydridkem into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36493
2026-09-23 15:06:08 +02:00
Frank Denis
172a5e21a1 std.crypto.HybridKem: fix deterministic encapsulation
For every hybrid KEM, compute the correct seed length (even with
P-384 to be aligned with the current version of the draft).

And to eliminate a footgun (thanks Erik Schlyter), use fixed-size
seeds rather than a minimum size with padding and expose it.

That also makes the code simpler and shorter.
2026-09-23 15:06:08 +02:00
Alex Rønne Petersen
ba90aae529
test: stop testing thumb-windows
This target is effectively dead. We'll keep it on life support in the compiler
and standard library, but there's no reason to waste CI resources on it at this
stage.
2026-09-23 13:42:28 +02:00
Frank Denis
55b12af06a Merge pull request 'crypto.aes.soft: use a bitsliced representation' (#36110) from jedisct1/zig:bitsliced into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36110
2026-09-23 13:25:56 +02:00
Frank Denis
4d06435fe3 crypto.aes.soft: use a bitsliced representation
AES is nice but has a problem when implemented in pure software
(on CPUs without AES instructions).

In order to not be insanely slow, the non-linear operation is
usually implemented with a lookup tables. But memory lookups
with a secret index is a side channel that can be exploited for
key recovery.

The current implementation of software AES mitigates this by
doing multiple passes over tiny lookup tables that fit in a single
cache line.

It works. Intra-cacheline attacks leveraging SMT exist, but the
number of CPUs with SMT but no AES instructions is pretty small
(old Intel Atom Medfield CPUs).

But we can do better. Bitslicing is another way to mitigate these
issues, but packing all the bits that will go through the same
circuit into the same register, essentially emulating a
hardware implementation.

For single-block AES, this is quite slow, but for any algorithm
that can leverage parallelization (AES-CTR, AES-OCB, etc), it's
not bad at all.

Long story short:
- Constant time everywhere, including weird old CPUs
- About 4x faster than the current cacheline-tables code
for inputs > 32 bytes.

On modern CPUs, the speedup is significant for WebAssembly.

Note that when side channels are not part of the threat model,
the unprotected lookup table remains faster.

The packing/unpacking/round operations are intentionally public.
Because in order to get decent performance, some AES-based ciphers
really need to control when they want to use the regular word
representation vs the packed representation.
2026-09-23 13:25:56 +02:00
Alex Rønne Petersen
55fe0ad7da
llvm: enable bti and pac-ret for aarch64-linux-android 2026-09-23 13:08:56 +02:00
Alex Rønne Petersen
0d20454691
test: enable sparc64-linux-gnu module tests 2026-09-23 13:08:56 +02:00
Matthew Lugg
dbc746633c
Elf2: fix assertion failure 2026-09-23 12:01:37 +01:00
Frank Denis
71403f2991 Merge pull request 'std.crypto.ed25519: x=0 with the sign bit should be a decoding error' (#36483) from jedisct1/zig:ed25519zerodecode into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36483
2026-09-23 10:15:27 +02:00
Frank Denis
bf516019a9 std.crypto.ed25519: x=0 with the sign bit should be a decoding error
An edwards25519 point with x=0 is not expected to have the sign
bit set.

This is rejected later with an IdentityElement error, but
technically it should be a decoding error (InvalidEncoding).
2026-09-23 10:15:27 +02:00
Jacob Young
cacb188e3d Elf2: fix verdef terminator 2026-09-23 03:10:21 -04:00
Jacob Young
728c85edbe Elf2: fix version section entsize
This makes libbfd livid.
2026-09-22 21:49:25 -04:00
rpkak
665fc1417e zig fetch: init parent_package_root
used in Fetch.initResource
2026-09-23 01:58:48 +02:00
Alex Rønne Petersen
77d6113cfb Merge pull request 'Elf2: symbol versioning (and a few bugfixes)' (#36924) from mlugg/elf2-goodies into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36924
2026-09-22 23:53:09 +02:00
Alex Rønne Petersen
b3eb800e2f
ci: bump aarch64-openbsd test timeout from 2m to 4m
Matches aarch64-freebsd and aarch64-netbsd. Necessary for some crypto tests
under heavy load.
2026-09-22 21:32:53 +02:00