authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-30 04:02:32+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-30 17:58:22+02:00
log78e581b86f11bfc8da277cbad7b7a30941e55e95
treefcbb7c27552d4e28903fd16a95385d3fdb35301c
parent38e0f049c531e83ec2eec80d50b624e6c3b8c486
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

start: Copy the mips64 comment about gp to the mips32 code.

Also, don't incorrectly claim that it's only needed for dynamic linking/PIC.

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

lib/std/start.zig+1-2
...@@ -293,6 +293,7 @@ fn _start() callconv(.Naked) noreturn {...@@ -293,6 +293,7 @@ fn _start() callconv(.Naked) noreturn {
293 \\ .gpword .293 \\ .gpword .
294 \\ .gpword %[posixCallMainAndExit]294 \\ .gpword %[posixCallMainAndExit]
295 \\ 1:295 \\ 1:
296 // The `gp` register on MIPS serves a similar purpose to `r2` (ToC pointer) on PPC64.
296 \\ lw $gp, 0($ra)297 \\ lw $gp, 0($ra)
297 \\ subu $gp, $ra, $gp298 \\ subu $gp, $ra, $gp
298 \\ lw $25, 4($ra)299 \\ lw $25, 4($ra)
...@@ -314,8 +315,6 @@ fn _start() callconv(.Naked) noreturn {...@@ -314,8 +315,6 @@ fn _start() callconv(.Naked) noreturn {
314 \\ .gpdword %[posixCallMainAndExit]315 \\ .gpdword %[posixCallMainAndExit]
315 \\ 1:316 \\ 1:
316 // The `gp` register on MIPS serves a similar purpose to `r2` (ToC pointer) on PPC64.317 // The `gp` register on MIPS serves a similar purpose to `r2` (ToC pointer) on PPC64.
317 // We need to set it up in order for dynamically-linked / position-independent code to
318 // work.
319 \\ ld $gp, 0($ra)318 \\ ld $gp, 0($ra)
320 \\ dsubu $gp, $ra, $gp319 \\ dsubu $gp, $ra, $gp
321 \\ ld $25, 8($ra)320 \\ ld $25, 8($ra)