rt0 library & binary sizes

June 26, 2017 ยท View on GitHub

BinaryArchSizePurpose
librt0.ai3862810Startup code+syscall
librt0.ax86_643974Startup code+syscall
t/hello.exei386624Hello World\n
t/hello.exex86_64824Hello World\n
hello.exei3862988Hello World\n with glibc
hello.exex86_644200Hello World\n with glibc
t/null.exei386560Empty main
t/null.exex86_64768Empty main
null.exei3862888Empty main with glibc
null.exex86_642988Empty main with glibc
.........With __RT0_WITH_FASTER_SYSCALL__
librt0.ai3863980Startup code+syscall
librt0.ax86_645604Startup code+syscall
t/hello.exei386608Hello World\n
t/hello.exex86_64792Hello World\n
t/null.exei386552Empty main
t/null.exex86_64752Empty main

Compiler: GCC 4.8.5, GNU LD linker 2.25.1, ld/binutils 2.25.1, OS: RHEL 7.3, Source: Author Compiler: GCC 4.8.4, gold linker 1.11, ld/binutils 2.24, OS: Ubuntu 14.04.3, Source: Author

Compile Flags: -Os -nostdlib -fomit-frame-pointer -fno-stack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops -fmerge-all-constants -fno-ident -mfpmath=387 -mfancy-math-387 -ffunction-sections -fdata-sections -Wl,--gc-sections

Link Flags: -s -static -nostdlib -z norelro --hash-style=sysv --build-id=none --gc-sections


HelloWorld & null compiled with flags above but without -nostdlib.

HelloWorld.glibc.c

#include <unistd.h>

int main( int argc, char** argv, char** envp )
{
   int ret = write( 1, "Hello World!\n", 13 );
   return( 0 );
}

null.glibc.c

int main( int argc, char** argv, char** envp )
{
   return( 0 );
}