aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-07-30 04:02:32 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2024-07-30 17:58:22 +0200
commit78e581b86f11bfc8da277cbad7b7a30941e55e95 (patch)
treefcbb7c27552d4e28903fd16a95385d3fdb35301c
parent38e0f049c531e83ec2eec80d50b624e6c3b8c486 (diff)
downloadzig-78e581b86f11bfc8da277cbad7b7a30941e55e95.tar.gz
zig-78e581b86f11bfc8da277cbad7b7a30941e55e95.zip
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.
-rw-r--r--lib/std/start.zig3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 2a61be46e4..bca0922fb3 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -293,6 +293,7 @@ fn _start() callconv(.Naked) noreturn {
\\ .gpword .
\\ .gpword %[posixCallMainAndExit]
\\ 1:
+ // The `gp` register on MIPS serves a similar purpose to `r2` (ToC pointer) on PPC64.
\\ lw $gp, 0($ra)
\\ subu $gp, $ra, $gp
\\ lw $25, 4($ra)
@@ -314,8 +315,6 @@ fn _start() callconv(.Naked) noreturn {
\\ .gpdword %[posixCallMainAndExit]
\\ 1:
// The `gp` register on MIPS serves a similar purpose to `r2` (ToC pointer) on PPC64.
- // We need to set it up in order for dynamically-linked / position-independent code to
- // work.
\\ ld $gp, 0($ra)
\\ dsubu $gp, $ra, $gp
\\ ld $25, 8($ra)