[lld] r249588 - [ELF2] - fix to use PLT/GOT for DSO function calls (X86TargetInfo)

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 7 11:46:13 PDT 2015


Author: grimar
Date: Wed Oct  7 13:46:13 2015
New Revision: 249588

URL: http://llvm.org/viewvc/llvm-project?rev=249588&view=rev
Log:
[ELF2] - fix to use PLT/GOT for DSO function calls (X86TargetInfo)

Differential Revision: http://reviews.llvm.org/D13522

Modified:
    lld/trunk/ELF/Target.cpp
    lld/trunk/test/elf2/relocation-i686.s

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=249588&r1=249587&r2=249588&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Oct  7 13:46:13 2015
@@ -56,7 +56,7 @@ bool X86TargetInfo::relocPointsToGot(uin
 }
 
 bool X86TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
-  return Type == R_386_PLT32;
+  return Type == R_386_PLT32 || (Type == R_386_PC32 && S.isShared());
 }
 
 static void add32le(uint8_t *L, int32_t V) { write32le(L, read32le(L) + V); }

Modified: lld/trunk/test/elf2/relocation-i686.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/relocation-i686.s?rev=249588&r1=249587&r2=249588&view=diff
==============================================================================
--- lld/trunk/test/elf2/relocation-i686.s (original)
+++ lld/trunk/test/elf2/relocation-i686.s Wed Oct  7 13:46:13 2015
@@ -62,7 +62,7 @@ R_386_GOTPC:
         call bar+4
 // CHECK:      Disassembly of section .dynamic_reloc:
 // CHECK-NEXT: .dynamic_reloc:
-// CHECK-NEXT:   12019:  e8 00 00 00 00  calll  0
+// CHECK-NEXT:   12019:  e8 16 00 00 00 calll 22
 
 .section .R_386_GOT32,"ax", at progbits
 .global R_386_GOT32




More information about the llvm-commits mailing list