Thank you guys for your responses. They' ve been very useful.
I' ve made some tests today, the result is that if I leave "prog" as
the label name and then I use the GCC "-nostdlib " parameter, a
warning message stating that there's no _stat function appears but the
program (or function) is correctly linked. Using "-nostdlib "
parameter, the executable file is just 744 byte, without "-nostdlib "
parameter the executable file is about 7 kB!
My last question is: what is the best way to write simple (addition,
subtraction,...) STAND-ALONE assembly programs, without C libraries or
external stuff (just pure assembly)? What about writing the code of
the program with a _start label in it, then assembling and linking it,
using the "-nostdlib " parameter (or using directly ld)? Or is there a
better (or easier) way?
P.S.: why the executable stops with a segmentation fault? Am I forced
to use the syscall exit?
thank you


|