how to invoke ld without gcc

Nick Clifton nickc@redhat.com
Thu May 27 09:34:00 GMT 2004


Hi Feroz,

> I am facing the following errors while invoking the 'gnu linker'
> directly without using the driver 'gcc':
> 
> GNU mips ld version is 2.8

This is a very old version of the linker.  We are now up to release 2.15...

> <$> ./mips-elf-gcc -T idt.ld <startupRoutine>.o <Test>.o -o <Test>.out

Umm, this would appear to be invoking the linker via gcc.  I assume that 
you mean "./mips-elf-ld -T....." ?

> <$> ./mips-elf-gcc -gdwarf-2 -T idt.ld <Test>.o -o <Test>.out
> 
> presumably because 'gcc' itself is arranging for all the required
> libraries which I am failing to provide in the command line argument of
> 'ld'.

If you add the "-v" switch to gcc's command line it will show you how it 
invokes the linker.  You can then see which libraries are being linked in.

Note - for some targets gcc will invoke a program called "collect2" 
instead of "ld".  This is a pre-processor program which is designed to 
help with the handling of constructors and destructors in C++ object 
files.  In most (non C++) cases however you can just substitute "ld" for 
"collect2" and obtain the same behaviour.

Cheers
   Nick



More information about the Binutils mailing list