forked from OSchip/llvm-project
[ELF][X86] Fix R_RELAX_TLS_GD_TO_LE_NEG and R_NEG_TLS after D62059
After D62059, we don't align p_memsz of PT_TLS to p_align. The getRelocTargetVA formula should align it instead. It becomes clear that R_NEG_TLS and R_TLS are opposite from each other. In i386-tls-le-align.s, I put ret after call ___tls_get_addr@plt as otherwise ld.bfd would reject the relaxation: TLS transition from R_386_TLS_GD to R_386_TLS_LE_32 against `a' at 0x3 in section `.text' failed llvm-svn: 361088
This commit is contained in:
parent
8803124d23
commit
898896836d
|
@ -752,7 +752,7 @@ static uint64_t getRelocTargetVA(const InputFile *File, RelType Type, int64_t A,
|
|||
return Sym.getVA(A) + getTlsTpOffset();
|
||||
case R_RELAX_TLS_GD_TO_LE_NEG:
|
||||
case R_NEG_TLS:
|
||||
return Out::TlsPhdr->p_memsz - Sym.getVA(A);
|
||||
return -(Sym.getVA(A) + getTlsTpOffset());
|
||||
case R_SIZE:
|
||||
return Sym.getSize() + A;
|
||||
case R_TLSDESC:
|
||||
|
|
|
@ -5,10 +5,23 @@
|
|||
|
||||
# -alignTo(p_memsz, p_align) = -alignTo(4, 64) = -64
|
||||
|
||||
# CHECK: movl %gs:0xffffffc0, %eax
|
||||
|
||||
# CHECK: movl %gs:0xffffffc0, %eax
|
||||
movl %gs:a@NTPOFF, %eax
|
||||
|
||||
# CHECK-NEXT: subl $0x40, %edx
|
||||
subl $a@tpoff, %edx
|
||||
|
||||
# GD to LE relaxation.
|
||||
# CHECK-NEXT: movl %gs:0x0, %eax
|
||||
# CHECK-NEXT: subl $0x40, %eax
|
||||
leal a@tlsgd(,%ebx,1), %eax
|
||||
call ___tls_get_addr@plt
|
||||
ret
|
||||
|
||||
.globl ___tls_get_addr
|
||||
.type ___tls_get_addr,@function
|
||||
___tls_get_addr:
|
||||
|
||||
.section .tbss,"awT"
|
||||
.align 64
|
||||
a:
|
||||
|
|
Loading…
Reference in New Issue