This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: binutils 2.19.92 linker broke with --as-needed flag
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Vincent Wen <wenvincent90 at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 14 Feb 2013 13:18:19 +0000
- Subject: Re: binutils 2.19.92 linker broke with --as-needed flag
- References: <CAF_=-cACCz1d-tr+Etmdk4jWYwLh5NA5kKom=x3OiMGwyRjzqQ@mail.gmail.com> <20130213005253.GB29681@bubble.grove.modra.org>
Alan Modra <amodra@gmail.com> writes:
> On Mon, Feb 04, 2013 at 05:58:37PM -0800, Vincent Wen wrote:
>> The linker broke when as-need flag is added.
>>
>> /bin/sh ../libtool --tag=CC --mode=link mipsel-linux-gcc -I../include -g
>> -O2 -Wl,--as-needed -o test-example test.o ../lib/libTestGcc.la
>> libtool: link: mipsel-linux-gcc -I../include -g -O2 -Wl,--as-needed -o
>> .libs/test-example test.o ../lib/.libs/libTestGcc.so -Wl,-rpath
>> -Wl,/usr/local/lib
>> ../lib/.libs/libTestGcc.so:(.got+0x0): multiple definition of
>> `_GLOBAL_OFFSET_TABLE_'
>
> I think mips was broken before --as-needed. mips seems to want a
> dynamic _GLOBAL_OFFSET_TABLE_ symbol in shared libs, presumably for
> use by ld.so.
Yeah, I've no idea why that mips does what it does. GNU ld.so uses
DT_PLTGOT to find and relocate the GOT, as you'd hope.
Richard