i'm trying to create a dynamically linked executable (elf_i386) without gcc. The program is very simple (only a printf)...here the commands:
$ gcc -c simple.c
$ ld -o simple -dynamic-linker /lib/ld-linux.so.2 --entry main /usr/lib/crt1.o /usr/lib/crti.o simple.o -lc /usr/lib/crtn.o
The executable is created and also file command and ldd command show the right output... However when i launch the program after the call to printf i get a segmentation fault...i've examined with objdump the executable and i think the problem is about the dtors...seems that compiling with:
$gcc -o simple simple.c
a section .dtors is present while it is not present inside the executable created directly with ld :(
Any ideas?