[lld] r251541 - Reapply r251536

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 11:33:08 PDT 2015


Author: grimar
Date: Wed Oct 28 13:33:08 2015
New Revision: 251541

URL: http://llvm.org/viewvc/llvm-project?rev=251541&view=rev
Log:
Reapply r251536

Modified:
    lld/trunk/ELF/Target.cpp
    lld/trunk/test/elf2/dynamic-reloc-index.s
    lld/trunk/test/elf2/dynamic-reloc.s

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=251541&r1=251540&r2=251541&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Oct 28 13:33:08 2015
@@ -262,14 +262,9 @@ bool X86_64TargetInfo::relocNeedsGot(uin
 }
 
 unsigned X86_64TargetInfo::getPLTRefReloc(unsigned Type) const {
-  switch (Type) {
-  case R_X86_64_32:
-    return R_X86_64_32;
-  case R_X86_64_PC32:
-  case R_X86_64_PLT32:
+  if (Type == R_X86_64_PLT32)
     return R_X86_64_PC32;
-  }
-  llvm_unreachable("Unexpected relocation");
+  return Type;
 }
 
 bool X86_64TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
@@ -280,6 +275,7 @@ bool X86_64TargetInfo::relocNeedsPlt(uin
   default:
     return false;
   case R_X86_64_32:
+  case R_X86_64_64:
   case R_X86_64_PC32:
     // This relocation is defined to have a value of (S + A - P).
     // The problems start when a non PIC program calls a function in a shared

Modified: lld/trunk/test/elf2/dynamic-reloc-index.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/dynamic-reloc-index.s?rev=251541&r1=251540&r2=251541&view=diff
==============================================================================
--- lld/trunk/test/elf2/dynamic-reloc-index.s (original)
+++ lld/trunk/test/elf2/dynamic-reloc-index.s Wed Oct 28 13:33:08 2015
@@ -7,8 +7,8 @@
 // We used to record the wrong symbol index for this test
 
 // CHECK:      Relocations [
-// CHECK-NEXT:   Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT:     0x11000 R_X86_64_64 bar 0x0
+// CHECK-NEXT:   Section ({{.*}}) .rela.plt {
+// CHECK-NEXT:     0x120C8 R_X86_64_JUMP_SLOT bar 0x0
 // CHECK-NEXT:   }
 // CHECK-NEXT: ]
 

Modified: lld/trunk/test/elf2/dynamic-reloc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/dynamic-reloc.s?rev=251541&r1=251540&r2=251541&view=diff
==============================================================================
--- lld/trunk/test/elf2/dynamic-reloc.s (original)
+++ lld/trunk/test/elf2/dynamic-reloc.s Wed Oct 28 13:33:08 2015
@@ -9,7 +9,7 @@
 // CHECK:      Index: 1
 // CHECK-NEXT: Name: .dynsym
 
-// CHECK:      Name: .rela.dyn
+// CHECK:      Name: .rela.plt
 // CHECK-NEXT: Type: SHT_RELA
 // CHECK-NEXT: Flags [
 // CHECK-NEXT:   SHF_ALLOC
@@ -28,24 +28,25 @@
 // CHECK-NEXT:   SHF_ALLOC
 // CHECK-NEXT:   SHF_EXECINSTR
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: [[ADDR:.*]]
+// CHECK-NEXT: Address: 0x11000
 
 // CHECK:      Relocations [
-// CHECK-NEXT:   Section ({{.*}}) .rela.dyn {
+// CHECK-NEXT:   Section ({{.*}}) .rela.plt {
 // CHECK-NEXT:     Relocation {
-// CHECK-NEXT:       Offset: [[ADDR]]
-// CHECK-NEXT:       Type: R_X86_64_64
+// CHECK-NEXT:       Offset: 0x120C8
+// CHECK-NEXT:       Type: R_X86_64_JUMP_SLOT
 // CHECK-NEXT:       Symbol: bar
-// CHECK-NEXT:       Addend: 0x42
+// CHECK-NEXT:       Addend: 0x0
 // CHECK-NEXT:     }
 // CHECK-NEXT:   }
 // CHECK-NEXT: ]
 
 // CHECK: DynamicSection [
 // CHECK-NEXT:  Tag                Type                 Name/Value
-// CHECK-NEXT:  0x0000000000000007 RELA                 [[RELAADDR]]
-// CHECK-NEXT:  0x0000000000000008 RELASZ               [[RELASIZE]] (bytes)
-// CHECK-NEXT:  0x0000000000000009 RELAENT              24 (bytes)
+// CHECK-NEXT:  0x0000000000000017 JMPREL
+// CHECK-NEXT:  0x0000000000000002 PLTRELSZ             24 (bytes)
+// CHECK-NEXT:  0x0000000000000003 PLTGOT
+// CHECK-NEXT:  0x0000000000000014 PLTREL               RELA
 // CHECK-NEXT:  0x0000000000000006 SYMTAB
 // CHECK-NEXT:  0x000000000000000B SYMENT               24 (bytes)
 // CHECK-NEXT:  0x0000000000000005 STRTAB
@@ -55,7 +56,6 @@
 // CHECK-NEXT:  0x0000000000000000 NULL                 0x0
 // CHECK-NEXT: ]
 
-
 .global _start
 _start:
 .quad bar + 0x42




More information about the llvm-commits mailing list