From f7da960a33828505c91fb2d2f022f8966b6f9cc7 Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Fri, 20 Sep 2024 16:49:14 -0400 Subject: [PATCH 1/2] stage1 ppc64: remove inline-asm overlapping clobbers Required when bootstrapping with GCC. --- lib/std/os/linux/powerpc64.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/std/os/linux/powerpc64.zig b/lib/std/os/linux/powerpc64.zig index 04936a113d..06b67c17f1 100644 --- a/lib/std/os/linux/powerpc64.zig +++ b/lib/std/os/linux/powerpc64.zig @@ -48,7 +48,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { : [number] "{r0}" (@intFromEnum(number)), [arg1] "{r3}" (arg1), [arg2] "{r4}" (arg2), - : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" + : "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); } @@ -63,7 +63,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { [arg1] "{r3}" (arg1), [arg2] "{r4}" (arg2), [arg3] "{r5}" (arg3), - : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" + : "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); } @@ -79,7 +79,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) [arg2] "{r4}" (arg2), [arg3] "{r5}" (arg3), [arg4] "{r6}" (arg4), - : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" + : "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12" ); } @@ -96,7 +96,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, [arg3] "{r5}" (arg3), [arg4] "{r6}" (arg4), [arg5] "{r7}" (arg5), - : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" + : "memory", "cr0", "r8", "r9", "r10", "r11", "r12" ); } @@ -122,7 +122,7 @@ pub fn syscall6( [arg4] "{r6}" (arg4), [arg5] "{r7}" (arg5), [arg6] "{r8}" (arg6), - : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" + : "memory", "cr0", "r9", "r10", "r11", "r12" ); } From 665d0157d5f333ebc6b353703e77661b11bcac8c Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Sun, 22 Sep 2024 10:58:53 -0400 Subject: [PATCH 2/2] std ppc64: add nop to start inline-asm fixes ld.lld error: call to save_start.posixCallMainAndExit lacks nop, can't restore toc --- lib/std/start.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/std/start.zig b/lib/std/start.zig index 63255c17fc..01a33522d0 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -391,6 +391,7 @@ fn _start() callconv(.Naked) noreturn { \\ stdu 0, -32(1) \\ mtlr 0 \\ b %[posixCallMainAndExit] + \\ nop , .s390x => // Set up the stack frame (register save area and cleared back-chain slot).