Commit Graph

36606 Commits

Author SHA1 Message Date
mlugg 253fdfce70 SelfInfo: be honest about how general unwinding is
...in that it isn't: it's currently very specialized to DWARF unwinding.

Also, make a type unmanaged.
2025-09-30 13:44:51 +01:00
mlugg 9859440d83 add freestanding support IN THEORY
untested because this branch has errors rn
2025-09-30 13:44:51 +01:00
mlugg c2ada49354 replace usages of old std.debug APIs
src/crash_handler.zig is still TODO though, i am planning bigger changes there
2025-09-30 13:44:51 +01:00
mlugg 5709369d05 std.debug: improve the APIs and stuff 2025-09-30 13:44:51 +01:00
mlugg d4f710791f tweaks 2025-09-30 13:44:51 +01:00
mlugg 67fa5664b7 std.posix: mark getcontext as unsupported by default 2025-09-30 13:44:51 +01:00
mlugg ba5d9d5a41 remove redundant test
turns out this actually has coverage in std.debug
2025-09-30 13:44:50 +01:00
mlugg 405075f745 SelfInfo: load eh_frame/debug_frame from ELF file if eh_frame_hdr omitted 2025-09-30 13:44:50 +01:00
mlugg c895aa7a35 std.debug.SelfInfo: concrete error sets
The downside of this commit is that more precise errors are no longer
propagated up. However, these errors were pretty useless in isolation
due to them having no context; and regardless, we intentionally swallow
most of them in `std.debug` anyway. Therefore, this is better in
practice, because it allows `std.debug` to give slightly more useful
warnings when handling errors. This commit does that for unwind errors,
for instance, which differentiate between the unwind info being corrupt
vs missing vs inaccessible vs unsupported.

A better solution would be to also include more detailed information via
the diagnostics pattern, but this commit is an incremental improvement.
2025-09-30 13:44:50 +01:00
mlugg dd9cb1beea doc comments 2025-09-30 13:44:50 +01:00
mlugg 5e6a1919c7 fix aarch64-macos DWARF unwinding
turns out this isn't technically specific to that target at all; other
targets just don't emit mid-function 'ret' instructions as much so
certain CFI instruction patterns were only seen on aarch64.

thanks to jacob for finding the bug <3
2025-09-30 13:44:50 +01:00
mlugg 4b47a37717 stash? more like no 2025-09-30 13:44:50 +01:00
mlugg 665f13b0cd SelfInfo deinit magic 2025-09-30 13:44:50 +01:00
mlugg ba3f38959a split SelfInfo into a file per impl 2025-09-30 13:44:50 +01:00
mlugg 1397b95143 std.debug.Dwarf: eliminate host pointer size dependency 2025-09-30 13:44:50 +01:00
mlugg b762cd30fd remove TODOs which are done or which i'm not actually gonna do lol 2025-09-30 13:44:50 +01:00
mlugg e4dbfc109b dont dupe state you silly billy 2025-09-30 13:44:50 +01:00
mlugg 8fdcdb8c69 the world if Dwarf.ElfModule was like REALLY good: 2025-09-30 13:44:49 +01:00
mlugg 84b65860cf the world if ElfModule didn't suck: 2025-09-30 13:44:49 +01:00
mlugg 55a7affea4 me when i did a thing 2025-09-30 13:44:49 +01:00
mlugg 25e02bed4c less hacky :D 2025-09-30 13:44:49 +01:00
mlugg 55ae6747e2 names 2025-09-30 13:44:49 +01:00
mlugg 3f6a90766c sky pirates! which are even better! 2025-09-30 13:44:49 +01:00
mlugg 89d862180f yet more 2025-09-30 13:44:49 +01:00
mlugg fb88dab4c9 more still 2025-09-30 13:44:49 +01:00
mlugg ed6ed62c42 more stuff 2025-09-30 13:44:49 +01:00
mlugg b750e7cf9e change one million things 2025-09-30 13:44:49 +01:00
Jacob Young b706949736 debug: refactor stack frame capturing 2025-09-30 13:44:48 +01:00
Matthew Lugg 7adb15892e Merge pull request #25353 from mlugg/x86_64-faster
x86_64: generate better constant memcpy code
2025-09-30 13:28:37 +01:00
Alex Rønne Petersen df1909900c libc: update Linux headers to 6.17 2025-09-29 22:53:06 +02:00
Alex Rønne Petersen f624191f9a Merge pull request #25388 from alexrp/ksigaction
`std.os.linux`: Fix `k_sigaction` ABI issue on platforms w/o `SA_RESTORER`
2025-09-29 14:48:24 +02:00
Alex Rønne Petersen fe468e4fa3 std.os.linux: delete restore and restore_rt for hexagon, loongarch, mips, riscv 2025-09-28 18:24:04 +02:00
Alex Rønne Petersen 42e4411377 std.os.linux: delete SA.RESTORER and k_sigaction.restorer for hexagon, loongarch, mips, riscv
The kABIs for these architectures don't define these concepts.
2025-09-28 18:23:58 +02:00
Alex Rønne Petersen ba19c1104b musl: delete dead __restore and __restore_rt functions for hexagon, loongarch64, riscv32, riscv64
https://www.openwall.com/lists/musl/2025/09/28/2
2025-09-28 17:04:56 +02:00
Alex Rønne Petersen 993a1a3df1 musl: delete SA_RESTORER for hexagon
https://github.com/quic/musl/pull/7
2025-09-28 16:25:24 +02:00
Alex Rønne Petersen e89cb377d0 musl: delete SA_RESTORER for riscv32
https://www.openwall.com/lists/musl/2025/09/28/1
2025-09-28 15:54:21 +02:00
Alex Rønne Petersen f90510b081 libcxx: respond to some feature macro changes in LLVM 20
https://github.com/llvm/llvm-project/commit/ba87515fea90b5d55836a8e3be63a7e683ce299d

closes #25376
2025-09-28 14:45:31 +02:00
Jacob Young a896a22932 x86_64: fix @mulAdd miscomp 2025-09-27 20:10:32 -04:00
Jacob Young a744fbd22f x86_64: fix ~/! miscomps 2025-09-27 18:30:52 -04:00
Jacob Young d79b3cc134 target: x86_64 backend can build compiler rt with coff
Without allowing this, the references to `compiler_rt.dll` emitted by
the coff linker will prevent the executable from running.
2025-09-27 18:30:52 -04:00
Jacob Young b206b0626a x86_64: fix @floatFromInt miscomps 2025-09-27 18:30:52 -04:00
mlugg 237e8a5a7a tests: fix redundant target in matrix
Because -fno-llvm is now the default on x86_64-linux, this target was
exactly equivalent to one specified earlier in the matrix. This was
probably just missed when doing the work to enable the self-hosted
backend by default for x86_64.
2025-09-27 18:30:52 -04:00
mlugg 611c38e6da x86_64: fix unencodable rem lowerings
The memory operand might use one of the extended GPRs R8 through R15 and
hence require a REX prefix, but having a REX prefix makes the high-byte
register AH unencodeable as the src operand. This latent bug was exposed
by this branch, presumably because `select` now happens to be putting
something in an extended GPR instead of a legacy GPR.

In theory this could be fixed with minimal cost by introducing a way to
communicate to `select` that neither the destination memory nor the
other temporary can be in an extended GPR. However, I just went for the
simple solution which comes at a cost of one trivial instruction: copy
the remainder from AH to AL, and *then* copy AL to the destination.
2025-09-27 18:30:52 -04:00
mlugg 77fca1652f x86_64: fix miscompilation of mul on vectors of large ints 2025-09-27 18:30:52 -04:00
mlugg 0c476191a4 x86_64: generate better constant memcpy code
`rep movsb` isn't usually a great idea here. This commit makes the logic
which tentatively existed in `genInlineMemcpy` apply in more cases, and
in particular applies it to the "new" backend logic. Put simply, all
copies of 128 bytes or fewer will now attempt this path first,
where---provided there is an SSE register and/or a general-purpose
register available---we will lower the operation using a sequence of 32,
16, 8, 4, 2, and 1 byte copy operations.

The feedback I got on this diff was "Push it to master and if it
miscomps I'll revert it" so don't blame me when it explodes
2025-09-27 18:30:52 -04:00
Alex Rønne Petersen 1b0bde0d8d Merge pull request #25373 from mneumann/fix-dragonfly-bootstrap
Fix DragonFly bootstrap
2025-09-27 20:05:40 +02:00
Alex Rønne Petersen 032df7202a ci: remove -Dskip-translate-c from riscv64-linux scripts
This no longer exists and caused the build to fail.
2025-09-27 18:39:03 +02:00
Alex Rønne Petersen 1f7ee99b35 musl: add missing fenv C dummy functions for loongarch64-linux-muslsf
https://www.openwall.com/lists/musl/2025/09/27/1

closes #25367
2025-09-27 17:13:29 +02:00
Alex Rønne Petersen b7ab625409 Merge pull request #25362 from alexrp/aro-valist
`aro`: `TypeStore`: synchronize `__va_list_tag` logic with Zig's `std.builtin.VaList`
2025-09-27 12:57:47 +02:00
Michael Neumann 035219132b lib/std/c: sync "struct stat" for DragonFly
* Add missing functions like ISDIR() or ISREG(). This is required to
  build the zig compiler

* Use octal notation for the S_ constants. This is how it is done for
  ".freebsd" and it is also the notation used by DragonFly in
  "sys/stat.h"

* Reorder S_ constants in the same order as ".freebsd" does. Again, this
  follows the ordering within "sys/stat.h"
2025-09-27 10:00:40 +02:00