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

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 09:18:02 PDT 2016


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.

And thanks for review.


Repository:
  rL LLVM

http://reviews.llvm.org/D20664





More information about the llvm-commits mailing list