This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: collect2 picks wrong target-ld (was: ld: bad -plugin option)
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 01 Dec 2011 17:20:53 +0100
- Subject: Re: collect2 picks wrong target-ld (was: ld: bad -plugin option)
- References: <4ED74B9F.6090108@gjlay.de> <4ED7708D.6020606@gjlay.de>
Georg-Johann Lay wrote:
> Georg-Johann Lay wrote:
>> Hi, I am running into this error from ld since I removed --disable-lto from the
>> configure. I used --disable-lto some time because of problems with LTO.
>>
>> Anyways, I'd like to build with LTO again and get this really not-very-specific
>> error
>>
>> /home/georg/install/gcc-4.7/lib/gcc/avr/4.7.0/../../../../avr/bin/ld: bad
>> -plugin option
>> collect2: error: ld returned 1 exit status
>
> Calling ld directly yields:
>
> $ /home/georg/install/gcc-4.7/lib/gcc/avr/4.7.0/../../../../avr/bin/ld --help |
> grep -i plug
> -plugin PLUGIN Load named plugin
> -plugin-opt ARG Send arg to last-loaded plugin
> /home/georg/install/gcc-4.7/lib/gcc/avr/4.7.0/../../../../avr/bin/ld: supported
> targets: elf32-avr elf32-little elf32-big plugin srec symbolsrec verilog tekhex
> binary ihex
>
> So there is nothing wrong with the install.
>
> $ ll /home/georg/install/gcc-4.7/libexec/gcc/avr/4.7.0/liblto_plugin.so
> /home/georg/install/gcc-4.7/libexec/gcc/avr/4.7.0/liblto_plugin.so ->
> liblto_plugin.so.0.0.0
>
>
> $ ls -al /home/georg/install/gcc-4.7/libexec/gcc/avr/4.7.0/liblto*
> /home/georg/install/gcc-4.7/libexec/gcc/avr/4.7.0/liblto_plugin.la
> /home/georg/install/gcc-4.7/libexec/gcc/avr/4.7.0/liblto_plugin.so ->
> liblto_plugin.so.0.0.0
> /home/georg/install/gcc-4.7/libexec/gcc/avr/4.7.0/liblto_plugin.so.0 ->
> liblto_plugin.so.0.0.0
> /home/georg/install/gcc-4.7/libexec/gcc/avr/4.7.0/liblto_plugin.so.0.0.0
>
> Confused,
>
> Johann
>
collect2 calls the wring linker (avr-ld).
It calls avr-ld from $PATH instead of the linker as installed in the toolchain
and with --prefix.
--prefix is not in $PATH but binutils are configured with the same --prefix and
installed before GCC way configured.
I'd expect that a toolchain installation is self-contained and that if there is
a complete toolchain the tools can be called by their absolute paths?
Similarly, collect2 in $BUILD calls avr-ld it finds in $PATH instead of the
avr-ld installed at --prefix.
Is this a bug or a feature?
Johann