From 47c0464e860486150942b73a78529805d4f320b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Wed, 24 Jul 2024 17:41:18 +0200 Subject: [PATCH] start: Explicitly clear the link register on mips and mips64 just in case. The kernel does this as required, but we cannot trust dynamic linkers to do it. --- lib/std/start.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/std/start.zig b/lib/std/start.zig index 78a2c9e496..b53f2258e1 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -329,8 +329,8 @@ fn _start() callconv(.Naked) noreturn { \\ jsr (%%pc, %%a0) , .mips, .mipsel => - // The lr is already zeroed on entry, as specified by the ABI. - \\ addiu $fp, $zero, 0 + \\ move $fp, $0 + \\ move $ra, $0 \\ move $a0, $sp \\ .set push \\ .set noat @@ -340,8 +340,8 @@ fn _start() callconv(.Naked) noreturn { \\ j %[posixCallMainAndExit] , .mips64, .mips64el => - // The lr is already zeroed on entry, as specified by the ABI. - \\ addiu $fp, $zero, 0 + \\ move $fp, $0 + \\ move $ra, $0 \\ move $a0, $sp \\ .set push \\ .set noat