[PATCH] D20664: [ELF][MIPS] Always resolve MIPS GP-relative relocations to 'local' definitions

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 09:22:19 PDT 2016


On May 27, 2016 12:18 PM, "Simon Atanasyan" <simon at atanasyan.com> wrote:
>
> atanasyan added a comment.
>
> In http://reviews.llvm.org/D20664#442189, @rafael wrote:
>
> > Any idea why gpword is used with a global?
>
>
> It's my mistake. I select a wrong test case to show the problem (it was
easier to copy-paste existing test code). A real case is R_MIPS_GPREL16.
This relocation is used to setup GP offset in a function's prologue. That
is why it should be always resolved locally. Here is an example. I am going
to update the test case before commit.
>
>     .text
>     .global  entry
>   entry:
>     lui     $gp,%hi(%neg(%gp_rel(foo)))
>     daddu   $gp,$gp,$t9
>     daddiu  $gp,$gp,%lo(%neg(%gp_rel(foo)))
>
> R_MIPS_GPREL32 is for local symbols. But GNU linker does not show any
error if R_MIPS_GPREL32's target is preemptible symbol. So I still think it
is better to handle them uniformly too.

If it doesn't show up in the wild, please don't check for it.

Cheers,
Rafael

> And thanks for review.
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D20664
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160527/353faff4/attachment.html>


More information about the llvm-commits mailing list