On 11/16/2009 11:42 PM, Daniel Veillard wrote:
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:-)
If --print-prog-name gives only "ld" that means collect2 will walk the
$PATH. But if gcc was configured with --with-ld=something, or if a -B
option is included in $CC, then --print-prog-name will print a full path.
Example (PATH includes ~/bin):
$ cat ~/bin/ld
#! /bin/sh
echo hello from "$0" > /dev/tty
exec /usr/bin/ld "$@"
$ gcc --print-prog-name=ld
ld
$ gcc f.c
hello from /home/pbonzini/bin/ld
$ gcc -B$HOME/bin --print-prog-name=ld
/home/pbonzini/bin/ld
$ gcc -B$HOME/bin f.c
hello from /home/pbonzini/bin/ld
$ gcc -B$HOME/./bin --print-prog-name=ld
/home/pbonzini/./bin/ld
$ gcc -B$HOME/./bin f.c
hello from /home/pbonzini/./bin/ld
HTH,
Paolo