top | item 40704499

(no title)

sp1rit | 1 year ago

> This C program doesn’t use any C standard library functions.

This is only half true. While the code doesn't call any stdlib functions, it still relies on the the c stdlib and runtime in order to get called and properly exit.

I'm somewhat perplexed why the author did do it with the runtime, given that he doesn't really depend on features of it (except maybe the automatic exit code handling) instead of building with -ffreestanding.

discuss

order

fsmv|1 year ago

You have to add some extra assembly before main if you don't use the C runtime. You have to write _start, the actual entry point that CRT usually takes. https://github.com/fsmv/dfre/blob/master/code/linux32_start....

This is for -nostdlib not -ffreestanding

sp1rit|1 year ago

You can usually with not having the initial part. As long as you do call the exit syscall, it should work.

ASalazarMX|1 year ago

"This C program doesn’t explicitly use any C standard library functions." doesn't sound as cool, though.