Commit 375bb5f4a1

Koakuma <koachan@protonmail.com>
2023-09-17 14:18:59
lib: Fix asm code in _start for SPARC
SPARCs have delayed branches, that is, it will unconditionally run the next instruction following a branch. Slightly reorder the _start code sequence to prevent it from accidentally executing stray instructions, which may result in odd program behavior.
1 parent 67ee68f
Changed files (1)
lib
lib/std/start.zig
@@ -327,8 +327,8 @@ fn _start() callconv(.Naked) noreturn {
             // argc is stored after a register window (16 registers) plus stack bias
             \\ mov %%g0, %%i6
             \\ add %%o6, 2175, %%l0
-            \\ stx %%l0, %[argc_argv_ptr]
             \\ ba %[posixCallMainAndExit]
+            \\  stx %%l0, %[argc_argv_ptr]
             ,
             else => @compileError("unsupported arch"),
         }