Here is what I got:
#include <sys/syscall.h>// Copied from MUSL libc// There are more at// http://git.musl-libc.org/cgit/musl/tree/arch/x86_64/syscall_arch.hstatic __inline long __syscall1(long n, long a1) { unsigned long ret; __asm__ __volatile__("syscall" : "=a"(ret) : "a"(n), "D"(a1) : "rcx", "r11", "memory"); return ret;}void do_exit(int status) { __syscall1(SYS_exit, status); }void entry() { do_exit(5); }
Saved as syscall.c and compiled with
cc -Wall -W -pedantic -static -O3 -march=native -flto -fno-fat-lto-objects -fPIC -fPIE -fstack-protector-strong -std=gnu18 -nostdlib -e entry syscall.c -o syscall
And this is the entire disassembly of the 9,224 byte program:
0000000000001000 <entry>: 1000: f3 0f 1e fa endbr64 1004: b8 3c 00 00 00 mov $0x3c,%eax 1009: bf 05 00 00 00 mov $0x5,%edi 100e: 0f 05 syscall 1010: c3 retq