From c29da84c0e0793683904a32deb8a7eff1ba98b54 Mon Sep 17 00:00:00 2001 From: Koakuma Date: Sat, 22 Aug 2020 16:30:17 +0700 Subject: [PATCH] Add sp loading --- lib/std/os/bits/linux/sparc64.zig | 3 +++ lib/std/start.zig | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/lib/std/os/bits/linux/sparc64.zig b/lib/std/os/bits/linux/sparc64.zig index ba2183acb1..e216f8abaa 100644 --- a/lib/std/os/bits/linux/sparc64.zig +++ b/lib/std/os/bits/linux/sparc64.zig @@ -544,6 +544,9 @@ pub const timezone = extern struct { tz_dsttime: i32, }; +// TODO I'm not sure if the code below is correct, need someone with more +// knowledge about sparc64 linux internals to look into. + pub const Elf_Symndx = u32; pub const fpstate = extern struct { diff --git a/lib/std/start.zig b/lib/std/start.zig index 47164a0820..dae8251d9a 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -147,6 +147,11 @@ fn _start() callconv(.Naked) noreturn { : "r0" ); }, + .sparcv9 => { + starting_stack_ptr = asm ("" + : [argc] "={o6}" (-> [*]usize) + ); + }, else => @compileError("unsupported arch"), } // If LLVM inlines stack variables into _start, they will overwrite