[lld] r265147 - Don't apply a recolation that the dynamic linker will rewrite.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 1 09:21:10 PDT 2016


Author: rafael
Date: Fri Apr  1 11:21:09 2016
New Revision: 265147

URL: http://llvm.org/viewvc/llvm-project?rev=265147&view=rev
Log:
Don't apply a recolation that the dynamic linker will rewrite.

This matches the behavior of both bfd and gold. Looks like we just got
here for mips because of a bad ordering of an if else chain.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/test/ELF/mips-32.s

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=265147&r1=265146&r2=265147&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Apr  1 11:21:09 2016
@@ -316,11 +316,11 @@ void InputSectionBase<ELFT>::relocate(ui
     } else if (Target->needsThunk(Type, *this->getFile(), Body)) {
       // Get address of a thunk code related to the symbol.
       SymVA = Body.getThunkVA<ELFT>();
-    } else if (Config->EMachine == EM_MIPS) {
-      SymVA = adjustMipsSymVA<ELFT>(Type, *File, Body, AddrLoc, SymVA);
     } else if (!Target->needsCopyRel<ELFT>(Type, Body) &&
                Body.isPreemptible()) {
       continue;
+    } else if (Config->EMachine == EM_MIPS) {
+      SymVA = adjustMipsSymVA<ELFT>(Type, *File, Body, AddrLoc, SymVA);
     }
     if (Target->isSizeRel(Type))
       SymVA = Body.getSize<ELFT>() + A;

Modified: lld/trunk/test/ELF/mips-32.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/mips-32.s?rev=265147&r1=265146&r2=265147&view=diff
==============================================================================
--- lld/trunk/test/ELF/mips-32.s (original)
+++ lld/trunk/test/ELF/mips-32.s Fri Apr  1 11:21:09 2016
@@ -32,11 +32,11 @@ v2:
   .word v1   # R_MIPS_32 target v1 addend 0
 
 # BE: Contents of section .data:
-# BE-NEXT: 30000 00000000 00030008 00030000
+# BE-NEXT: 30000 00000000 00000004 00030000
 #                         ^-- v2+4 ^-- v1
 
 # EL: Contents of section .data:
-# EL-NEXT: 30000 00000000 08000300 00000300
+# EL-NEXT: 30000 00000000 04000000 00000300
 #                         ^-- v2+4 ^-- v1
 
 # SYM: SYMBOL TABLE:




More information about the llvm-commits mailing list