Commit Graph

212 Commits

Author SHA1 Message Date
Andrew Kelley 031044b399 std: fix macos compilation errors 2025-10-29 06:20:49 -07:00
Andrew Kelley 71ff6e0ef7 std: fix seekBy unit test 2025-10-29 06:20:49 -07:00
Andrew Kelley 89412fda77 std.Io: implement fileStat 2025-10-29 06:20:48 -07:00
Andrew Kelley 47aa5a70a5 std: updating to std.Io interface
got the build runner compiling
2025-10-29 06:20:48 -07:00
Alex Rønne Petersen dba1bf9353 remove all Oracle Solaris support
There is no straightforward way for the Zig team to access the Solaris system
headers; to do this, one has to create an Oracle account, accept their EULA to
download the installer ISO, and finally install it on a machine or VM. We do not
have to jump through hoops like this for any other OS that we support, and no
one on the team has expressed willingness to do it.

As a result, we cannot audit any Solaris contributions to std.c or other
similarly sensitive parts of the standard library. The best we would be able to
do is assume that Solaris and illumos are 100% compatible with no way to verify
that assumption. But at that point, the solaris and illumos OS tags would be
functionally identical anyway.

For Solaris especially, any contributions that involve APIs introduced after the
OS was made closed-source would also be inherently more risky than equivalent
contributions for other proprietary OSs due to the case of Google LLC v. Oracle
America, Inc., wherein Oracle clearly demonstrated its willingness to pursue
legal action against entities that merely copy API declarations.

Finally, Oracle laid off most of the Solaris team in 2017; the OS has been in
maintenance mode since, presumably to be retired completely sometime in the 2030s.

For these reasons, this commit removes all Oracle Solaris support.

Anyone who still wishes to use Zig on Solaris can try their luck by simply using
illumos instead of solaris in target triples - chances are it'll work. But there
will be no effort from the Zig team to support this use case; we recommend that
people move to illumos instead.
2025-10-27 07:35:38 -07:00
Alex Rønne Petersen c9e0df97f9 std.debug.cpu_context: fix mcontext alignment for x86_64-illumos
It contains a upad128_t array which increases its alignment.
2025-10-26 08:48:21 +01:00
Stephen Gregoratto f4ef7e8761 std.debug.cpu_context: add missing signal_ucontext_t fields for x86_64-solaris/illumos 2025-10-25 12:44:17 +02:00
Alex Rønne Petersen d99cf5061c std.debug.cpu_context: add signal_ucontext_t for alpha, hppa, microblaze, sh 2025-10-23 19:34:02 +02:00
Alex Rønne Petersen 3e2daa509a std.Target: add arceb and xtensaeb Cpu.Arch tags 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen 9fd7f38600 std.debug.cpu_context.Sparc: fix bad use of call delay slot 2025-10-18 00:36:52 +02:00
Alex Rønne Petersen 727942bc03 std.debug.cpu_context: let the compiler deal with clobbers
Otherwise we might be restoring registers we don't even need to.
2025-10-18 00:36:52 +02:00
Alex Rønne Petersen 1f15e265fe std.debug.cpu_context: sort context decls according to switch prongs (NFC) 2025-10-18 00:36:52 +02:00
Alex Rønne Petersen 4c81a496e7 std.debug: add CPU context and DWARF mappings for arc 2025-10-18 00:36:52 +02:00
Alex Rønne Petersen ba9ab3fb67 std.debug: add CPU context and DWARF mappings for m68k 2025-10-18 00:36:52 +02:00
Alex Rønne Petersen eb36a45ed9 std.debug: add CPU context and DWARF mappings for or1k 2025-10-18 00:36:52 +02:00
Alex Rønne Petersen de3947608c std.debug: add CPU context and DWARF mappings for csky 2025-10-18 00:36:52 +02:00
Alex Rønne Petersen 81fe640dd2 std.debug: add CPU context and DWARF mappings for lanai 2025-10-18 00:36:52 +02:00
Alex Rønne Petersen 0b55393a2f std.debug: add CPU context and DWARF mappings for ve 2025-10-18 00:36:52 +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 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 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 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 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
Alex Rønne Petersen 2aea7a42b0 Merge pull request #25493 from alexrp/std-debug-mips-ppc
`std.debug`: MIPS and PowerPC unwind support + some other stuff
2025-10-08 06:29:28 +02:00
Alex Rønne Petersen a54906b46e std.debug.cpu_context: make arch-specific implementations private 2025-10-07 19:18:46 +02:00
Alex Rønne Petersen a06db282c7 std.debug.SelfInfo.MachO: don't restore vector registers during unwinding
We know that these are unsupported and irrelevant for unwinding, so don't fail
the unwind attempt trying to read/write them for no ultimate purpose.
2025-10-07 17:13:58 +02:00
Alex Rønne Petersen e4f0c62b5d std.debug.Dwarf.expression: fix a test that assumes sp != fp
This does not hold on PowerPC.
2025-10-07 17:03:48 +02:00
Alex Rønne Petersen 7fdd5704ed std.debug.cpu_context: map a bunch of known registers as unsupported instead of invalid 2025-10-07 16:47:57 +02:00
Alex Rønne Petersen de3b22db4d std.debug.cpu_context: remove support for s390x float registers
Let's for the moment assume that compilers haven't lost the plot.

Fingers crossed.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen 9cd37a0696 std.debug.Dwarf: use 66 as the (fake) MIPS PC register
32-63 conflict with the floating point registers. 64 and 65 are used for the
ac0 hi/lo registers.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen f6403ed5ea std.debug.Dwarf: use 67 as the (fake) PowerPC PC register
It's free real estate, as it turns out.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen feba8a83a7 std.debug.Dwarf: use 65 as the (fake) RISC-V PC register
32-63 conflict with the floating point registers. 64 is the Alternate Frame
Return Column.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen 9a6fad2706 std.debug.Dwarf: use 64 as the (fake) LoongArch PC register
32-63 conflict with the floating point registers.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen aa74eb505a std.debug: add unwind support for powerpc*-linux 2025-10-07 16:47:57 +02:00
Alex Rønne Petersen ca73d697b9 std.debug: add unwind support for mips*-linux 2025-10-07 16:47:57 +02:00
Alex Rønne Petersen a5a9ffb90b std.debug.cpu_context: check for architecture, i.e. register size, not bitness
We care about the hardware here, not the ABI.
2025-10-07 16:47:57 +02:00
Alex Rønne Petersen 081d6d12a1 std.debug.Dwarf.SelfUnwinder: add an s390x check missed in 95bdb0c1c6 2025-10-07 16:47:57 +02:00
Alex Rønne Petersen c23a5ccd19 std.debug.Dwarf.SelfUnwinder: skip caching rules for unsupported registers
For unwinding purposes, we don't care about unsupported registers. Yet because
we added these rules to the cache entry, we'd later try to evaluate them and
thus fail the unwind attempt for no good reason. They'd also take up cache rule
slots that would be better spent on actually relevant registers.

Note that any attempt to read unsupported registers during unwinding will still
fail the unwind attempt as expected.
2025-10-07 09:28:43 +02:00
Alex Rønne Petersen a5ff376b8f std.debug: add unwind support for hexagon-linux 2025-10-05 20:09:26 +02:00
Alex Rønne Petersen 30f5258fe6 std.debug.SelfInfo.Elf: disable unwinding on mips n32 and x86 x32
The DWARF code can't handle these yet.

ref https://github.com/ziglang/zig/issues/25447
2025-10-05 07:18:50 +02:00
Linus Groh b0f280f4a4 std.debug: Add unwind support for serenity 2025-10-03 22:59:40 +01:00
Alex Rønne Petersen 95bdb0c1c6 std.debug.Dwarf.SelfUnwinder: default some s390x registers to the same-value rule 2025-10-03 03:45:52 +02:00
Alex Rønne Petersen 8263f55ab2 std.debug: add s390x-linux unwind support 2025-10-03 03:29:20 +02:00
Alex Rønne Petersen a4f95b1e61 std.debug.Dwarf.Unwind: deal with invalid def_cfa_reg by GNU toolchains 2025-10-02 15:27:35 +02:00
Alex Rønne Petersen 97de46dc16 std.debug: add riscv32-linux and riscv64-linux unwind support 2025-10-01 23:47:47 +02:00
Alex Rønne Petersen 8520e9312e std.debug: add loongarch64-linux unwind support 2025-10-01 23:47:47 +02:00
Alex Rønne Petersen b46867848e std.debug: some adjustments to target handling
* driverkit handling missing in a few places.
* x86-solaris is a dead target.
* aarch64_be does not exist on Darwin, FreeBSD, Windows.
2025-10-01 23:47:47 +02:00