It was thus said that the Great Eric J. Korpela once stated:
I did
#include <stdlib.h>
int main(void) { return(EXIT_SUCCESS); } /* [1] */
A static link made a binary of 435,031 bytes, and dynamically linking is
around 3k (using the default options). So that's the overhead (at least
under RedHat 5.2).
-spc (Still a bit large to me ... )
Given that you are still linking in ctr0.o and libc, it's not surprising
that it's huge. I'd suggest the following steps... Rename main() to start().
Compile the C to assembly (-S option to gcc). Edit the assembly file to
remove all the unnecessary stuff. Assemble the file using "as". Link the
object using "ld".
That's the overhead for using the Standard C Library. The minimum seems
to be around 300 bytes or so, mostly for the executable section headers.
Besides, when I generated the assembly code for the above file (using
``gcc -S -O4 -fomit-frame-pointer h4.c'') I got:
.file "h4.c"
.version "01.01"
gcc2_compiled.:
.text
.align 4
.globl main
.type main,@function
main:
xorl %eax,%eax
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) 2.7.2.3"
There's not much left to take out 8-)
-spc (GCC is actually a fairly decent C compiler)