some questions about ld conection?
Nick Clifton
nickc@redhat.com
Fri Nov 20 13:22:00 GMT 2009
Hi miloody,
> 1. How gcc know where ld is?
Check out the "Directory Options" part of the gcc documentation (under
the "Invoking GCC" section).
If you add "-v" to your gcc command line you will see the path that gcc
has found to the linker executable. (Actually you are more likely to
see it executing a program called "collect2" which will then go on to
invoke the linker).
> As far as I know, gcc and binutils are 2 independent packages, so
> there must be some setting let gcc know where the ld is, right?
They are separate packages yes, and in theory they are independent but
often there are quite close ties between them. For example some
features of gcc might only be enabled if it is known that the assembler
is gas or that the linker is the binutils linker.
Plus it is common for toolchain builders to use a combined source tree
that contains both the gcc and the binutils sources. (And often sources
for other projects as well such as gdb or newlib). With a combined
source tree it is possible to use a single configure command line to
configure both gcc and binutils at the same time. In this way they are
built with the same expectations about where sources will be located.
> But I cannot see the connection in my configures of binutils and gcc as below:
> binutils configure:
> --prefix=/root/bare_metal/x-tools/mipsel-unknown-elf
This option is key - it is telling gcc (the compiler driver program) the
root of the path it should use when trying to locate executables such as
cc1 or the linker.
> 2. what are the difference of elf32-littlemips and elf32-tradlittlemips?
I'll leave that one to a MIPS expert to answer.
> 3. under what circumstances we will need "Supported emulations" in ld?
Check out the linker documentation, under
Invocation/Environment/LDEMULATION.
Cheers
Nick
More information about the Binutils
mailing list