mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-21 04:42:53 +08:00
b86ac8e3a5
The linker hardcoded r3 into a local-dynamic to local-exec TLS optimization sequence. This is normally the case since r3 is required as a parameter to (the optimized out) __tls_get_addr call. However, it is possible for a compiler, LLVM in this case, to set up the parameter value in another register then copy it to r3 before the call. When fixing this problem, I noticed that ppc32 had another bug when optimizing away one of the TLS insns to a nop. The patch also tidies a mask used by global-dynamic to initial-exec TLS optimization, to just select the fields needed. Leaving the offset in the instruction wasn't a bug since it will be overwritten anyway. bfd/ * elf64-ppc.c (ppc64_elf_relocate_section): Correct GOT_TLSLD optimization. Tidy mask for GOT_TLSGD optimization. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. Correct location of nop zapping high insn too. ld/testsuite/ * ld-powerpc/tlsld.d, * ld-powerpc/tlsld.s: New test. * ld-powerpc/tlsld32.d, * ld-powerpc/tlsld32.s: New test. * ld-powerpc/powerpc.exp: Run them. Move tocvar and tocnovar.
49 lines
886 B
ArmAsm
49 lines
886 B
ArmAsm
.section ".opd","aw",@progbits
|
|
.p2align 3
|
|
.globl _start
|
|
_start:
|
|
.quad .L_start,.TOC.@tocbase,0
|
|
|
|
.text
|
|
.L_start:
|
|
addis 3,2,PrettyStackTraceHead@got@tlsld@ha
|
|
addi 29,3,PrettyStackTraceHead@got@tlsld@l
|
|
mr 3,29
|
|
bl __tls_get_addr(PrettyStackTraceHead@tlsld)
|
|
nop
|
|
addis 3,3,PrettyStackTraceHead@dtprel@ha
|
|
ld 3,PrettyStackTraceHead@dtprel@l(3)
|
|
nop
|
|
|
|
addi 29,2,PrettyStackTraceHead@got@tlsld
|
|
mr 3,29
|
|
bl __tls_get_addr(PrettyStackTraceHead@tlsld)
|
|
nop
|
|
ld 3,PrettyStackTraceHead@dtprel(3)
|
|
nop
|
|
nop
|
|
nop
|
|
|
|
addis 3,2,PrettyStackTraceHead@got@tlsgd@ha
|
|
addi 29,3,PrettyStackTraceHead@got@tlsgd@l
|
|
mr 3,29
|
|
bl __tls_get_addr(PrettyStackTraceHead@tlsgd)
|
|
nop
|
|
ld 3,0(3)
|
|
nop
|
|
nop
|
|
|
|
addi 29,2,PrettyStackTraceHead@got@tlsgd
|
|
mr 3,29
|
|
bl __tls_get_addr(PrettyStackTraceHead@tlsgd)
|
|
nop
|
|
ld 3,0(3)
|
|
nop
|
|
nop
|
|
nop
|
|
|
|
.section ".tbss","awT",@nobits
|
|
.align 3
|
|
PrettyStackTraceHead:
|
|
.space 8
|