From 1df99ba96a11fa8c16821018681683835cedb7cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sat, 8 Aug 2026 02:41:04 +0200 Subject: [PATCH] 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. --- lib/std/start.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/std/start.zig b/lib/std/start.zig index f477b9b5fa53788533b1e668f795b45c804fac77..92482d6a9109d335f9f3ddb1784247d66e5a0302 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -276,14 +276,16 @@ fn _start() callconv(.naked) noreturn { // `_DYNAMIC` as well. // r8 = FP \\ grs t0, 1f - \\ 1: + \\1: \\ lrw gb, 1b@GOTPC \\ addu gb, t0 \\ movi r8, 0 \\ movi lr, 0 \\ mov a0, sp \\ andi sp, sp, -8 - \\ jmpi %[posixCallMainAndExit] + \\ lrw t1, %[posixCallMainAndExit]@GOTOFF + \\ addu t1, gb + \\ jmp t1 , .hexagon => // r29 = SP, r30 = FP, r31 = LR -- 2.54.0