From 375bb5f4a1ebfc1d002e252d97077da7e1db7e4d Mon Sep 17 00:00:00 2001 From: Koakuma Date: Sun, 17 Sep 2023 19:18:59 +0700 Subject: 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. --- lib/std/start.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/std/start.zig') diff --git a/lib/std/start.zig b/lib/std/start.zig index 36379960a4..63675c1074 100644 --- a/lib/std/start.zig +++ b/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"), } -- cgit v1.2.3