2 ms·
I’m not sure why they aren’t using the SYS_* constants either.
by saagarjha 7y ago
I’m not sure why they aren’t using the SYS_* constants either.
- jagrsw 7y agoYup, it'd make it (also using SYS_exit instead of SYS_exit_group) compilable under various *BSD OSes. Doesn't work for some reason under NetBSD due to some linking problem producing invalid binary for the platform. $ gcc -nostartfiles a.c -o a -Wl,--entry=_start -static $ ./a -bash: ./a: cannot execute binary file: Exec format error $ file a a: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped\ But the final binary is impressively small, and it seem to contain all relevant code (body of _start and syscall funcs) $ strip -s a; ls -l a -rwxr-xr-x 1 user users 2688 Jan 5 07:53 a Works under FreeBSD though: $ clang -nostartfiles a.c -o a -static $ ./a Hello world! $ strip -s a; ls -l a -rwxr-xr-x 1 user user 9216 Jan 5 07:59 a
- deleted 7y ago[deleted]