Commit Graph
34717 Commits
Author SHA1 Message Date
Alex Rønne Petersen 550438653d std.Target: Pull toCoffMachine()/toElfMachine() up from Arch to Target.
This enables them to give more correct results.

Contributes to #20771.
2024-08-15 10:55:46 +02:00
Alex Rønne Petersen b01c595d4a std.coff: Capitalize MachineType.{Unknown,Thumb} for consistency. 2024-08-15 10:55:46 +02:00
Alex Rønne Petersen ac9ca7d30c std.coff: Remove MachineType.fromTargetCpuArch().
This does the same thing as std.Target.Cpu.Arch.toCoffMachine(). Just use that.
2024-08-15 10:55:46 +02:00
Alex Rønne Petersen 65affb1c22 std.Target: Don't match PowerPC in Arch.toCoffMachine().
It's entirely unclear whether this should map to POWERPC or POWERPCFP, and as I
can find no evidence of people producing PE files for PowerPC since Windows NT,
let's just not make a likely-wrong guess. We can revisit this if the need ever
actually arises.
2024-08-15 10:55:46 +02:00
Alex Rønne Petersen b24fc35eeb std.Target: Don't match big endian architectures in Arch.toCoffMachine().
All of these were mapping to types that are little endian. In fact, I can find
no evidence that either Windows or UEFI have ever been used on big endian
systems.
2024-08-15 10:55:46 +02:00
Alex Rønne Petersen 8516a6ab57 std.Target: Clean up Arch.toCoffMachine(). 2024-08-15 10:55:46 +02:00
Alex Rønne Petersen 490b328127 std.Target: Fix Arch.toElfMachine() for mips.
EM_MIPS_RS3_LE is obsolete; all mips targets just use EM_MIPS.

Also, fun fact: EM_MIPS_RS3_LE is actually big endian!
2024-08-15 10:55:46 +02:00
Alex Rønne Petersen 6c27cab5b3 std.Target: Fix Arch.toElfMachine() for arc.
The arc tag means ARCv2.
2024-08-15 10:55:46 +02:00
Alex Rønne Petersen 9246c88031 std.Target: Clean up Arch.toElfMachine(). 2024-08-15 10:55:46 +02:00
Alex Rønne Petersen 1e67221f07 std.Target: Change requiresLibC() to return true for aix.
AIX does not have a stable syscall interface; libc is required.
2024-08-15 10:55:46 +02:00
Alex Rønne Petersen fc93ab7182 std.Target: Fix isGnuLibC() to handle hurd too. 2024-08-15 10:55:45 +02:00
Alex Rønne Petersen 0def4e0db0 std.Target: Make some functions handle driverkit alongside other Apple OSs.
Reference for versions: https://developer.apple.com/support/xcode
2024-08-15 10:55:45 +02:00
Jakub Konka 79418fa0ab riscv: remove redundant by-symbol-name check; just check for PIC and extern ptr 2024-08-15 10:52:06 +02:00
Jacob Young 5d080e25d5 start: fix passing comptime-only value to inline asm
Also fix fmt directive typo.
2024-08-15 04:42:04 -04:00
Jakub Konka c79290467f elf: fix GOT32 reloc resolution logic 2024-08-15 10:36:37 +02:00
Jakub Konka f0df0acd70 x86_64: fix handling on externs in lower/emit 2024-08-15 10:33:30 +02:00
Jakub Konka 0fd0b11bc4 riscv: do not emit GOT relocations for special linker symbols 2024-08-15 10:21:20 +02:00
Jakub Konka 8a0cb7002e elf: introduce Symbol.flags.is_extern_ptr for refs potentially needing GOT 2024-08-15 10:05:41 +02:00
David Rubin 2e8351cc9e elf: fix up riscv for .got.zig rewrite 2024-08-15 08:53:41 +02:00
Jakub Konka c9db887800 builtin: init test_functions to empty slice to avoid coercing to undefined 2024-08-15 08:38:08 +02:00
Jakub Konka b8203fac1b elf: check for relocs before deciding on shndx in getNavShdrIndex 2024-08-15 08:37:13 +02:00
clickingbuttons da8fbcc2a9 std.mem.writeVarPackedInt: handle write_size == 0 (#19745)
Also move example comments into tests.
2024-08-15 06:03:29 +00:00
reokodoku 20f4be4cf9 std.os.linux: add mseal syscall 2024-08-14 22:48:13 -07:00
YANG Xudong 0f0f543a9a loongarch: add glibc start.S to make zig-bootstrap work for loongarch64-linux-gnu (#21015) 2024-08-14 21:32:03 +00:00
Jarrod Meyer 9be10ea964 Watch.zig: fixes for windows implementation
Using --watch I noticed a couple of issues with my initial attempt. 1) The index I used as 'completion key' was not stable over time, when directories are being added/removed the key no longer corresponds with the intended dir. 2) There exists a race condition in which we receive a completion notification for a directory that was removed. My solution is to generate a key value and associate it with each Directory.
2024-08-14 13:21:01 -07:00
Andrew Kelley 78fb9c0a17 Merge pull request #21031 from linusg/std-target-naming
std.Target: Function naming cleanup
2024-08-14 10:36:24 -07:00
T eb7f318ea8 langref: clarify functionality of the round builtin (#19503)
A test has also been added to demonstrate the expected behavior.

* std.math: update round doc comment to match the builtin
2024-08-14 10:29:45 -07:00
Andrew Kelley b7a1ef3e19 Merge pull request #21075 from ziglang/fuzz
fix several debug info bugs
2024-08-14 04:55:32 -07:00
Jakub Konka f26573fddf elf: re-use old atom slot for a trampoline to that atom
This is the initial implementation of Jacob Young's idea of
re-using old function slots as trampolines for new function's
location. This way the trampoline is guaranteed to be aligned
to the function's alignment.

The only edge case is if an incremental update further overaligns
the function in which case we skip/delete the trampoline and
re-evaluate all references.
2024-08-14 12:10:40 +02:00
Alex Rønne Petersen b470d2a7de std.debug: Support sparc32 in StackIterator.init(). 2024-08-13 23:54:20 -07:00
Alex Rønne Petersen dc77d1b66d std.Thread: Merge riscv32/riscv64 assembly in freeAndExit(). 2024-08-13 23:53:57 -07:00
Alex Rønne Petersen 55cc9dda66 ci: Enable -Dtest-slow-targets. 2024-08-14 07:03:23 +02:00
Alex Rønne Petersen 927bc55629 build/test: Add a test-modules step for running all the per-target tests.
This is useful during porting work where you're mainly concerned with tests that
e.g. run under QEMU. Combine with the new -Dtest-target-filter for an even more
streamlined workflow.
2024-08-14 07:03:23 +02:00
Alex Rønne Petersen b6009a7416 build/test: Add -Dtest-slow-targets and move mips module tests behind it.
The idea is that these tests are just too slow to include by default on a
contributor's local machine. If they want to run these, they need to opt in.
2024-08-14 07:03:23 +02:00
Alex Rønne Petersen 3b51b43dc8 build/test: Add -Dtest-target-filter for filtering module tests by target triple.
This is useful during porting work where you're not interested in running all
targets all the time while iterating on changes.
2024-08-14 07:03:23 +02:00
Alex Rønne Petersen 4a2b23c2be build: Use the new b.addFail() for the update-mingw step.
This is precisely the kind of use case it was added for.
2024-08-14 07:03:23 +02:00
Alex Rønne Petersen 019c0fc184 test: Re-enable mips(el)-linux-gnueabihf tests.
Closes #4927.
2024-08-14 06:52:05 +02:00
Andrew Kelley 72768bddcd std.Build.Fuzz.WebServer: sort pcs before source location lookup
Unfortunately, the PCs do not get sorted during linking.
2024-08-13 19:30:22 -07:00
Andrew Kelley a726e09389 std.debug.Coverage.resolveAddressesDwarf: assert sorted 2024-08-13 19:29:55 -07:00
Robin Voetter 1018cdc0a8 Merge pull request #21030 from Snektron/nv-gpu-builtins
nvptx: add implementations for GPU builtins
2024-08-14 04:14:34 +02:00
Andrew Kelley 022bca9b06 std.debug.Dwarf: better source location information
Two fixes here:

Sort by addresses after generating the line table. Debug information in
the wild is not sorted and the rest of the implementation requires this
data to be sorted.

Handle DW.LNE.end_sequence correctly. When I originally wrote this code,
I misunderstood what this opcode was supposed to do. Now I understand
that it marks the *end* of an address range, meaning the current address
does *not* map to the current line information.

This fixes source location information for a big chunk of ReleaseSafe
code.
2024-08-13 18:04:23 -07:00
Andrew Kelley a9e7fb0e01 avoid a branch in resolveAddressesDwarf 2024-08-13 15:02:53 -07:00
Andrew Kelley e8e49efe21 ZigLLVMTargetMachineEmitToFile: put sanitizers in registerOptimizerLastEPCallback
matching the default of clang's behavior. I originally put them in
registerOptimizerEarlyEPCallback because I thought clang was doing that,
but I see now it is behind the flag `--sanitizer-early-opt-ep` which is
disabled by default.
2024-08-13 15:02:53 -07:00
Andrew Kelley b5398180d6 std.debug.Coverage.resolveAddressesDwarf: fix broken logic
The implementation assumed that compilation units did not overlap, which
is not the case. The new implementation uses .debug_ranges to iterate
over the requested PCs.

This partially resolves #20990. The dump-cov tool is fixed but the same
fix needs to be applied to `std.Build.Fuzz.WebServer` (sorting the PC
list before passing it to be resolved by debug info).

I am observing LLVM emit multiple 8-bit counters for the same PC
addresses when enabling `-fsanitize-coverage=inline-8bit-counters`. This
seems like a bug in LLVM. I can't fathom why that would be desireable.
2024-08-13 15:02:53 -07:00
Alex Rønne Petersen 819fe51a7e llvm: Disable f128 on powerpc*-aix.
https://github.com/llvm/llvm-project/issues/101545
2024-08-13 23:30:43 +02:00
Alex Rønne Petersen 2f101e2b6e llvm: Disable f128 on mips64(el).
https://github.com/llvm/llvm-project/issues/96432
2024-08-13 23:30:43 +02:00
Alex Rønne Petersen 18e94c355e llvm: Also disable f16/f128 on aarch64_be with soft float. 2024-08-13 23:30:43 +02:00
Alex Rønne Petersen f1af9eb836 std.zig.system: Support qemu-xtensa in getExternalExecutor(). 2024-08-13 23:30:43 +02:00
Alex Rønne Petersen 8e75ade253 std.zig.system: Support qemu-mipsn32(el) for mips with n32 ABI in getExternalExecutor(). 2024-08-13 23:30:43 +02:00
Alex Rønne Petersen 0e4263893c std.zig.system: Support qemu-sparc32plus for sparc32 with v9 in getExternalExecutor(). 2024-08-13 23:30:43 +02:00