I was just messing around with zig. I wrote this exit function:
fn exit(code: u8) noreturn {
asm volatile ("syscall"
:
: [syscall_code] "{rax}" (60),
[exit_code] "{rdi}" (code),
: "rci"
);
unreachable;
}
And got a "legacy asm clobbers syntax".
Saving my program auto-formatted and changed this:
- : "rci"
+ : .{ .rci = true }
But I get this error:
main.zig:10:15: error: no field named 'rci' in struct 'builtin.assembly.Clobbers__struct_7999'
: .{ .rci = true });
^~~
/usr/lib/zig/std/builtin/assembly.zig:2:29: note: struct declared here
.x86, .x86_64 => packed struct {
~~~~~~~^~~~~~
referenced by:
_start: main.zig:2:9
_start: main.zig:1:1
4 reference(s) hidden; use '-freference-trace=6' to see all references
I am compiling this with: zig run main.zig -target x86_64-freestanding since I am using exposing my own _start instead of using a main() entrypoint :p