How can I link files manually to gcc rather than use the ones installed in the OS ? The point is that the only the manually provided files should be used when executing the program: glibc, libgcc, linker, headers, and whatever other files are needed.
This should be a really easy thing to do ? (I know about -static but I want to used shared libraries rather than using a huge single binary.) -nostdlib is the way to go but I cannot even get close to compiling a simple Hello World program.
I tried something like this but I get errors: (the .so files are on my Desktop)
myuser@linux:~/Desktop$ gcc -nostdlib libc-2.11.2.so ld-2.11.2.so libgcc_s.so.1 simple.c
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000400390
myuser@linux:~/Desktop$ ./a.out
Hello World!
Segmentation fault (core dumped)
Can anybody provide a working example ?