Anunay wrote:

> Just a further question, how do we know that CC has invoked the 64-bit
 > version of the linker?

You don't, nor do you have to :-).  The 32-bit linker is capable of
generating 64-bit ELF objects (the 64-bit linker is also capable of
generating 32-bit ELF objects).

The class of ELF object to be built is determined from the first relocatable
object input file that ld(1) processes - typically, this is one of the crt
files provided by the compiler driver, which is why it is important to
tell the compiler driver what class of object you're trying to create.

If a 64-bit ELF object is being built, and the system is 64-bit capable,
the 64-bit ld(1) is invoked.

Note, the compiler always execs /usr/ccs/bin/ld, but the linker will
re-exec itself if required:

% truss -ftexec cc -xarch=amd64 -G foo.c
1309:   execve("/opt/SUNWspro/SOS10/prod/bin/cc", 0x08047024, 0x08047034) ...
.....
1320:   execve("/usr/ccs/bin/ld", 0x080916A0, 0x0808EACC)  argc = 9
1320:   execve("/usr/ccs/bin/amd64/ld", 0x08046E64, 0x08046E8C)  argc = 9



-- 
Rod

Reply via email to