Commit Graph
28 Commits
Author SHA1 Message Date
Alex Rønne Petersen 91c8116b23 std.pie: fix calculation of _DYNAMIC's offset 2026-08-11 01:02:54 +02:00
Alex Rønne Petersen 511a5c6e19 std.pie: fix typo in xtensa assembly (add -> addi) 2026-08-09 16:56:25 +02:00
Alex Rønne Petersen 8dda65bba0 std.pie: fix register constraint in m68k assembly
lea needs an address register as destination.
2026-08-09 16:56:25 +02:00
Alex Rønne Petersen 37d1bdb8a7 std.pie: fix potentially unaligned quadword load in powerpc64 assembly
It probably happened to be quadword aligned by coincidence, or real hardware can
cope with misaligned loads. Either way, we should just align it properly.
2026-08-09 16:56:25 +02:00
Alex Rønne Petersen 962b4bbebf std.pie: fix potentially reading garbage in sh assembly
The alignment should of course be applied to the label, not the contents after
it. Also fix a silly typo (DYNAMIC -> _DYNAMIC).
2026-08-09 16:56:25 +02:00
Alex Rønne Petersen ee1983a985 std.pie: fix sparc assembly to actually load &_DYNAMIC
It was loading &_GLOBAL_OFFSET_TABLE_[0] rather than &_DYNAMIC. I suspect that I
committed this before actually finishing writing it.
2026-08-09 16:56:25 +02:00
Alex Rønne Petersen 82b9ba071f std.pie: fix alpha, csky, and microblaze assembly
In hindsight, this approach was obviously not going to work since it's loading
the unrelocated address of _DYNAMIC. Instead just use a PC-relative approach
like other targets.
2026-08-09 16:56:23 +02:00
Alex Rønne Petersen 3b947932ab std: avoid pointless delay slots and lr writes in inline assembly
And fill in some delay slots where we can't avoid them.
2026-08-09 16:56:23 +02:00
David Senoner 8d88862456 elf: remove usages of deprecated elf.Phdr 2026-07-30 21:23:58 +02:00
David Senoner ea006188aa elf: remove all deprecated usages and definitions of std.elf.PT_* 2026-07-30 21:23:58 +02:00
Alex Rønne Petersen 6aaea5af41 std.Target: add abin32 and x32 Abi tags
We only had gnu/musl variants of these previously.
2026-06-18 02:37:52 +02:00
Alex Rønne Petersen 0c6c63c116 std.pie: the xtensa call0 instruction does not have a dense encoding 2026-05-29 08:12:12 +02:00
Alex Rønne Petersen a6ab353532 std.pie: add xtensa support
This might need more work to handle the DT_XTENSA_GOT_LOC_{OFF,SZ} insanity,
but this is at least a start.
2026-05-26 08:11:04 +02:00
Alex Rønne Petersen 94538d8dd2 std.pie: add missing clobbers on alpha and sparc
Also format all the assembly code in the file.
2025-11-14 12:19:38 +01:00
Alex Rønne Petersen 80e567b6bd std.pie: add kvx support 2025-11-10 09:40:44 +01:00
Alex Rønne Petersen 2b54437f24 std.pie: add sh support 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen fb2c02929e std.pie: add microblaze support 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen fc48f8aa55 std.pie: add alpha support 2025-10-23 09:27:17 +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 e646c47f67 std.pie: add or1k support 2025-10-18 22:27:34 +02:00
Alex Rønne Petersen 5e3c313366 std.pie: fix getDynamicSymbol() for mipsn32 2025-10-18 12:13:41 +02:00
Alex Rønne Petersen b8d776928a std: make all MIPS inline asm safe for MIPS I
MIPS I has load hazards so we need to insert nops in a few places. This is not a
problem for MIPS II and later.

While doing this, I also touched up all the inline asm to use ABI register
aliases and a consistent formatting convention. Also fixed a few places that
didn't properly check if the syscall return value should be negated.
2025-10-18 11:16:31 +02:00
Alex Rønne Petersen 7b92d5f405 std.pie: fix register constraint in getDynamicSymbol() for s390x (#25327)
If the compiler happens to pick `ret = r0`, then this will assemble to
`ag r0, 0` which is obviously not what we want. Using `a` instead of `r` will
ensure that we get an appropriate address register, i.e. `r1` through `r15`.

Re-enable pie_linux for s390x-linux which was disabled in
ed7ff0b693.
2025-09-22 18:36:47 +02:00
Alex Rønne Petersen 5d019abe4e start adding big endian RISC-V support
The big endian RISC-V effort is mostly driven by MIPS (the company) which is
pivoting to RISC-V, and presumably needs a big endian variant to fill the niche
that big endian MIPS (the ISA) did.

GCC already supports these targets, but LLVM support will only appear in 22;
this commit just adds the necessary target knowledge and checks on our end.
2025-08-25 16:15:17 +02:00
Justus Klausecker 7c35070b90 zig fmt: apply new cast builtin order 2025-08-03 14:59:56 +02:00
Andrew Kelley 76d04c1662 zig fmt 2025-07-16 10:27:39 -07:00
Jacob Young 0bf8617d96 x86_64: add support for pie executables 2025-06-06 23:42:14 -07:00
Alex Rønne Petersen 74a3ae4927 start: Don't artificially limit some posixCallMainAndExit() logic to Linux.
This code applies to ~any POSIX OS where we don't link libc. For example, it'll
be useful for FreeBSD and NetBSD.

As part of this, move std.os.linux.pie to std.pie since there's really nothing
Linux-specific about what that file is doing.
2025-05-18 17:14:09 +02:00