aboutsummaryrefslogtreecommitdiff
path: root/lib/std/start.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-07-24 17:35:47 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2024-07-24 21:56:54 +0200
commit52653ec82bcc8e10fee9b6d9997b2de41a22a93a (patch)
tree55966498e4fbaa59318c29f8c6f4bc2d16cbc387 /lib/std/start.zig
parent714e7433930e68698b1e33c1de13dc5514cd5a77 (diff)
downloadzig-52653ec82bcc8e10fee9b6d9997b2de41a22a93a.tar.gz
zig-52653ec82bcc8e10fee9b6d9997b2de41a22a93a.zip
start: Align the stack on powerpc just in case.
The kernel does this as required, but we cannot trust dynamic linkers to do it.
Diffstat (limited to 'lib/std/start.zig')
-rw-r--r--lib/std/start.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 35485a6995..015f2c077f 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -351,8 +351,9 @@ fn _start() callconv(.Naked) noreturn {
\\ j %[posixCallMainAndExit]
,
.powerpc, .powerpcle =>
- // Setup the initial stack frame and clear the back chain pointer.
+ // Set up the initial stack frame, and clear the back chain pointer.
\\ mr 3, 1
+ \\ clrrwi 1, 1, 4
\\ li 0, 0
\\ stwu 1, -16(1)
\\ stw 0, 0(1)
@@ -360,7 +361,7 @@ fn _start() callconv(.Naked) noreturn {
\\ b %[posixCallMainAndExit]
,
.powerpc64, .powerpc64le =>
- // Setup the initial stack frame and clear the back chain pointer.
+ // Set up the ToC and initial stack frame, and clear the back chain pointer.
\\ addis 2, 12, .TOC. - %[_start]@ha
\\ addi 2, 2, .TOC. - %[_start]@l
\\ mr 3, 1