34717 Commits

Author SHA1 Message Date
Andrew Kelley
f088bb0d6e don't put intern pool indexes in test cases 2025-06-07 12:29:51 -07:00
PlayDay
3208c80f2b fix: MIME for ZIP in Zig Fetch
Closes: #24098
2025-06-07 13:14:52 -04:00
Jacob Young
857cd172d6 Dwarf: restore missing non-entry padding
Sections without padding were only supposed to omit entry padding.
Otherwise, the allocation behavior is degenerate.
2025-06-07 13:13:47 -04:00
Andrew Kelley
8b875b17ad
Merge pull request #24072 from jacobly0/x86_64-default
Compilation: enable the x86_64 backend by default for debug builds
2025-06-07 13:08:22 -04:00
Alex Kladov
173bc42744
langref: undefined _is_ materialized in all safe modes (#24107)
* trailing whitespace

* langref: undefined _is_ materialized in all safe modes

I am also not super happy about the clause that immediately follows. I
_believe_ what we want to say here is that, simultaneously:

* undefined is guaranteed to be matrerialized in in all safe modes.
  A Zig implementation that elides `ptr.* = undefined` in ReleaseSafe
  mode would be a non-conforming implementation.
* A Zig program that relies on undefined being materialized is buggy.

But I don't think it's the time to engage this level of language-lawering!
2025-06-07 10:07:53 -07:00
mlugg
aa65fd5d7c cases: fix type names
A different merge must have changed these numbers before this PR was
merged, leading to CI failures.
2025-06-07 13:06:51 -04:00
Andrew Kelley
5a52da1b7a CI: skip llvm backend tests in the script for testing x86 backend 2025-06-06 23:42:15 -07:00
Andrew Kelley
125a9aa82b restore debug llvm CI coverage
and reduce redundant coverage in slow runs to save time
2025-06-06 23:42:15 -07:00
Jacob Young
37f763560b x86_64: fix switch dispatch bug
Also closes #23902
2025-06-06 23:42:15 -07:00
mlugg
f28ef7ee29 tests: extern threadlocals require LLVM
This is a current limitation of our self-hosted linkers.
2025-06-06 23:42:15 -07:00
mlugg
437059f37c tests: avoid loading 16 MiB onto the stack
Currently, Zig semantically loads an array as a temporary when indexing
it. This means it cannot be guaranteed that only the requested element
is loaded; in particular, our self-hosted backends do not elide the load
of the full array, so this test case was crashing on self-hosted.
2025-06-06 23:42:15 -07:00
Jacob Young
0bf8617d96 x86_64: add support for pie executables 2025-06-06 23:42:14 -07:00
Jacob Young
178ee8aef1 Sema: fix invalid pure Air instruction with comptime-known operands 2025-06-06 23:42:14 -07:00
Andrew Kelley
e19886a898 Compilation.Config: prefer_llvm depends on pie 2025-06-06 23:42:14 -07:00
Andrew Kelley
d6b1ff7533 Compilation.Config: eliminate the only variable from this function 2025-06-06 23:42:14 -07:00
Andrew Kelley
2387305b23 Compilation.Config: "can_use_llvm" -> "prefer_llvm" 2025-06-06 23:42:14 -07:00
Andrew Kelley
a59d18779f langref: global assembly test depends on llvm
see #24046
2025-06-06 23:42:14 -07:00
Jacob Young
5986bdf868 Compilation: enable the x86_64 backend by default for debug builds
Closes #22257
2025-06-06 23:42:14 -07:00
Andrew Kelley
e96d86064e
Merge pull request #24090 from fardragon/handle-empty-hash
zig build: Handle empty hashes in build.zig.zon
2025-06-06 22:48:09 -04:00
mlugg
38266c5035 AstGen: fix name strategy bugs
Representing this with a `GenZir` field is incredibly bug-prone.
Instead, just pass this data directly to the relevant expression in the
very few places which actually provide a name strategy.

Resolves: #22798
2025-06-06 22:04:51 +01:00
Gungun974
21a0885ae7 Make zig fetch handle jar like zip 2025-06-06 16:59:40 -04:00
Andrew Kelley
98646e5cf8
Merge pull request #24094 from jacobly0/x86_64-ld-scripts
link: support static archives that are linker scripts
2025-06-06 16:25:17 -04:00
Andrew Kelley
bc3ce4b971 hash mismatch error: don't make empty such a special case
we can more simply use quotes instead
2025-06-06 11:16:44 -07:00
Andrew Kelley
8f7fc63847 Package.Hash.toSlice: consistent pointer
Makes the returned pointer always point inside `Hash.bytes` even when it
is length zero.
2025-06-06 11:13:36 -07:00
fardragon
3c151f0b1c Handle empty hashes in build.zig.zon 2025-06-06 11:11:49 -07:00
Alex Rønne Petersen
b6d9046242 libcxx: Fix locale-related compilation errors on NetBSD.
llvm/llvm-project#143055
2025-06-06 11:22:20 +02:00
Jacob Young
bcf387f0b9 Elf: support non-comdat groups
I haven't actually found any documentation about these, but apparently groups
aren't always comdats.
2025-06-06 00:45:37 -04:00
Jacob Young
25da0f8372 link: support static archives that are linker scripts
Note that `openLoadArchive` already has linker script support.

With this change I get a failure parsing a real archive in the self
hosted elf linker, rather than the previous behavior of getting an error
while trying to parse a pseudo archive that is actually a load script.
2025-06-06 00:04:19 -04:00
Alex Rønne Petersen
98cf81d51c test: Expand target coverage for C ABI tests. 2025-06-05 21:50:56 +02:00
Elaine Gibson
7f73187004 std.fs.Dir: haiku fixes 2025-06-05 13:45:52 +01:00
Elaine Gibson
ed48e2eb75 std.crypto.Certificate.Bundle: haiku support 2025-06-05 13:45:52 +01:00
Elaine Gibson
2e5b3b5c7c build runner: disable fuzz in single-threaded builds 2025-06-05 13:45:52 +01:00
Elaine Gibson
2cfa0f567d std.Build.Watch: not supported on haiku 2025-06-05 13:45:47 +01:00
Elaine Gibson
2139eb75f9 std.c: getcontext is not supported on haiku 2025-06-05 12:30:54 +01:00
Elaine Gibson
8910ac2ba8 std.c.SOCK: define NONBLOCK and CLOEXEC for haiku 2025-06-05 12:30:54 +01:00
Elaine Gibson
8cd56e7088 haiku: restore functions mistakenly removed in e8c4e79 2025-06-05 12:30:54 +01:00
Alex Rønne Petersen
adc4418bae std.fs.Dir.Iterator: Address a couple of alignment TODOs. 2025-06-05 07:17:40 +02:00
Alex Rønne Petersen
9d534790eb std.Target: Introduce Cpu convenience functions for feature tests.
Before:

* std.Target.arm.featureSetHas(target.cpu.features, .has_v7)
* std.Target.x86.featureSetHasAny(target.cpu.features, .{ .sse, .avx, .cmov })
* std.Target.wasm.featureSetHasAll(target.cpu.features, .{ .atomics, .bulk_memory })

After:

* target.cpu.has(.arm, .has_v7)
* target.cpu.hasAny(.x86, &.{ .sse, .avx, .cmov })
* target.cpu.hasAll(.wasm, &.{ .atomics, .bulk_memory })
2025-06-05 06:12:00 +02:00
Alex Rønne Petersen
14873f9a34
Merge pull request #24068 from alexrp/android-pic-pie
compiler: Rework PIE option logic.
2025-06-05 01:14:03 +02:00
Alex Rønne Petersen
80f2aeb8be ci: Bump x86_64-linux timeout from 8 hours to 9 hours.
The addition of FreeBSD and NetBSD targets to the test matrix in #24013 seems to
be causing timeouts under load. We might need to exclude some of those from CI,
but start by bumping the timeout so we can get a sense of how much more time is
actually needed.
2025-06-04 19:52:38 +02:00
Alex Rønne Petersen
2add31bfde valgrind: Add riscv64-linux support.
This appeared in Valgrind 3.25.0.
2025-06-04 19:24:08 +02:00
Andrew Kelley
100b76e17a std.Build.Step.Compile: clarify step name
In particular this makes it more obvious what step is compiling a unit
test versus which is running it.
2025-06-04 12:25:49 -04:00
Alex Rønne Petersen
bc8ace2a6d compiler-rt: Issue VALGRIND_DISCARD_TRANSLATIONS request in __clear_cache().
Closes #24030.
2025-06-04 13:25:21 +02:00
Alex Rønne Petersen
c8b92f3a8e
zig cc: Pass -f(no-)(PIC,PIE) to Clang for *-(windows,uefi)-(gnu,cygnus).
The previous supports_fpic() check was too broad.
2025-06-04 10:35:04 +02:00
Alex Rønne Petersen
c620836945
zig cc: Pass -f(no-)PIE to clang.
Otherwise we rely on Clang's default which is known to not always match ours.
2025-06-04 10:32:30 +02:00
Alex Rønne Petersen
0ccd2b0c5c
compiler: Always dynamically link executables for Fuchsia.
Fuchsia only supports PIE executables, specifically ET_DYN.

https://fuchsia.dev/fuchsia-src/concepts/process/program_loading
2025-06-04 06:54:10 +02:00
Alex Rønne Petersen
a81fb5fb76
compiler: Rework PIE option logic.
To my knowledge, the only platforms that actually *require* PIE are Fuchsia and
Android, and the latter *only* when building a dynamically-linked executable.
OpenBSD and macOS both strongly encourage using PIE by default, but it isn't
technically required. So for the latter platforms, we enable it by default but
don't enforce it.

Also, importantly, if we're building an object file or a static library, and the
user hasn't explicitly told us whether to build PIE or non-PIE code (and the
target doesn't require PIE), we should *not* default to PIE. Doing so produces
code that cannot be linked into non-PIE output. In other words, building an
object file or a static library as PIE is an optimization only to be done when
the user knows that it'll end up in a PIE executable in the end.

Closes #21837.
2025-06-04 06:48:19 +02:00
Alex Rønne Petersen
3b2bef8a95
Merge pull request #24025 from alexrp/glibc-deduplication
`libc`: Merge header directories for glibc and NetBSD libc where applicable
2025-06-04 05:14:21 +02:00
Alex Rønne Petersen
cd03a0a153 compiler: Don't link ucrtbased.dll when targeting *-windows-msvc in Debug mode.
Linking it by default means that we produce binaries that, effectively, only run
on systems which have the Windows SDK installed because ucrtbased.dll is not
redistributable, and the Windows SDK is what actually installs ucrtbased.dll
into %SYSTEM32%. The resulting binaries also can't run under Wine because Wine
does not provide ucrtbased.dll.

It is also inconsistent with our behavior for *-windows-gnu where we always link
ucrtbase.dll. See #23983, #24019, and #24053 for more details.

So just use ucrtbase.dll regardless of mode. With this change, we can also drop
the implicit definition of the _DEBUG macro in zig cc, which has in some cases
been problematic for users.

Users who want to opt into the old behavior can do so, both for *-windows-msvc
and *-windows-gnu, by explicitly passing -lucrtbased and -D_DEBUG. We might
consider adding a more ergonomic flag like -fdebug-crt to the zig build-* family
of commands in the future.

Closes #24052.
2025-06-04 05:04:29 +02:00
Andrew Kelley
826e1c30ba
Merge pull request #24013 from alexrp/test-matrix
More target coverage in the module test matrix
2025-06-03 17:05:15 -04:00