Fix pr27420.

Return the right expression for R_X86_64_GOTPCRELX and
R_X86_64_REX_GOTPCRELX.

llvm-svn: 266810
This commit is contained in:
Rafael Espindola 2016-04-19 20:18:52 +00:00
parent a1d8bc5597
commit f350d25942
3 changed files with 19 additions and 0 deletions

View File

@ -651,6 +651,8 @@ RelExpr X86_64TargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const {
case R_X86_64_GOT32:
return R_GOT_FROM_END;
case R_X86_64_GOTPCREL:
case R_X86_64_GOTPCRELX:
case R_X86_64_REX_GOTPCRELX:
case R_X86_64_GOTTPOFF:
return R_GOT_PC;
}

Binary file not shown.

17
lld/test/ELF/gotpcrelx.s Normal file
View File

@ -0,0 +1,17 @@
// RUN: ld.lld %p/Inputs/gotpcrelx.o -o %t.so -shared
// RUN: llvm-readobj -s -r %t.so | FileCheck %s
// CHECK: Name: .got
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x2090
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
// CHECK-NEXT: 0x2090 R_X86_64_GLOB_DAT foo 0x0
// CHECK-NEXT: 0x2098 R_X86_64_GLOB_DAT bar 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]