[PATCH] Fix --as-needed for MIPS.

David Daney ddaney@avtrex.com
Fri Jul 29 22:20:00 GMT 2005


Thiemo Seufer wrote:
> David Daney wrote:
> [snip]
> 
>>+   /* Shared objects may have a dynamic symbol '_gp_disp' defined as
>>+      a SECTION *ABS*.  This causes ld to think it can resolve _gp_disp
>>+      by setting a DT_NEEDED for the shared object.  Since _gp_disp is
>>+      a magic symbol resolved by the linker, we ignore this bogus definition
>>+      of _gp_disp. */
>>+   if ((strcmp (*namep, "_gp_disp") == 0) && !bfd_is_und_section (*secp))
>>+     {
>>+       *namep = NULL;
>>+       return TRUE;
>>+     }
> 
> 
> This should be limited to OldABI objects, for N32/N64 _gp_disp is not
> a magic symbol.

O.K,

Attached is the new version of the patch.

Preventing the _gp_disp from being emitted into dynamic objects is a 
more difficult problem.  I think to do it properly that hacking would 
have to be done in the core of ld and bfd.

Tested with a cross build running on i686-pc-linux configured as:

../src/configure  --target=mipsel-linux 
--prefix=/usr/local/mipsel-linux-3.4.3 
--with-sysroot=/usr/local/mipsel-linux-3.4.3

make -k check with no regressions.

2005-07-29  David Daney  <ddaney@avtrex.com>

     * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook):  Ignore _gp_disp
     if it is in the *ABS* section.

O.K. to commit?

David Daney


-------------- next part --------------
A non-text attachment was scrubbed...
Name: b.p
Type: text/x-pascal
Size: 1055 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20050729/f3a0267a/attachment.bin>


More information about the Binutils mailing list