13437 Commits

Author SHA1 Message Date
Alex Rønne Petersen a83aad152b Merge pull request 'LLVM 22' (#32013) from llvm22 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32013
2026-04-26 07:03:38 +02:00
Andrew Kelley e7d74e49b0 declare linker test bankruptcy
The active contributors and maintainers of Zig's linker code have
generally found the current linker test harness to be cumbersome. The
tests require a lot of maintenance, but do not provide a lot of
coverage, and when they fail it is painful to troubleshoot.

Furthermore, as part of working on #31691, I don't want to port over the
CheckObject step, because I don't like the code anyway.

The plan forward is to start enhancing `zig objdump` to assist in
linker development, as well as using it as the basis for snapshot
testing.

We absolutely need linker test coverage, but we need to try to improve
these things about the next attempt:
* less effort to create and maintain tests
* less CPU overhead - we should be able to add a lot of tests without
  adding a lot of CI time.
* more helpful failures. A failed linker test should provide the next
  steps a developer can take to understand why the test failed.
* a goal of porting over all of LLD's test suite, or at least the good
  ones.

I'm not going to open an issue to track the lost linker test coverage,
because there was already so much lack of coverage for linker stuff.

However I will open issues to track this lost coverage:
* the deleted checks from test/standalone/glibc_compat/build.zig
* the deleted checks from test/standalone/compiler_rt_panic/build.zig
* the deleted checks from test/standalone/ios/build.zig
2026-04-26 00:15:07 +02:00
Alex Rønne Petersen bd12a5a6e1 std: re-enable a bunch of tests that now pass
closes https://github.com/ziglang/zig/issues/21893
closes https://github.com/ziglang/zig/issues/23806
closes https://github.com/ziglang/zig/issues/23807
closes https://github.com/ziglang/zig/issues/24191
closes https://codeberg.org/ziglang/zig/issues/30220
2026-04-25 21:54:48 +02:00
Alex Rønne Petersen 7829397f89 Revert "std.zig.system: disable vector support on s390x for now"
This reverts commit 1cd913a0ec.

The bug was fixed in LLVM 22.
2026-04-25 21:54:48 +02:00
Alex Rønne Petersen 061c13f13b Revert "std.mem: work around LoongArch inline asm bug in doNotOptimizeAway()"
This reverts commit e7f1624e6e.

The bug was fixed in LLVM 22.
2026-04-25 21:54:48 +02:00
Alex Rønne Petersen 51a6a5a2a6 Revert "std.math.modf: disable vector test on LoongArch with LSX"
This reverts commit 35d2b1e99a.

The bug was fixed in LLVM 22.
2026-04-25 21:54:48 +02:00
Alex Rønne Petersen 8eb8034af9 Revert "std.zig.system: Force soft_float feature on for MIPS soft float targets."
This reverts commit 71a237e764.

The bug was fixed in LLVM 22.
2026-04-25 21:54:48 +02:00
Alex Rønne Petersen cb2cb21b31 std.zig.system.x86: improve AVX10 detection 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen 13c6e227a9 std.zig.system.x86: require OS APX save support for APX features 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen 44004b05ef std.zig.system.x86: detect more APX features 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen c46a8e0d2c std.zig.system.x86: detect Diamonds Rapids, Wildcat Lake, and Nova Lake 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen a24eee8390 std.zig.system.x86: fix prefetchi detection on AMD 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen 6880b5678a std.zig.system.arm: add detection for a bunch more cores 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen eb041a514f std.zig.system.windows: update aarch64 CPU feature detection 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen 7c3d4642ae std.os.windows: update PF feature flags from winnt.h 2026-04-25 21:54:48 +02:00
Alex Rønne Petersen 1be84a39b8 compiler: fix and simplify DllMainCRTStartup handling
See: https://github.com/llvm/llvm-project/pull/171680
2026-04-25 21:54:48 +02:00
Alex Rønne Petersen ca0b3318a0 std.Target: update CPU and feature data to LLVM 22 2026-04-25 21:54:47 +02:00
Alex Rønne Petersen 8deae2da4c std.zig.llvm.Builder: fix writing u64 max constant for type bit_count > 64 2026-04-25 21:49:39 +02:00
Alex Rønne Petersen 48d5b66677 std.Target: fuchsia supports arm/thumb now 2026-04-25 21:49:38 +02:00
Alex Rønne Petersen 8a1ec6a54d std.Target: fix Abi.float() for muslsf 2026-04-25 21:49:38 +02:00
Jonathan Marler 23bcb8148f add missing CONNECTION_REFUSED and CONNECTION_RESET errors for windows
Adds missing errors CONNECTION_REFUSED for netConnectIpWindows and
CONNECTION_RESET for both netReadWindows and netWriteWindows.  I'm able
to induce these 3 errors on my Windows 11 machine.
2026-04-25 05:20:16 +02:00
Sertonix 5cc281e723 std.os.linux: avoid invalid asm error with gcc on x86
Even though these registry mentions are supposed to be in a comment they
seem to still be interpreted by gcc.

Alternatively one could try to make zig not include comments in assembly
blocks when generating C code.

In function 'os_linux_x86_syscall6__6685',
    inlined from 'os_linux_copy_file_range__4300' at zig2.c:396643:7,
    inlined from 'link_MappedFile_copyFileRange__14079.isra' at zig2.c:289222:10:
zig2.c:396692:2: error: invalid 'asm': operand number missing after %-letter
396692 |  __asm volatile(" push %[args56]\n push %%ebp\n mov 4(%%esp), %%ebp\n mov %%edi, 4(%%esp)\n // The saved %edi and %ebp are on the stack, and %ebp points to `args56`.\n // Prepare the last two args, syscall, then pop the saved %ebp and %edi.\n mov (%%ebp), %%edi\n mov 4(%%ebp), %%ebp\n int  $0x80\n pop  %%ebp\n pop  %%edi": [ret]"=r"(t5): [number]"r"(t6), [arg1]"r"(t7), [arg2]"r"(t8), [arg3]"r"(t9), [arg4]"r"(t10), [args56]"rm"(t2): "memory");
       |  ^~~~~
zig2.c:396692:2: error: invalid 'asm': operand number missing after %-letter
zig2.c:396692:2: error: invalid 'asm': operand number missing after %-letter
zig2.c:396692:2: error: invalid 'asm': operand number missing after %-letter
zig2.c:396692:2: error: invalid 'asm': operand number missing after %-letter
2026-04-24 07:33:22 +02:00
Andrew Kelley f6258b562d Merge pull request 'fix bugs with handling fuzzing crashes' (#32033) from gooncreeper/zig:fuzz-crash-report-bugs into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32033
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-24 02:31:12 +02:00
Kendall Condon 332d632ccc collect all stderr on fuzzing crash 2026-04-22 20:54:17 -04:00
Kendall Condon 122e0c26f2 properly scan through inputs when saving fuzzing crash 2026-04-22 20:54:17 -04:00
Matthew Lugg 99b90a4315 incremental: add misssing dependency on backing/tag type source code 2026-04-23 01:13:22 +02:00
andrew.kraevskii bbab366b78 Audit usages of toOwnedSlice (#32001)
Followup to #30769

I grepped for `try .*toOwnedSlice` and checked all of them by hand.

Fixes a bunch of memory leaks removes usages or `errdefer` and `vars` in some places. I also switched array_list.Managed to ArrayList where it was convenient.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32001
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-22 19:35:46 +02:00
rpkak 03955476ad zigc: test and fix strtol and similar 2026-04-22 19:30:39 +02:00
Alex Rønne Petersen b985404569 std.os.linux: update syscalls to 7.0 2026-04-22 08:37:56 +02:00
Alex Rønne Petersen 8bf72740e3 std.os.linux.IoUring: disable tests on PowerPC
https://codeberg.org/ziglang/zig/issues/31562
2026-04-22 08:27:51 +02:00
Chris Boesch 3ea77badf9 libc: strdup, strndup, wcsdup (#31935)
Contributes to: #30978

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31935
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-22 01:57:58 +02:00
Pavel Verigo 36faf76fe1 AstGen: add missing addRestoreErrRetIndex calls when handling for/while expr
Fixes #30912
2026-04-22 00:17:52 +02:00
Andrew Kelley d4cac43d30 Merge pull request 'libc: add common implementations of pthread_spin_*' (#31990) from GasInfinity/zig:pthread-spin into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31990
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-21 22:29:33 +02:00
Andrew Kelley b5d8966e05 Merge pull request 'package fetching fixes and enhancements' (#31992) from fetch-enhancements into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31992
2026-04-21 18:06:13 +02:00
GasInfinity f8e9593851 fix: wasm requires strict function prototypes
* `pthread_mutex_*` and friends are also invalid then but they're not
  currently tested (and there's no wasi prong in `pthread_mutex_t`)
2026-04-21 14:45:24 +02:00
GasInfinity a2a91199d7 fix: add pthread_spin_* definitions for the BSDs in std.c
* each BSD has a different one
2026-04-21 10:31:47 +02:00
GasInfinity 61cd38e8ac feat(libzigc): add common implementations of pthread_spin_*
* and remove their mingw, musl and wasi implementations
2026-04-21 09:03:06 +02:00
Ryan Liptak 3252a05531 Prefer <err> => |e| return e over <err> => return <err>
Avoids the potential for a typo on the `return <err>` side of the prong
2026-04-20 18:03:14 -07:00
Andrew Kelley f887bea4d3 fix overridden pkg dir path
the previous code made it relative to the build directory

also add a corresponding env var and logic for build command
2026-04-20 16:38:05 -07:00
Frank Denis 98cc059622 crypto.asn1.Oid: Reject empty OID encodings (#31983)
The DER decoder accepted zero-length OID payloads producing an Oid value that would panic later.

Co-authored-by: Frank Denis <github@pureftpd.org>
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31983
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: Frank Denis <jedisct1@noreply.codeberg.org>
Co-committed-by: Frank Denis <jedisct1@noreply.codeberg.org>
2026-04-20 21:54:04 +02:00
Frank Denis 98ddebc380 std.crypto.Certificate: fix UTCTime year interpretation
UTCTime years in the range 50-99 must map to 1950-1999, but the
parser unconditionally added 2000, producing dates 100 years in the
future.

This caused verify() to accept certificates whose validity actually
expired decades ago.

Change that to match what OpenSSL, BoringSSL, etc. do
2026-04-20 21:45:08 +02:00
Frank Denis 525aff6048 std.crypto.ascon: fix streaming XOF/CXOF
AsconXof128 and AsconCxof128 were applying the padding in update()
calls. That was totally fine for one-shot hashing, but not for
streaming (multiple update() calls before finalization).
2026-04-20 18:29:46 +02:00
Frank Denis 3a07f50dab std.crypto.ml_kem tests: simplify incV
We don't need to reimplement 16-byte subtraction, just use a
u128. As a bonus, that handles the theoretical case of an all-0xff
value properly.
2026-04-20 18:27:22 +02:00
Frank Denis 858d7eda65 Merge pull request 'io: make toClock compile' (#31966) from sinon/zig:fix-io-clock into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31966
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-20 16:58:12 +02:00
Frank Denis c51e26887e Merge pull request 'tls.Client: reject empty TLS 1.3 inner plaintext and short records' (#31972) from jedisct1/zig:empty-plaintext-underflows-content-type-parsing into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31972
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-20 16:57:41 +02:00
nektro 259e4cf9fd std.ArrayHashMap: this workaround is no longer necessary 2026-04-20 16:49:52 +02:00
Frank Denis ac7e895df0 tls.Client: reject empty TLS 1.3 inner plaintext and short records
After decryption, TLS 1.3 plaintext is trimmed of zero padding, then
the last byte is read as the content type.

But when the plaintext was entirely zero padding, we got a
"thread panic: integer overflow at msg.len - 1" error. That could be
triggered by any server to crash the client.
2026-04-20 12:07:51 +02:00
Andrew Kelley 4e2147d14e Merge pull request 'Fix uefi (un)installMultipleProtocolInterfaces' (#31934) from mrosowski/zig:uefi-fix-install-multiple into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31934
Reviewed-by: linus <mail@linusgroh.de>
2026-04-20 07:05:35 +02:00
David Rubin a0a36bf92e io: make toClock compile 2026-04-19 16:58:12 -07:00
Andrew Kelley 50f96d2ca1 std.Io.Dir: add type checking for those two functions 2026-04-19 10:08:23 -07:00