authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-08 02:41:04+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-09 03:14:31+02:00
log1df99ba96a11fa8c16821018681683835cedb7cf
tree78b06552fc57ed071dd1019cc1082e6cf889b20d
parent8750266719007e666c0af6e66420f1ad579b0974
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.start: fix csky _start assembly to be static PIE safe

The jmpi form that was used here will rely on a literal pool entry containing a relocation. Instead, use @GOTOFF since we've already set up gb anyway.

1 files changed, 4 insertions(+), 2 deletions(-)

lib/std/start.zig+4-2
......@@ -276,14 +276,16 @@ fn _start() callconv(.naked) noreturn {
276276 // `_DYNAMIC` as well.
277277 // r8 = FP
278278 \\ grs t0, 1f
279 \\ 1:
279 \\1:
280280 \\ lrw gb, 1b@GOTPC
281281 \\ addu gb, t0
282282 \\ movi r8, 0
283283 \\ movi lr, 0
284284 \\ mov a0, sp
285285 \\ andi sp, sp, -8
286 \\ jmpi %[posixCallMainAndExit]
286 \\ lrw t1, %[posixCallMainAndExit]@GOTOFF
287 \\ addu t1, gb
288 \\ jmp t1
287289 ,
288290 .hexagon =>
289291 // r29 = SP, r30 = FP, r31 = LR