35318 Commits

Author SHA1 Message Date
bnuuydev
173f497e29 llvm-backend: fix uefi data layout
the old logic caused the uefi case to fall through which caused an
assertion assertion in llvm to fail, as the data layout was wrong.
2025-10-16 13:59:02 +02:00
Alex Rønne Petersen
48f8133bea
Merge pull request #25569 from alexrp/std-debug-sparc
`std.debug`: implement `sparc*-linux` unwinding
2025-10-16 10:14:05 +02:00
Alex Rønne Petersen
493ad58ff7
Revert "ci: enable running libc-test on x86_64-linux-release"
This reverts commit fcfdf99122b17a928c144c3d70418b35e6b1620e.

This added too much load to the x86_64-linux machines, resulting in timeouts
pretty much across the board.
2025-10-15 21:30:25 +02:00
Frank Denis
6669885aa2
Faster BLAKE3 implementation (#25574)
This is a rewrite of the BLAKE3 implementation, with vectorization.

On Apple Silicon, the new implementation is about twice as fast as the previous one.

With AVX2, it is more than 4 times faster.

With AVX512, it is more than 7.5x faster than the previous implementation (from 678 MB/s to 5086 MB/s).
2025-10-15 14:03:56 +02:00
Alex Rønne Petersen
e0f10da270
std.debug: FP-based unwinding is ideal on SPARC
The way SPARC works due to its ABI built around register windows means that we
can always do fast FP-based unwinding.
2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
dd7819220a
std.debug: fix return addresses being off on SPARC
The return address points to the call instruction on SPARC, so the actual return
address is 8 bytes after. This means that we shouldn't do the return address
adjustment that we normally do.
2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
912fed3380
std.debug: use the SP as the initial FP on SPARC
The FP would point to the register save area for the previous frame, while the
SP points to the register save area for the current frame. So use the latter.
2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
6de2d61a0c
std.debug: work around latest SPARC register window not being spilled on signal
I have no idea if this is a QEMU bug or real kernel behavior. Either way, the
register save area specifically exists for asynchronous spilling of incoming and
local registers, so there should be no harm in doing this.
2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
78bc5d46e0
std.debug: the SPARC stack bias is only used on the 64-bit ABI 2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
ebc0b90eb7
std.debug: rename some constants for clarity 2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
62a8cfd5fe
std.debug: fix an invalid read in StackIterator.next()
We're overwriting the memory that unwind_context sits in, so we need to do the
getFp() call earlier.
2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
a36dab2f90
std.debug.Dwarf: add SPARC register number mappings 2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
b2732645b7
std.debug.cpu_context: add sparc*-linux context conversion support
It's not really a ucontext_t at all. Lovely stuff.
2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
b8dd40fde8
std.debug.cpu_context.Sparc: flush register windows in current()
It's better to do this here than in StackIterator.init() so that
std.debug.cpu_context.Native.current() isn't a footgun on SPARC.
2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
12b1d57df1
std.debug.cpu_context: add Sparc context 2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
3d3aff0da9
std.debug: flush SPARC register windows from a new window
flushw and ta 3 flush all windows *except* the current one. So we need to do
this in a new register window to get all of the ones we care about.
2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
f21a78b5a3
std.debug.SelfInfo.Elf: don't support DWARF unwinding for Hexagon and PowerPC
As for SPARC, FP-based unwinding is superior on these.
2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
0ace906477
std.os.windows.CONTEXT: add sp field to getRegs() result for x86 2025-10-15 13:59:17 +02:00
Alex Rønne Petersen
70c21fdbab
libc-test: disable utime.c
Fails under heavy load in CI; futimens() effects aren't reflected in the
subsequent fstat() call for some reason.
2025-10-15 10:58:30 +02:00
Jacob Young
cc3c4d1069 windows: workaround kernel race condition in more places 2025-10-14 23:16:36 -04:00
Alex Rønne Petersen
595cd8935a ci: update to QEMU 10.1.1 2025-10-15 01:33:52 +02:00
Alex Rønne Petersen
27a396db4f
Merge pull request #25572 from alexrp/libcxx-backports
`libcxx`: backport llvm/llvm-project#155476, llvm/llvm-project#147389, llvm/llvm-project#155786
2025-10-15 00:24:35 +02:00
Alex Rønne Petersen
4edebf40d5
Merge pull request #25402 from alexrp/libc-test-ci
`ci`: enable running libc-test on `x86_64-linux-release`
2025-10-14 21:29:57 +02:00
Alex Rønne Petersen
c8b34bc8a3 libunwind: backport llvm/llvm-project#152942
https://github.com/llvm/llvm-project/pull/152942
2025-10-14 19:56:07 +02:00
Alex Rønne Petersen
b34a13da38 std.os.linux.sparc64: use icc instead of xcc in asm clobbers
LLVM currently doesn't recognize xcc; icc does what we want.
2025-10-14 16:56:44 +02:00
Alex Rønne Petersen
bc58b5dc53
libcxx: backport llvm/llvm-project#155786
https://github.com/llvm/llvm-project/pull/155786
2025-10-14 12:10:41 +02:00
Alex Rønne Petersen
10ea69912f
libcxx: backport llvm/llvm-project#147389
https://github.com/llvm/llvm-project/pull/147389
2025-10-14 12:07:43 +02:00
Alex Rønne Petersen
820dc9d767
libcxx: backport llvm/llvm-project#155476
https://github.com/llvm/llvm-project/pull/155476
2025-10-14 12:04:57 +02:00
aarvay
2f3234c76a
std.crypto: add AES-CCM and CBC-MAC (#25526)
* std.crypto: add AES-CCM and CBC-MAC

Add AES-CCM (Counter with CBC-MAC) authenticated encryption and
CBC-MAC message authentication code implementations to the standard
library.

AES-CCM combines CTR mode encryption with CBC-MAC authentication as
specified in NIST SP 800-38C and RFC 3610. It provides authenticated
encryption with support for additional authenticated data (AAD).

CBC-MAC is a simple MAC construction used internally by CCM, specified
in FIPS 113 and ISO/IEC 9797-1.

Includes comprehensive test vectors from RFC 3610 and NIST SP 800-38C.

* std.crypto: add CCM* (encryption-only) support to AES-CCM

Implements CCM* mode per IEEE 802.15.4 specification, extending
AES-CCM to support encryption-only mode when tag_len=0. This is
required by protocols like ZigBee, Thread, and WirelessHART.

Changes:
- Allow tag_len=0 for encryption-only mode (no authentication)
- Skip CBC-MAC computation when tag_len=0 in encrypt/decrypt
- Correctly encode M'=0 in B0 block for CCM* mode
- Add Aes128Ccm0 and Aes256Ccm0 convenience instances
- Add IEEE 802.15.4 test vectors and CCM* tests

* std.crypto: add doc comments for AES-CCM variants
2025-10-14 12:00:44 +02:00
Jacob Young
958faa7031 windows: workaround kernel race condition the most 2025-10-12 13:55:57 -04:00
Alex Rønne Petersen
ea694bfdb7 std.debug.cpu_context: consider arm and aarch64 reserved register ranges unsupported
If these ever get allocated, it's most likely going to be for things that don't
matter to us anyway, so completely abandoning DWARF unwinding just because we
see these doesn't seem justified. We will still do so if we're actually asked to
read from such a register, which is the only actually problematic case; see
c23a5ccd19 for more details.
2025-10-12 12:59:06 +02:00
Alex Rønne Petersen
9b4f2b40e3 musl: avoid r0 as address register in s390x __tls_get_offset
https://www.openwall.com/lists/musl/2025/10/12/4

See also 7b92d5f4052be651e9bc5cd4ad78a69ccbee865d...
2025-10-12 11:38:43 +02:00
Fri3dNstuff
87c18945c2
std.ArrayList: swapRemove set removed element to undefined (#25514) 2025-10-11 19:04:32 -07:00
Jacob Young
95242cc431 windows: workaround kernel race condition even more 2025-10-11 12:17:39 -04:00
Jacob Young
8efcfeaf1e windows: workaround kernel race condition better
Until I can do more testing, we bump the numbers until morale improves.
2025-10-11 10:01:17 -04:00
mlugg
923ddd94a1
std.posix: panic on unexpected error in munmap
This is to help diagnose #25498. We can't use `unexpectedErrno` here,
because `std.posix.munmap` is infallible. So, when the flag is set to
report unexpected errnos, we just call `std.debug.panic` to provide
details instead of doing `unreachable`.

Pushing straight to master after running checks locally; there's no
point waiting for CI on the PR just for this.
2025-10-11 11:46:30 +01:00
Jacob Young
2e31077fe0 Coff: implement threadlocal variables 2025-10-10 22:47:47 -07:00
Jacob Young
b2bc6073c8 windows: workaround kernel race condition
This was causing flaky CI failures.
2025-10-10 22:47:36 -07:00
Andrew Kelley
c17e18647b
Merge pull request #25495 from kcbanner/fixup_translate_c
Add error bundle support to `translate-c`, unify `cmdTranslateC` and `cImport`
2025-10-10 21:07:20 -07:00
Alex Rønne Petersen
66193e72d3
test: disable test-link macho on FreeBSD
See also d6d1fef.

https://github.com/ziglang/zig/issues/25323
2025-10-11 00:40:42 +02:00
usebeforefree
62e3d46287 replaced https://simonsapin.github.io/wtf-8/ with https://wtf-8.codeberg.page/ 2025-10-10 23:53:00 +02:00
mlugg
45143c6f04 MachO: emit absolute path in N_OSO stabs
This path being relative is unconventional and causes issues for us
if the output artifact is ever used from a different cwd than the one it
was built from. The behavior implemented by this commit of always
emitting these paths as absolute was actually the behavior in 0.14.x,
but it regressed in 0.15.1 due to internal reworks to path handling
which led to relative paths being more common in the compiler internals.

Resolves: #25433
2025-10-10 20:33:30 +01:00
Ryan Liptak
d629a146f5 Dir.realpathW: remove redundant buffer/copy
This same change was applied in 69007f096177143086e28da0dc1a0eff4efcc52c but accidentally reverted in 7bf740ee718f4b6109cd9fe7014d1784d48ada48
2025-10-10 12:13:35 -07:00
Alex Rønne Petersen
9aeabad519 std.debug.Dwarf.SelfUnwinder: assume same-value rule by default for all columns
This fixes leaf function unwinding, presumably among other things.
2025-10-10 15:12:27 +02:00
Alex Rønne Petersen
f010a31319
Merge pull request #25516 from alexrp/std-debug
`std.debug`: greatly expand target support for segfault handling/unwinding, and remove public `ucontext_t` completely
2025-10-10 14:04:02 +02:00
Alex Rønne Petersen
36dbe66cf4
std: stop exposing anything having to do with ucontext_t
This type is useful for two things:

* Doing non-local control flow with ucontext.h functions.
* Inspecting machine state in a signal handler.

The first use case is not one we support; we no longer expose bindings to those
functions in the standard library. They're also deprecated in POSIX and, as a
result, not available in musl.

The second use case is valid, but is very poorly served by the standard library.
As evidenced by my changes to std.debug.cpu_context.signal_context_t, users will
be better served rolling their own ucontext_t and especially mcontext_t types
which fit their specific situation. Further, these types tend to evolve
frequently as architectures evolve, and the standard library has not done a good
job keeping up, or even providing them for all supported targets.
2025-10-10 04:43:18 +02:00
Alex Rønne Petersen
f33d3a5166
std.debug: greatly expand target support for segfault handling/unwinding
I made a couple of decisions for this based on the fact that we don't expose the
signal_ucontext_t type outside of the file:

* Adding all the floating point and vector state to every ucontext_t and
  mcontext_t variant was way, way too much work, especially when we don't even
  use the stuff. So I deleted all that and kept only the bare minimum needed to
  reach into general-purpose registers.
* There is no particularly compelling reason to stick to the naming and struct
  nesting used in the system headers. So we can actually unify the access
  patterns for almost all of these variants by taking some liberties here; as a
  result, fromPosixSignalContext() is now much nicer to read and extend.
2025-10-10 04:43:15 +02:00
kcbanner
ed6d9e2a9d - Output error messages for fatal translate-c errors 2025-10-09 19:08:16 -04:00
marximimus
07b6dbf8ca std.crypto.tls.Client: fix infinite loop in std.Io.Writer.writeAll 2025-10-09 12:34:34 -07:00
Andrew Kelley
df712d0833 std.fs.File.Reader.seekTo: fix one more logical position bug 2025-10-09 11:59:53 -07:00