mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
9a23f96e91
In the TLS GD/LD to LE optimization, ld replaces a sequence like addi 3,2,x@got@tlsgd R_PPC64_GOT_TLSGD16 x bl __tls_get_addr(x@tlsgd) R_PPC64_TLSGD x R_PPC64_REL24 __tls_get_addr nop with addis 3,13,x@tprel@ha R_PPC64_TPREL16_HA x addi 3,3,x@tprel@l R_PPC64_TPREL16_LO x nop When the tprel offset is small, this can be further optimized to nop addi 3,13,x@tprel nop bfd/ * elf64-ppc.c (struct ppc_link_hash_table): Add do_tls_opt. (ppc64_elf_tls_optimize): Set it. (ppc64_elf_relocate_section): Nop addis on TPREL16_HA, and convert insn on TPREL16_LO and TPREL16_LO_DS relocs to use r13 when addis would add zero. * elf32-ppc.c (struct ppc_elf_link_hash_table): Add do_tls_opt. (ppc_elf_tls_optimize): Set it. (ppc_elf_relocate_section): Nop addis on TPREL16_HA, and convert insn on TPREL16_LO relocs to use r2 when addis would add zero. gold/ * powerpc.cc (Target_powerpc::Relocate::relocate): Nop addis on TPREL16_HA, and convert insn on TPREL16_LO and TPREL16_LO_DS relocs to use r2/r13 when addis would add zero. ld/ * testsuite/ld-powerpc/tls.s: Add calls with tls markers. * testsuite/ld-powerpc/tls32.s: Likewise. * testsuite/ld-powerpc/powerpc.exp: Run tls marker tests. * testsuite/ld-powerpc/tls.d: Adjust for TPREL16_HA/LO optimization. * testsuite/ld-powerpc/tlsexe.d: Likewise. * testsuite/ld-powerpc/tlsexetoc.d: Likewise. * testsuite/ld-powerpc/tlsld.d: Likewise. * testsuite/ld-powerpc/tlsmark.d: Likewise. * testsuite/ld-powerpc/tlsopt4.d: Likewise. * testsuite/ld-powerpc/tlstoc.d: Likewise.
49 lines
1.3 KiB
Makefile
49 lines
1.3 KiB
Makefile
#source: tlsopt4.s
|
|
#source: tlslib.s
|
|
#as: -a64
|
|
#ld:
|
|
#objdump: -dr
|
|
#target: powerpc64*-*-*
|
|
|
|
.*
|
|
|
|
Disassembly of section \.text:
|
|
|
|
0+100000e8 <\.__tls_get_addr>:
|
|
.*: (4e 80 00 20|20 00 80 4e) blr
|
|
|
|
Disassembly of section \.opt1:
|
|
|
|
0+100000ec <\.opt1>:
|
|
.*: (60 00 00 00|00 00 00 60) nop
|
|
.*: (2c 24 00 00|00 00 24 2c) cmpdi r4,0
|
|
.*: (41 82 00 10|10 00 82 41) beq .*
|
|
.*: (38 6d 90 10|10 90 6d 38) addi r3,r13,-28656
|
|
.*: (60 00 00 00|00 00 00 60) nop
|
|
.*: (48 00 00 0c|0c 00 00 48) b .*
|
|
.*: (38 6d 90 10|10 90 6d 38) addi r3,r13,-28656
|
|
.*: (60 00 00 00|00 00 00 60) nop
|
|
|
|
Disassembly of section \.opt2:
|
|
|
|
0+1000010c <\.opt2>:
|
|
.*: (60 00 00 00|00 00 00 60) nop
|
|
.*: (2c 24 00 00|00 00 24 2c) cmpdi r4,0
|
|
.*: (41 82 00 08|08 00 82 41) beq .*
|
|
.*: (60 00 00 00|00 00 00 60) nop
|
|
.*: (38 6d 90 10|10 90 6d 38) addi r3,r13,-28656
|
|
.*: (60 00 00 00|00 00 00 60) nop
|
|
|
|
Disassembly of section \.opt3:
|
|
|
|
0+10000124 <\.opt3>:
|
|
.*: (60 00 00 00|00 00 00 60) nop
|
|
.*: (48 00 00 0c|0c 00 00 48) b .*
|
|
.*: (60 00 00 00|00 00 00 60) nop
|
|
.*: (48 00 00 10|10 00 00 48) b .*
|
|
.*: (38 6d 90 10|10 90 6d 38) addi r3,r13,-28656
|
|
.*: (60 00 00 00|00 00 00 60) nop
|
|
.*: (48 00 00 0c|0c 00 00 48) b .*
|
|
.*: (38 6d 90 08|08 90 6d 38) addi r3,r13,-28664
|
|
.*: (60 00 00 00|00 00 00 60) nop
|