mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
Fix PowerPC restore_rt
Clang fails to compile the CBE translation of this code ("non-ASM
statement in naked function"). Similar to the implementations of
`restore_rt` on x86 and ARM, when the CBE is in use, this commit employs
alternative inline assembly that avoids using non-immediate input
operands.
This commit is contained in:
parent
5bf52a6f50
commit
7f49dae284
@ -247,11 +247,19 @@ pub fn clone() callconv(.naked) usize {
|
||||
pub const restore = restore_rt;
|
||||
|
||||
pub fn restore_rt() callconv(.naked) noreturn {
|
||||
asm volatile (
|
||||
\\ sc
|
||||
:
|
||||
: [number] "{r0}" (@intFromEnum(SYS.rt_sigreturn)),
|
||||
: .{ .memory = true, .cr0 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true });
|
||||
switch (@import("builtin").zig_backend) {
|
||||
.stage2_c => asm volatile (
|
||||
\\ li 0, %[number]
|
||||
\\ sc
|
||||
:
|
||||
: [number] "i" (@intFromEnum(SYS.rt_sigreturn)),
|
||||
: .{ .memory = true, .cr0 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true }),
|
||||
else => _ = asm volatile (
|
||||
\\ sc
|
||||
:
|
||||
: [number] "{r0}" (@intFromEnum(SYS.rt_sigreturn)),
|
||||
: .{ .memory = true, .cr0 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true }),
|
||||
}
|
||||
}
|
||||
|
||||
pub const F = struct {
|
||||
|
||||
@ -232,11 +232,19 @@ pub fn clone() callconv(.naked) usize {
|
||||
pub const restore = restore_rt;
|
||||
|
||||
pub fn restore_rt() callconv(.naked) noreturn {
|
||||
asm volatile (
|
||||
\\ sc
|
||||
:
|
||||
: [number] "{r0}" (@intFromEnum(SYS.rt_sigreturn)),
|
||||
: .{ .memory = true, .cr0 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true });
|
||||
switch (@import("builtin").zig_backend) {
|
||||
.stage2_c => asm volatile (
|
||||
\\ li 0, %[number]
|
||||
\\ sc
|
||||
:
|
||||
: [number] "i" (@intFromEnum(SYS.rt_sigreturn)),
|
||||
: .{ .memory = true, .cr0 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true }),
|
||||
else => _ = asm volatile (
|
||||
\\ sc
|
||||
:
|
||||
: [number] "{r0}" (@intFromEnum(SYS.rt_sigreturn)),
|
||||
: .{ .memory = true, .cr0 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true }),
|
||||
}
|
||||
}
|
||||
|
||||
pub const F = struct {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user