std.pie: add missing clobbers on alpha and sparc

Also format all the assembly code in the file.
This commit is contained in:
Alex Rønne Petersen 2025-11-13 20:19:22 +01:00
parent 9ab7eec23e
commit 94538d8dd2

View file

@ -56,7 +56,8 @@ inline fn getDynamicSymbol() [*]const elf.Dyn {
\\ .weak _DYNAMIC
\\ .hidden _DYNAMIC
\\ call 1f
\\ 1: pop %[ret]
\\1:
\\ pop %[ret]
\\ lea _DYNAMIC - 1b(%[ret]), %[ret]
: [ret] "=r" (-> [*]const elf.Dyn),
),
@ -79,7 +80,8 @@ inline fn getDynamicSymbol() [*]const elf.Dyn {
\\ ldr %[ret], 1f
\\ add %[ret], pc
\\ b 2f
\\ 1: .word _DYNAMIC-1b
\\1:
\\ .word _DYNAMIC-1b
\\2:
: [ret] "=r" (-> [*]const elf.Dyn),
),
@ -99,7 +101,7 @@ inline fn getDynamicSymbol() [*]const elf.Dyn {
\\ ldq %[ret], -0x8000($29)
: [ret] "=r" (-> [*]const elf.Dyn),
:
: .{ .r26 = true }),
: .{ .r26 = true, .r29 = true }),
// The CSKY ABI requires the gb register to point to the GOT. Additionally, the first
// entry in the GOT is defined to hold the address of _DYNAMIC.
.csky => asm volatile (
@ -229,7 +231,8 @@ inline fn getDynamicSymbol() [*]const elf.Dyn {
\\ larl %[ret], 1f
\\ ag %[ret], 0(%[ret])
\\ jg 2f
\\ 1: .quad _DYNAMIC - .
\\1:
\\ .quad _DYNAMIC - .
\\2:
: [ret] "=a" (-> [*]const elf.Dyn),
),
@ -256,7 +259,8 @@ inline fn getDynamicSymbol() [*]const elf.Dyn {
\\1:
\\ add %%l7, %%o7, %[ret]
: [ret] "=r" (-> [*]const elf.Dyn),
),
:
: .{ .l7 = true }),
else => {
@compileError("PIE startup is not yet supported for this target!");
},