Commit Graph

37626 Commits

Author SHA1 Message Date
Alex Rønne Petersen dd10d3fb52 libc-test: disable pthread_cancel-points.c
This test is racey if multiple instances of it run concurrently.
2026-04-02 12:33:19 +02:00
Andrew Kelley b22eb176b0 Merge pull request 'audit remaining uses of thread spawning' (#31725) from audit-thread-spawning into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31725
2026-04-01 17:45:29 +02:00
Alex Rønne Petersen 752f991c09 ci: bump loongarch64-linux-debug timeout by 1 hour 2026-04-01 15:57:40 +02:00
Andrew Kelley 617979ef26 std.Build.WebServer: use Io.concurrent rather than threads
allows the code to also work in evented mode
2026-04-01 02:54:25 -07:00
Andrew Kelley bd05d13d5f std: make file locking tests use io not threads
This will allow the tests to also run in single-threaded evented mode.
2026-04-01 02:54:25 -07:00
nektro da78940dd2 add a few missing language tags to the README 2026-04-01 11:41:33 +02:00
Alex Rønne Petersen 27611c10f8 Merge pull request 'LinuxThreadImpl fixups' (#31716) from blblack/zig:linux-thread-childtid into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31716
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-04-01 11:38:06 +02:00
Brandon Black 1226bb9268 LinuxThreadImpl: be precise in tls.prepareArea arg
This isn't causing any functional problem today, but technically
`mapped[tls_offset..]` runs past the tls part of `mapped` and into
the `Instance` storage, and currently `prepareArea()` memsets its
entire argument to zero.  It is only the current layout and
initialization order of `mapped` that prevents this from being a
problem.  Being more precise here avoids future footguns if any of
that changes.
2026-03-31 14:48:03 -05:00
Brandon Black 614cd66e7e LinuxThreadImpl: clear tidptr during detached exit
Fixes: #31714
2026-03-31 14:47:44 -05:00
Brandon Black bb9f97e085 std.os.linux: add set_tid_address 2026-03-31 14:47:22 -05:00
Andrew Kelley 9b1eaad13f std.Build.Step.ConfigHeader: add addIdent function
for when you need to emit a bare identifier but from a string
2026-03-30 00:37:39 -07:00
Jacob Young 0db75c0116 std.Io.Threaded: fix dns queries on windows
by working around various bugs in `DnsQueryEx`.

Closes #31659
2026-03-30 09:33:04 +02:00
Frank Denis 42e33db9d0 Merge pull request 'crypto.base64: use "-" instead of "+" character in URL-safe mode' (#31709) from jedisct1/zig:urlsafe into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31709
2026-03-29 18:20:14 +02:00
mlugg 66f55a1cb4 Merge pull request 'llvm: simplifications, refactors, and make incremental work' (#31678) from llvm-enhancements into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31678
2026-03-29 13:41:10 +02:00
Frank Denis dcb33abc2c crypto.base64: use "-" instead of "+" character in URL-safe mode
/ was turned into _, but + also needs to be turned into -
2026-03-29 09:33:22 +02:00
Matthew Lugg abaf3dfbe9 tests: fix wouldUseLlvm on x86_64-windows 2026-03-28 19:25:01 +00:00
Matthew Lugg b36cfc6352 compiler-rt: work around LLVM not respecting -fno-builtin 2026-03-28 19:25:01 +00:00
Matthew Lugg 2ac47fe314 tests: disable safe compiler-rt tests on LLVM
Disabling due to multiple LLVM bugs:
* https://codeberg.org/ziglang/zig/issues/31701
* https://codeberg.org/ziglang/zig/issues/31702
2026-03-28 19:25:01 +00:00
Matthew Lugg 29faeeee9d tests: fix passing -fno-builtin to module tests 2026-03-28 16:50:43 +00:00
Matthew Lugg fca3f6f62e MachO: don't split subsections on N_ALT_ENTRY symbols
MachO has a mechanism where symbols can introduce "subsections", which
(as I understand it) allows a linker to garbage-collect parts of
sections without pulling in the heavy machinery of `-fdata-sections` and
`-ffunction-sections`. Essentially, symbols can be considered to
partition a section, and these boundaries are not allowed to be crossed
by memory accesses, so the linker can detect symbols which are unused
and drop the corresponding input section regions.

However, the symbol flag `N_ALT_ENTRY` indicates that a symbol should
not participate in this "splitting", and is instead an "alternate entry
point" to the previous subsection, which should continue through this
symbol.

The Mach-O linker was failing to ignore `N_ALT_ENTRY` symbols when
creating subsections, which meant that for certain link inputs, it would
create additional subsection splits, and then garbage collect the extra
sections (due to the `N_ALT_ENTRY` symbol being unused). Naturally, this
silent dropping of parts of input sections led to miscompilations.
2026-03-28 16:50:43 +00:00
Pavel Verigo 6ed9c05210 link.Wasm: fix indirect function table handling
The changes to the LLVM backend here changed the compiler_rt object
which LLVM emits, and exposed some buggy behavior in the self-hosted
WASM linker when parsing that object.
2026-03-28 16:50:43 +00:00
Matthew Lugg 4a494a8cf9 tests: enable incremental tests for x86_64-linux-llvm
These all pass now! I have also removed the warning about the LLVM
backend not supporting incremental compilation; I expect it will work
sort of okay in practice by now.
2026-03-28 16:50:43 +00:00
Matthew Lugg d28c5069b8 llvm: rework handling of globals
The main goal here is to make incremental compilation work a bit better.
I also slightly expanded some `std.zig.llvm.Builder` APIs so that we
don't need to pointlessly create new `Global`s whenever e.g. a function
turns into a variable or vice versa.

Also, lean into aliases for exports! If we just use aliases for every
export, everything becomes simpler. Besides, we can't just go around
renaming the globals of `Nav`s: the export could disappear on a future
update, in which case we'd have to somehow revert that change, which is
easier said than done.
2026-03-28 16:50:42 +00:00
Matthew Lugg 500e6c7cfe llvm: some more random enhancements
Avoid directly querying `Builder.Type`s in favour of `lowerType` calls
in a couple of places. The idea here is to avoid querying state stored
in the `Builder` to try and move towards a world where codegen
(essentially the logic in `codegen.llvm.FuncGen`) can happen on a
separate thread to "linking" (which actually interacts with shared state
on `codegen.llvm.Object` and `std.zig.llvm.Builder`).

Don't clear the `Builder` state during `emit`; this is clearly
incompatible with incremental compilation. With that line of code
removed, incremental compilation is actually already somewhat functional
with the LLVM backend.

Also, don't use `c_uint` for source location state---I have no idea
where this came from but it definitely isn't correct.
2026-03-28 16:47:57 +00:00
Matthew Lugg 9c0c65c313 llvm: minor refactors, and incremental @tagName updates 2026-03-28 16:47:55 +00:00
Matthew Lugg fb224178aa Air: change misleading instruction tag name 2026-03-28 16:47:02 +00:00
Matthew Lugg c0f3a23831 llvm: get rid of a bunch of PerThread usages
Also, notably, remove `Air.value`! The `onePossibleValue` check was
actually dead code, because it is a bug if Sema ever emits code which
considers a value of OPV type to be runtime-known---and at that point
`Air.value` is just a thin wrapper around `Air.Ref.toInterned`.
2026-03-28 16:46:59 +00:00
Matthew Lugg bd8088bb98 llvm: random enhancements and cleanups 2026-03-28 16:46:23 +00:00
Matthew Lugg 5941c9da08 llvm: remove almost all GEPs
LLVM is gradually transitioning from the `getelementptr` instruction to
a new `ptradd` instruction. The latter instruction doesn't actually
exist yet, but for now, LLVM is considering `getelementptr i8` to be
equivalent. LLVM is already internally canonicalizing `getelementptr`
usages to this pattern in many cases, and it's far easier for us to emit
that, so... let's do so!

For runtime indexing this does sometimes require an explicit
multiplication to scale an index to a byte offset. The helper function
`llvm.FuncGen.ptraddScaled` makes this common pattern more convenient.

A particularly nice side effect from this is that after removing some
dead code (left over from before we made all `struct`s etc by-ref), it
has eliminated the need to maintain that nasty mapping between Zig field
indices and LLVM field indices. `FuncGen` no longer cares at all how
aggregate types are lowered!

Slices are still by-val at least for now, but they never lived in that
mapping because their structure is simple and consistent (they always
have a pointer at field index 0 and a usize at field index 1, with no
explicit padding necessary).
2026-03-28 16:45:55 +00:00
Matthew Lugg e3ee37f983 llvm: start separating out function codegen
This mostly just moves `FuncGen` into its own file, but there are also a
few more cleanups, such as removing `NavGen` (it no longer served any
purpose) and slightly simplifying the logic for emitting codegen errors.
2026-03-28 16:45:54 +00:00
Jacob Young 3dc5f13989 llvm: fix -fstrip keeping globals only referenced by the symbol table 2026-03-27 21:03:31 -04:00
Andrew Kelley 4b85f05f06 Fetch: fix recompression not preserving symlinks
closes #31660
2026-03-27 20:06:32 +01:00
Andrew Kelley b490412cd2 build runner: fail, not warn when insufficient memory
Users can proceed by telling the build system how much memory to assume
the system has. I have improved the failure message to communicate this.

Partially reverts 87f8f47ba5

Even if we wanted to unrevert this reverted commit, it's not sufficient
to merely downgrade the failure to a warning, because the main
scheduling logic will fail to schedule steps that have a max_rss
exceeding the detected system value, causing some steps to never get
executed, eventually tripping an assert. Such a change would need to
also override the max_rss value to be equal to the greatest value across
all steps.

closes #31510
2026-03-27 18:06:08 +01:00
Andrew Kelley 523cfabcdf build.zig: hard cap on compiler max_rss at 8G
This number should never be raised. If the value is exceeded, then it is
considered a bug in the Zig project that building the compiler takes
more than 8G of memory.

Partial revert of 1293f080fd

Deprioritizes #31510
2026-03-27 18:05:59 +01:00
Andrew Kelley b4e21ccb49 Merge pull request 'std.tar.extract: sanitize path traversal' (#31685) from tar into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31685
2026-03-27 15:00:29 +01:00
Andrew Kelley 053b5e3bdd Package.Manifest: add missing hash validation
closes #31225

reverts e96d86064e which was an inadequate
attempt to address the same problem (lack of hash validation).
2026-03-27 14:57:05 +01:00
Andrew Kelley 2d3694ab42 Merge pull request 'std.Io.Dir: add resolve_beneath flag and implement for freebsd,macos' (#31684) from resolve_beneath into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31684
2026-03-27 12:24:09 +01:00
GasInfinity 1f79a9e4e3 feat(Io.net): add allow_broadcast to BindOptions
* and implement it in `Threaded`, `Uring` and `Kqueue`
2026-03-27 09:43:57 +01:00
Andrew Kelley 9ad6843b20 std.tar.extract: sanitize path traversal
closes #31362
2026-03-27 01:27:38 -07:00
Andrew Kelley 79b5433da7 std.tar: rename pipeToFileSystem to extract 2026-03-27 01:27:26 -07:00
Andrew Kelley 2e4482cd14 std.Io.Dir: add resolve_beneath flag and implement for freebsd,macos 2026-03-27 01:23:04 -07:00
Andrew Kelley 6f467e436d std.Io: move File.CreateFlags to Dir.CreateFileOptions
for naming consistency.

same thing with File.OpenFlags -> Dir.OpenFileFlags
2026-03-27 01:23:04 -07:00
Andrew Kelley 0d25302d43 Package.Fetch: bump redirect buffer size
RFC 9110 says

> It is RECOMMENDED that all senders and recipients support, at a minimum,
> URIs with lengths of 8000 octets in protocol elements.

closes #30207
2026-03-27 08:42:02 +01:00
Alex Rønne Petersen a85495ca22 ci: update more system deps comments 2026-03-27 05:11:53 +01:00
Alex Rønne Petersen 142703ba51 ci: x86_64-linux-release requires cc 2026-03-27 04:42:05 +01:00
Jacob Young 49a258c0e0 std.Build.Step.Run: improve syscalls while running zig test executables
Previously, each message requires an unseekable error to be returned
from a syscall before proceeding.  Ideally, the code would just pass
around `*std.Io.Writer` instead of `std.Io.File` in the first place, but
even then, you could argue for saving a syscall with `writerStreaming`.
2026-03-27 03:28:50 +01:00
Alex Rønne Petersen 49fa67d826 fixup 58490f588c 2026-03-27 02:49:12 +01:00
Alex Rønne Petersen 58490f588c test: disable standalone test run_output_caching on windows
https://codeberg.org/ziglang/zig/issues/31564
2026-03-27 02:24:23 +01:00
Alex Rønne Petersen f40eb50157 std.fs.test: disable '.' and '..' in Dir functions test on *-windows
https://codeberg.org/ziglang/zig/issues/31561
2026-03-27 02:24:23 +01:00
Alex Rønne Petersen 36b28050f4 std.fs.test: disable AtomicFile test on windows
https://codeberg.org/ziglang/zig/issues/31389
2026-03-27 02:24:21 +01:00