Commit graph

33402 commits

Author SHA1 Message Date
Andrew Kelley
2cb69e53b4
Merge pull request #23541 from alexrp/linux-5.10
`std.Target`: Bump minimum Linux kernel and glibc versions according to Debian LTS
2025-04-13 17:25:34 -04:00
samy007
b635b37249 std.math.big.int: remove setRuntimeSafety 2025-04-13 21:07:11 +02:00
Alex Rønne Petersen
e24e9ff7bd
Merge pull request #23555 from alexrp/gitattributes
Some `.gitattributes` updates
2025-04-13 09:24:33 +02:00
Andrew Kelley
f32a5d349d std: eradicate u29 and embrace std.mem.Alignment 2025-04-13 02:20:32 -04:00
Bingwu Zhang
ec28888581 doc: Bump LLVM version in README
Reported-by: Ricky8955555 <rkmiao@duck.com>
Signed-off-by: Bingwu Zhang <xtex@aosc.io>
2025-04-13 08:11:40 +02:00
Alex Rønne Petersen
6eabdc8972 link: Improve handling of --build-id when using LLD. 2025-04-13 01:46:15 +02:00
Luis Cáceres
d5ac3be608 src/libunwind.zig: Fix symbol visibility macro define
The define was changed in commit 729899f7b6bf6aff65988d895d7a639391a67608
in upstream llvm.
2025-04-12 22:27:28 +02:00
Alex Rønne Petersen
01aeb2f296
.gitattributes: Fix lib/libtsan path after ee0ff134e9. 2025-04-12 20:30:38 +02:00
Alex Rønne Petersen
c3a408e245
.gitattributes: Add more testdata directories. 2025-04-12 20:30:11 +02:00
Frank Denis
a7122b7323
std.crypto: add constant-time codecs (#23420)
std.crypto: add constant-time codecs

Add constant-time hex/base64 codecs designed to process cryptographic
secrets, adapted from libsodium's implementations.

Introduce a `crypto.codecs` namespace for crypto-related encoders and
decoders. Move ASN.1 codecs to this namespace.

This will also naturally accommodate the proposed PEM codecs.
2025-04-12 20:13:45 +02:00
Alex Rønne Petersen
9352f379e8
Merge pull request #23529 from alexrp/2879-groundwork
Introduce libzigc for libc function implementations in Zig
2025-04-12 18:14:17 +02:00
Andrew Kelley
4e700fdf8e
Merge pull request #22516 from Jan200101/PR/build_id_option
std.Build: add build-id option
2025-04-11 16:37:46 -04:00
Andrew Kelley
65bd8d52c8
Merge pull request #23061 from pavelverigo/stage2-wasm-misc
stage2-wasm: multiple fixes
2025-04-11 15:56:35 -04:00
Andrew Kelley
08a6c4ca9b
Merge pull request #23272 from squeek502/getenvw-optim
Windows: Faster `getenvW` and a standalone environment variable test
2025-04-11 15:46:34 -04:00
g-logunov
326f254972
std.posix.getenv: early-return comparison (#23265)
Fixes std.posix.getenv() being slower than musl getenv() even when linking libc
2025-04-11 12:44:18 -07:00
kcbanner
fa59153896 Value: ensure that extern structs have their layout resolved in ptrField 2025-04-11 15:30:20 -04:00
Alex Rønne Petersen
2527c82482
std.os.linux: Use faccessat2 syscall in faccessat().
Only the former has a flags parameter. It's only available in Linux 5.8+.

Closes #16606.
2025-04-11 21:17:35 +02:00
Alex Rønne Petersen
46d03c5afa
std.Target: Bump minimum glibc version to 2.31.
This is the version in Debian LTS (bullseye).
2025-04-11 21:11:20 +02:00
Alex Rønne Petersen
731d6531bf
std.Target: Bump minimum Linux kernel version to 5.10.
This is the kernel in Debian LTS (bullseye).
2025-04-11 21:10:55 +02:00
Alex Rønne Petersen
90084f4ae3
Merge pull request #23483 from alexrp/target-int-functions
compiler: Move int size/alignment functions to `std.Target` and `std.zig.target`
2025-04-11 17:40:47 +02:00
Alex Rønne Petersen
1f896c1bf8
Introduce libzigc for libc function implementations in Zig.
This lays the groundwork for #2879. This library will be built and linked when a
static libc is going to be linked into the compilation. Currently, that means
musl, wasi-libc, and MinGW-w64. As a demonstration, this commit removes the musl
C code for a few string functions and implements them in libzigc. This means
that those libzigc functions are now load-bearing for musl and wasi-libc.

Note that if a function has an implementation in compiler-rt already, libzigc
should not implement it. Instead, as we recently did for memcpy/memmove, we
should delete the libc copy and rely on the compiler-rt implementation.

I repurposed the existing "universal libc" code to do this. That code hadn't
seen development beyond basic string functions in years, and was only usable-ish
on freestanding. I think that if we want to seriously pursue the idea of Zig
providing a freestanding libc, we should do so only after defining clear goals
(and non-goals) for it. See also #22240 for a similar case.
2025-04-11 17:12:31 +02:00
Jacob Young
27cfff8f44 x86_64: pass exact integer bit sizes to compiler-rt routines
This was a hack around compiler-rt not computing the correct size.
2025-04-11 07:06:01 -04:00
Jacob Young
b31a91bbef compiler-rt: compute correct integer sizes from bits at runtime
Also, accepting `align(1)` pointers ensures that the alignment is safety
checked rather than assumed.
2025-04-11 07:06:01 -04:00
Alex Rønne Petersen
ed9aa8f259 compiler: Move int size/alignment functions to std.Target and std.zig.target.
This allows using them in e.g. compiler-rt.
2025-04-11 05:22:00 -04:00
Alex Rønne Petersen
0132be7bf3 std.Target: Rename charSignedness() to cCharSignedness().
To be consistent with the other functions that answer C ABI questions.
2025-04-11 05:22:00 -04:00
Jacob Young
c82e1fe880
Merge pull request #23355 from jacobly0/x86_64-rewrite
x86_64: start rewriting overflow operations
2025-04-11 05:21:44 -04:00
Alex Rønne Petersen
9e21ba12d5 libcxx: Backport llvm/llvm-project#134874.
https://github.com/llvm/llvm-project/pull/134874
2025-04-11 09:05:44 +02:00
Alex Rønne Petersen
8f03217f3e
Merge pull request #23497 from alexrp/hexagon
Some `hexagon-linux` porting work
2025-04-11 08:42:53 +02:00
Alex Rønne Petersen
d01f2aa6e7
test: Add hexagon-linux-(none,musl) to the test matrix.
This skips std tests for now: https://github.com/llvm/llvm-project/pull/111217
2025-04-11 02:29:27 +02:00
Alex Rønne Petersen
01b5e8b296
std: Disable some vector-related tests for hexagon.
See:

* https://github.com/llvm/llvm-project/issues/118879
* https://github.com/llvm/llvm-project/issues/134659
2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
382aa48f04
test: Disable a bunch of vector behavior tests for hexagon.
Most of the failures are:

* https://github.com/llvm/llvm-project/issues/118879
* https://github.com/llvm/llvm-project/issues/134659

But some are also miscompilations leading to wrong results. I'm not going to
investigate the latter further until all the backend crashes have been resolved.
2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
0a5c088ecc
compiler: Add hexagon-linux-musl support.
Closes #21588.
2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
e939fc859d
musl: Update libc.S for hexagon-linux-musl. 2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
7f20b9f9db
musl: Add hexagon-linux-musl headers. 2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
3df67dc414
musl: Add hexagon-linux-musl sources.
This is from Qualcomm's fork: https://github.com/quic/musl

I maintain a fork of musl where I rebase Qualcomm's changes on top of the latest
musl release, which I then use as the basis for musl updates in Zig. My fork can
be found here: https://github.com/alexrp/musl/tree/hexagon
2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
30200edc1e
gen_stubs: Add hexagon-linux-musl support. 2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
cd58615c17
process_headers: Add hexagon-linux-musl support. 2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
2174014349
wasi-libc: Remove pointless alltypes.h.in file. 2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
ee0ff134e9
tsan: Rename lib/tsan to lib/libtsan.
For consistency with other vendored C/C++ libraries.
2025-04-11 02:08:18 +02:00
Alex Rønne Petersen
71a237e764
std.zig.system: Force soft_float feature on for MIPS soft float targets.
Workaround for: https://github.com/llvm/llvm-project/issues/135283
2025-04-11 02:08:18 +02:00
Pat Tullmann
4b63f94b4e Fix sigaddset/sigdelset bit-fiddling math
The code was using u32 and usize interchangably, which doesn't work on
64-bit systems.  This:
  `pub const sigset_t = [1024 / 32]u32;`
is not consistent with this:
  `const shift = @as(u5, @intCast(s & (usize_bits - 1)));`

However, normal signal numbers are less than 31, so the bad math doesn't matter much.  Also, despite support for 1024 signals in the set, only setting signals between 1 and NSIG (which is mostly 65, but sometimes 128) is defined.  The existing tests only exercised signal numbers in the first 31 bits so they didn't trip over this:

The C library `sigaddset` will return `EINVAL` if given an out of bounds signal number.  I made the Zig code just silently ignore any out of bounds signal numbers.

Moved all the `sigset` related declarations next to each in the source, too.

The `filled_sigset` seems non-standard to me.  I think it is meant to be used like `empty_sigset`, but it only contains 31 set signals, which seems wrong (should be 64 or 128, aka `NSIG`).  It's also unused.  The oddly named but similar `all_mask` is used (by posix.zig) but sets all 1024 bits (which I understood to be undefined behavior but seems to work just fine).  For comparison the musl `sigfillset` fills in 65 bits or 128 bits.
2025-04-10 23:49:44 +02:00
Alex Rønne Petersen
a9ff2d56ce Compilation: Pass -m<os>-version-min=... to Clang for all applicable Darwin targets. 2025-04-10 22:11:13 +02:00
Jacob Young
73498737a2 x86_64: fix error_set_has_value of inferred error sets 2025-04-10 06:04:09 -04:00
Jacob Young
06eebafadd AstGen: redistribute inline asm limits 2025-04-10 06:04:09 -04:00
Jacob Young
7a2963efab x86_64: add avx512 registers 2025-04-10 02:04:52 -04:00
Jacob Young
bbf8abf5d3 x86_64: support rip-relative addressing to labels in inline asm 2025-04-10 02:04:52 -04:00
Jacob Young
f4a31bed98 x86_64: remove broken const value tracking 2025-04-10 02:04:52 -04:00
Jacob Young
1eb5d70d12 x86_64: fix switch on big ints 2025-04-09 20:14:12 -04:00
Jacob Young
bc10131db1 x86_64: rewrite scalar @mulWithOverflow
Closes #19607
2025-04-09 20:14:12 -04:00
Jacob Young
55ce756868 x86_64: rewrite scalar @subWithOverflow 2025-04-09 20:14:12 -04:00