New Patch to fix MIPS -mno-shared with multi-got...
David Daney
ddaney@avtrex.com
Fri Mar 4 19:43:00 GMT 2005
Richard Sandiford wrote:
> David Daney <ddaney@avtrex.com> writes:
>
>>The main question being: Use _gp or __gnu_local_gp ?
>>
>>The pros of using _gp are that Thiemo's plan to magically rename _gp
>>would be binary compatible.
>>
>>The pros of using __gnu_local_gp are that existing code using _gp
>>outside of .cpload would continue to work.
>>
>>I am inclined to use _gp as it does not create a gnu specific ABI
>>extension, but I am apprehensive about what will happen when I try to
>>build glibc.
>
>
> Well, I think Thiemo was suggesting that the assembler use _gp.N
> instead of _gp, so that would need a GNU-specific extension as well.
>
> Other arguments in favour of __gnu_local_gp:
>
> - What -mno-shared does is already a GNU-specific ABI extension,
> in that no existing MIPS tools do it as far as I'm aware. So in
> a way, it seems natural to use a GNU-specific extension for the
> symbol as well.
>
> - -mno-shared isn't implied by other options. You have to ask for
> it explicitly. It seems reasonable to ask that you only use
> -mno-shared with a linker that would support it.
>
> - Simply adding a "__gnu_local_gp = _gp;" assignment to a linker
> script would make it work with existing linkers.
>
> FWIW, I like your patch (but I can't approve it). One very minor
> nit though:
>
>
>>! ex.X_add_symbol = symbol_find_or_make (in_shared ? "_gp_disp" : "__gnu_local_gp");
>
>
> ...watch the long lines.
Done.
Attached is what I hope is the final version of the patch. I had to
bzip2 it because the testcase is a bit large.
Comments from Richard Sandiford and Daniel Jacobowitz convinced me that
we should use "__gnu_local_gp" as the symbol referenced in the
-mno-shared .cpload optimization.
Tested on i686-linux -> mipsel-linux cross with make -k check no
regressions found.
bfd ChangeLog:
2005-03-04 David Daney <ddaney@avtrex.com>
* elfxx-mips.c (mips_elf_calculate_relocation): Handle special
'__gnu_local_gp' symbol used by gas -mno-shared.
gas ChangeLog:
2005-03-04 David Daney <ddaney@avtrex.com>
* config/tc-mips.c (macro_build_lui): Use '__gnu_local_gp' instead
of '_gp' for -mno-shared optimization.
(s_cpload): Ditto.
(s_abicalls): Document it in the comment.
(md_show_usage): Document the -mno-shared option.
gas/testsuite ChangeLog:
2005-03-04 David Daney <ddaney@avtrex.com>
* gas/mips/elf-rel23b.d: Use '__gnu_local_gp' instead
of '_gp' for -mno-shared optimization.
* gas/mips/elf-rel25a.d: Ditto.
ld/testsuite ChangeLog:
2005-03-04 David Daney <ddaney@avtrex.com>
* ld-mips-elf/multi-got-no-shared{-1.s, -2.s, .d}: New test.
* ld-mips-elf/mips-elf.exp: Run it.
If O.K. I can try to commit as it appears that I have CVS write access
(although never tested with binutils).
David Daney.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils.d.bz2
Type: application/x-tar
Size: 165261 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20050304/6b9135e4/attachment.tar>
More information about the Binutils
mailing list