On Mon, Nov 16, 2009 at 05:15:04PM +0100, Paolo Bonzini wrote:
On 11/16/2009 03:01 PM, Daniel Veillard wrote:
> The only thing I could gather is using -Wl,-debug option of gcc on a
> compile + link simple test and then parse stderr to find 'ld '
> But that's still completely gcc specific, so ACK for current patch,
The right one is to use "`gcc --print-prog-name=ld`".
That gives the program name but not the path used:
paphio:~/libvirt -> gcc -Wl,-debug -o tst ../tst.c 2> res
paphio:~/libvirt -> grep "ld " res
/usr/bin/ld --eh-frame-hdr --build-id -m elf_x86_64 --hash-style=gnu
-dynamic-linker /lib64/ld-linux-x86-64.so.2 -o tst
[...]
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../../lib64/crtn.o
paphio:~/libvirt -> gcc --print-prog-name=ld
ld
paphio:~/libvirt ->
so that won't differentiate ld in $PATH from /usr/bin/ld which
is the actual command launched by gcc (or rather collect2) ... so
unfortunately that's still gcc only and even then incomplete :-)
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/