Linking without gcc, but with ld
My final projet in my school is a study about the efficiency of the GNU tools (!!!). My question is directly related to one of these tools, ld :
I have a program, prog.c, which uses two libraries, lib01.c and lib02.c, which are header'd by lib01.h and lib02.h.
I produced the object files by gcc -c lib01.c lib02.c prog.c, which gave me lib01.o, lib02.o and prog.o.
I know that if I do a gcc lib01.o lib02.o prog.o -o my_prog, it will give an executable program, BUT I want that program to be linked WITHOUT gcc, but with ld !
Does anyone know how to do that ? I tried
ld -o my_prog prog.o lib01.o lib02.o -lc
but it says
ld: warning: cannot find entry symbol _start; defaulting to 0000000008048190
Thanks in advance !
compile with gcc -v to see exactly how gcc links your program. This should tell you what flags you need to link with on your platform.
Thanks for your advise ! I managed to go on with that work...
use -e option with ld
ld -e main prog.o lib1.o lib2.o
|All times are GMT -5. The time now is 05:40 PM.|