[elf2][x86-64] Add support for DTPOFF32

llvm-svn: 252684
This commit is contained in:
Michael J. Spencer 2015-11-11 01:27:58 +00:00
parent 125e636b96
commit a5d9d1f154
2 changed files with 12 additions and 0 deletions

View File

@ -322,6 +322,7 @@ bool X86_64TargetInfo::isRelRelative(uint32_t Type) const {
case R_X86_64_PC16:
case R_X86_64_PC8:
case R_X86_64_PLT32:
case R_X86_64_DTPOFF32:
return true;
}
}
@ -346,6 +347,9 @@ void X86_64TargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
error("R_X86_64_32S out of range");
write32le(Loc, SA);
break;
case R_X86_64_DTPOFF32:
write32le(Loc, SA);
break;
case R_X86_64_TPOFF32: {
uint64_t Val = SA - Out<ELF64LE>::TlsPhdr->p_memsz;
if (!isInt<32>(Val))

View File

@ -8,14 +8,18 @@
callq __tls_get_addr@PLT
leaq b@tlsld(%rip), %rdi
callq __tls_get_addr@PLT
leaq a@dtpoff(%rax), %rcx
leaq b@dtpoff(%rax), %rcx
.global a
.hidden a
.section .tbss,"awT",@nobits
.align 4
a:
.long 0
.global b
.hidden b
.section .tbss,"awT",@nobits
.align 4
b:
@ -40,9 +44,13 @@ b:
// CHECK-NEXT: }
// 4297 = (0x20D0 + -4) - (0x1000 + 3) // PC relative offset to got entry.
// 4285 = (0x20D0 + -4) - (0x100c + 3) // PC relative offset to got entry.
// DIS: Disassembly of section .text:
// DIS-NEXT: .text:
// DIS-NEXT: 1000: {{.+}} leaq 4297(%rip), %rdi
// DIS-NEXT: 1007: {{.+}} callq
// DIS-NEXT: 100c: {{.+}} leaq 4285(%rip), %rdi
// DIS-NEXT: 1013: {{.+}} callq
// DIS-NEXT: 1018: {{.+}} leaq (%rax), %rcx
// DIS-NEXT: 101f: {{.+}} leaq 4(%rax), %rcx