Commit Graph

15085 Commits

Author SHA1 Message Date
Jacob Young 79cc29e238 std: experiment with using restricted function pointers in vtables 2026-04-24 11:48:37 -04:00
Jacob Young 221fb30b3c llvm: implement restricted type optimizations 2026-04-24 11:48:37 -04:00
Jacob Young 24bf438708 remove pointer restriction from restricted types 2026-04-24 11:08:01 -04:00
Jacob Young da85c089b8 implement llvm backend support for restricted type safety check 2026-04-24 11:08:01 -04:00
Jacob Young a8428b777c start implementing restricted types 2026-04-24 11:08:00 -04:00
Alex Rønne Petersen 3feb0d391f Revert "std.zig.system: disable vector support on s390x for now"
This reverts commit 1cd913a0ec.

The bug was fixed in LLVM 22.
2026-04-22 15:31:57 +02:00
Alex Rønne Petersen 7ca4489fdc Revert "std.mem: work around LoongArch inline asm bug in doNotOptimizeAway()"
This reverts commit e7f1624e6e.

The bug was fixed in LLVM 22.
2026-04-22 15:31:57 +02:00
Alex Rønne Petersen b01cc264e1 Revert "std.math.modf: disable vector test on LoongArch with LSX"
This reverts commit 35d2b1e99a.

The bug was fixed in LLVM 22.
2026-04-22 15:31:57 +02:00
Alex Rønne Petersen 7d3aee4bae 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-22 15:31:57 +02:00
Alex Rønne Petersen 804642b8fe std.zig.system.x86: improve AVX10 detection 2026-04-22 15:31:57 +02:00
Alex Rønne Petersen 3641dfcd1d std.zig.system.x86: require OS APX save support for APX features 2026-04-22 15:31:57 +02:00
Alex Rønne Petersen 8e15618d18 std.zig.system.x86: detect more APX features 2026-04-22 15:31:57 +02:00
Alex Rønne Petersen adc3e6001e std.zig.system.x86: detect Diamonds Rapids, Wildcat Lake, and Nova Lake 2026-04-22 15:31:57 +02:00
Alex Rønne Petersen ec0d6201c2 std.zig.system.x86: fix prefetchi detection on AMD 2026-04-22 15:31:57 +02:00
Alex Rønne Petersen e0d56643d3 std.zig.system.arm: add detection for a bunch more cores 2026-04-22 15:31:57 +02:00
Alex Rønne Petersen 0cd5490f08 std.zig.system.windows: update aarch64 CPU feature detection 2026-04-22 15:31:57 +02:00
Alex Rønne Petersen 961e5b9f76 std.os.windows: update PF feature flags from winnt.h 2026-04-22 15:31:57 +02:00
Alex Rønne Petersen 826b46d7bc compiler: fix and simplify DllMainCRTStartup handling
See: https://github.com/llvm/llvm-project/pull/171680
2026-04-22 15:31:57 +02:00
Alex Rønne Petersen f8f3b948e3 llvm: switch most targets to using half and fp128 IR types
As of LLVM 22, most backends can (finally) handle legalization of these types as
necessary, so we don't need to do it ourselves anymore.

closes https://github.com/ziglang/zig/issues/23674
2026-04-22 15:31:57 +02:00
Alex Rønne Petersen 9627d35990 compiler-rt: additionally export __trunctfhf2 as __trunckfhf2 on powerpc
This is the name LLVM 22 expects.
2026-04-22 15:31:57 +02:00
Alex Rønne Petersen 5110fadf3a std.Target: update CPU and feature data to LLVM 22 2026-04-22 15:31:57 +02:00
Alex Rønne Petersen d629b4c98b libtsan: backport llvm/llvm-project#183411
https://github.com/llvm/llvm-project/pull/183411
2026-04-22 15:31:57 +02:00
Alex Rønne Petersen 3df246905f libtsan: update to LLVM 22 2026-04-22 15:31:56 +02:00
Alex Rønne Petersen 20f08ad09c libunwind: update to LLVM 22 2026-04-22 15:31:56 +02:00
Alex Rønne Petersen 78591e1d98 libcxx: update to LLVM 22 2026-04-22 15:31:56 +02:00
Alex Rønne Petersen c32618eed0 libcxxabi: update to LLVM 22 2026-04-22 15:31:56 +02:00
Alex Rønne Petersen c81170dcd6 zig cc: update intrinsic headers to LLVM 22 2026-04-22 15:31:56 +02:00
Alex Rønne Petersen 692bd03489 std.zig.llvm.Builder: fix writing u64 max constant for type bit_count > 64 2026-04-22 15:31:56 +02:00
Alex Rønne Petersen 022fcc5869 std.Target: fuchsia supports arm/thumb now 2026-04-22 15:31:56 +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
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
Andrew Kelley 6067a8b1a0 Merge pull request 'std.Io.Dir: fix incorrect return types in setFileOwner and setTimestampsNow' (#31940) from lukasl/zig:fix-dir-setfileowner-error-type into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31940
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-20 02:23:17 +02:00
David Rubin a0a36bf92e io: make toClock compile 2026-04-19 16:58:12 -07:00
Alex Kladov 76174e1bce fuzz: don't err if .zig-cache/tmp doesn't exist
If we have just created cache_dir_path, then there's no `tmp` dir
there, and

    cache_dir.createFile(io, "tmp/libfuzzer.log", .{ .truncate = false })

fails.

Tested via

    $ zig version
    0.16.0
    $ zig build --zig-lib-dir ~/p/zig/lib/ --fuzz
2026-04-20 01:20:52 +02:00
Andrew Kelley 50f96d2ca1 std.Io.Dir: add type checking for those two functions 2026-04-19 10:08:23 -07:00
Lukas Lalinsky 52e06ce4f6 std.Io.Dir: fix incorrect return types in setFileOwner and setTimestampsNow
`setFileOwner` declared `SetOwnerError!void` but its vtable method
returns the wider `SetFileOwnerError!void` (adds `NameTooLong` and
`BadPathName`), so any call through the wrapper fails to compile.

`setTimestampsNow` dispatched to `io.vtable.fileSetTimestamps` with
`(Dir, []const u8, Dir.SetTimestampsOptions)`, but that vtable entry
takes `(File, File.SetTimestampsOptions)`. The intended target is
`dirSetTimestamps`, whose signature matches the call site.
2026-04-19 10:07:44 -07:00
Mason Remaley e2c3920fb1 Renames buffer first allocator in compiler and std 2026-04-18 14:51:49 -07:00
Mason Remaley 6d40d374d8 Merges together the two buffer first allocator implementations 2026-04-18 14:51:49 -07:00
Mason Remaley 8c96487bb9 Updates all uses of StackFallbackAllocator 2026-04-18 14:51:49 -07:00
Mason Remaley a4d8e9608e Reworks the stack fallback allocator
The previous approach had a few downsides:

1. You couldn't set the alignment of the internal buffer. Many callers in
   the standard library trying to use this for a small vec style
   optimization worked around this by setting the alignment for
   the struct itself, this ends up very verbose and also assumes a
   specific layout for the struct which isn't guaranteed.

2. It was generic over the size of the buffer. This type is used a lot in
   std with various sizes.

3. It has an awkward API where you had to call get which mutated the type
   unlike all other allocators, and then had a runtime check to make sure
   you didn't get this wrong.

The new approach resolves all of these issues by just taking the buf as
an argument.

This is particularly amenable to smallvec style optimizations: you can
just declare the buf as an array of the item you want to allocate to get
the exact minimum size.
2026-04-18 14:51:49 -07:00