>>107575489
I'm going to be completely honest homie, I still have no idea how linker script works - seems quite weird. I cheated and inlined the syscalls directly into the main function and eschewed the _start completely by making main the entry point. Got down to 504 bytes using your linker script:
#define SYS_write 1
#define SYS_exit 60
const char message[] = "Hello, world!\n";
void main(void)
{
asm("xor rbp, rbp");
asm("syscall"
:
: "r"(SYS_write), "r"(1), "r"(message), "r"(sizeof(message) - 1));
asm("syscall" : : "r"(SYS_exit), "r"(0));
}
and the same old invocations as last time + your linker script:
clang -s -static -Os -masm=intel -nolibc -nostdlib -Wl,-n,-T,linkerscript.ld -fno-ident -fno-asynchronous-unwind-tables -o nolibc.out nolibc.c