|
|
|
|
|
by nsguy
802 days ago
|
|
IIRC there's some setup code that's injected before main is called and can be turned off in most compilers (_start?). Should be possible to get down to essentially the same thing you can do with an assembler. C (and so C++ for the most part) is essentially a portable assembler. You can probably also just inline those 10 x86 instructions directly. |
|
And the setup code is not completely useless, for example it is responsible for parsing command line parameters and actually running main. If you want to actually use libc instead of just writing assembly directly, you may need it.
You can strip
>_start Almost but not quite! _start is the name of the symbol that is executed first in the program. If you compile with -nostdlib, you need to provide this symbol yourself (this will be your new main).