authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-24 23:25:19+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-30 17:47:46+02:00
log108c682df0ec6908695e55d3c3f50fe158a5d502
tree3526332eed5b78aadc045056a7a3eeefe5c1fc51
parent389ce984b5fc601b1b4e28e4ba47d051750afd83
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

start: Add POSIX csky support.


1 files changed, 18 insertions(+), 0 deletions(-)

lib/std/start.zig+18
...@@ -316,6 +316,24 @@ fn _start() callconv(.Naked) noreturn {...@@ -316,6 +316,24 @@ fn _start() callconv(.Naked) noreturn {
316 \\ and sp, #-16316 \\ and sp, #-16
317 \\ b %[posixCallMainAndExit]317 \\ b %[posixCallMainAndExit]
318 ,318 ,
319 // zig fmt: off
320 .csky =>
321 if (builtin.position_independent_code)
322 // The CSKY ABI assumes that `gb` is set to the address of the GOT in order for
323 // position-independent code to work. We depend on this in `std.os.linux.start_pie`
324 // to locate `_DYNAMIC` as well.
325 \\ grs t0, 1f
326 \\ 1:
327 \\ lrw gb, 1b@GOTPC
328 \\ addu gb, t0
329 else ""
330 ++
331 \\ movi lr, 0
332 \\ mov a0, sp
333 \\ andi sp, sp, -8
334 \\ jmpi %[posixCallMainAndExit]
335 ,
336 // zig fmt: on
319 .hexagon =>337 .hexagon =>
320 // r29 = SP, r30 = FP338 // r29 = SP, r30 = FP
321 \\ r30 = #0339 \\ r30 = #0