mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-18 14:53:32 +08:00
f749f26eea
1) GOT entries generated for any of the GOT TLS relocations don't need dynamic relocations for locally defined symbols in PIEs. In the case of a tls_index doubleword, the dtpmod entry is known to be 1, and the dtprel entry is also known at link time and relative. Similarly, dtprel and tprel words are known at link time and relative. (GOT entries for other than TLS symbols are not relative and thus need dynamic relocations in PIEs.) 2) Local dynamic TLS code is really only meant for accesses local to the current binary. There was a cheapskate test for this before using the common tlsld_got slot, but the test wasn't exactly correct and might confuse anyone looking at the code. The proper test, SYMBOL_REFERENCES_LOCAL isn't so expensive that it should be avoided. 3) The same cheap test for local syms when optimising TLS sequences should be SYMBOL_REFERENCES_LOCAL too. bfd/ * elf64-ppc.c (ppc64_elf_check_relocs): Move initialisation of vars. (ppc64_elf_tls_optimize): Correct is_local condition. (allocate_got): Don't reserve dynamic relocations for any of the tls got relocs in PIEs when the symbol is local. (allocate_dynrelocs): Correct validity test for local sym using tlsld_got slot. (ppc64_elf_size_dynamic_sections): Don't reserve dynamic relocations for any of the tls got relocs in PIEs. (ppc64_elf_layout_multitoc): Likewise. (ppc64_elf_relocate_section): Correct validity test for local sym using tlsld_got slot. Don't emit dynamic relocations for any of the tls got relocs in PIEs when the symbol is local. * elf32-ppc.c (ppc_elf_tls_optimize): Correct is_local condition. (got_relocs_needed): Delete. (allocate_dynrelocs): Correct validity test for local sym using tlsld_got slot. Don't reserve dynamic relocations for any of the tls got relocs in PIEs when the symbol is local. (ppc_elf_size_dynamic_sections): Don't reserve dynamic relocations for any of the tls got relocs in PIEs. (ppc_elf_relocate_section): Correct validity test for local sym using tlsld_got slot. Don't emit dynamic relocations for any of the tls got relocs in PIEs when the symbol is local. ld/ * testsuite/ld-powerpc/tlsso.d: Adjust to suit tlsld_got usage change. * testsuite/ld-powerpc/tlsso.g: Likewise. * testsuite/ld-powerpc/tlsso.r: Likewise. * testsuite/ld-powerpc/tlsso32.d: Likewise. * testsuite/ld-powerpc/tlsso32.g: Likewise. * testsuite/ld-powerpc/tlsso32.r: Likewise.
68 lines
2.7 KiB
Makefile
68 lines
2.7 KiB
Makefile
#source: tls32.s
|
|
#as: -a32
|
|
#ld: -shared
|
|
#objdump: -dr
|
|
#target: powerpc*-*-*
|
|
|
|
.*
|
|
|
|
Disassembly of section \.text:
|
|
|
|
.* <_start>:
|
|
.*: (42 9f 00 05|05 00 9f 42) bcl 20,4\*cr7\+so,.* <_start\+0x4>
|
|
.*: (7f c8 02 a6|a6 02 c8 7f) mflr r30
|
|
.*: (3f de 00 02|02 00 de 3f) addis r30,r30,2
|
|
.*: (3b de 80 e8|e8 80 de 3b) addi r30,r30,-32536
|
|
.*: (38 7f ff d4|d4 ff 7f 38) addi r3,r31,-44
|
|
.*: (48 00 00 01|01 00 00 48) bl .*
|
|
.*: (38 7f ff e4|e4 ff 7f 38) addi r3,r31,-28
|
|
.*: (48 00 00 01|01 00 00 48) bl .*
|
|
.*: (38 7f ff ec|ec ff 7f 38) addi r3,r31,-20
|
|
.*: (48 00 00 5d|5d 00 00 48) bl .*<0+8000\.got2\.plt_pic32\.__tls_get_addr>
|
|
.*: (38 7f ff dc|dc ff 7f 38) addi r3,r31,-36
|
|
.*: (48 00 00 55|55 00 00 48) bl .*<0+8000\.got2\.plt_pic32\.__tls_get_addr>
|
|
.*: (39 23 80 20|20 80 23 39) addi r9,r3,-32736
|
|
.*: (3d 23 00 00|00 00 23 3d) addis r9,r3,0
|
|
.*: (81 49 80 24|24 80 49 81) lwz r10,-32732\(r9\)
|
|
.*: (81 3f ff f4|f4 ff 3f 81) lwz r9,-12\(r31\)
|
|
.*: (7d 49 12 2e|2e 12 49 7d) lhzx r10,r9,r2
|
|
.*: (89 42 00 00|00 00 42 89) lbz r10,0\(r2\)
|
|
.*: (3d 22 00 00|00 00 22 3d) addis r9,r2,0
|
|
.*: (99 49 00 00|00 00 49 99) stb r10,0\(r9\)
|
|
.*: (38 7e ff cc|cc ff 7e 38) addi r3,r30,-52
|
|
.*: (48 00 00 01|01 00 00 48) bl .*
|
|
.*: (38 7e ff f8|f8 ff 7e 38) addi r3,r30,-8
|
|
.*: (48 00 00 01|01 00 00 48) bl .*
|
|
.*: (91 43 80 04|04 80 43 91) stw r10,-32764\(r3\)
|
|
.*: (3d 23 00 00|00 00 23 3d) addis r9,r3,0
|
|
.*: (91 49 80 08|08 80 49 91) stw r10,-32760\(r9\)
|
|
.*: (81 3e ff f4|f4 ff 3e 81) lwz r9,-12\(r30\)
|
|
.*: (7d 49 13 2e|2e 13 49 7d) sthx r10,r9,r2
|
|
.*: (a1 42 00 00|00 00 42 a1) lhz r10,0\(r2\)
|
|
.*: (3d 22 00 00|00 00 22 3d) addis r9,r2,0
|
|
.*: (a9 49 00 00|00 00 49 a9) lha r10,0\(r9\)
|
|
|
|
.* <00008000.got2.plt_pic32.__tls_get_addr>:
|
|
.*: (81 7e 80 e8|e8 80 7e 81) lwz r11,-32536\(r30\)
|
|
.*: (7d 69 03 a6|a6 03 69 7d) mtctr r11
|
|
.*: (4e 80 04 20|20 04 80 4e) bctr
|
|
.*: (60 00 00 00|00 00 00 60) nop
|
|
|
|
.* <__glink>:
|
|
.*: (3d 6b 00 00|00 00 6b 3d) addis r11,r11,0
|
|
.*: (7c 08 02 a6|a6 02 08 7c) mflr r0
|
|
.*: (42 9f 00 05|05 00 9f 42) bcl .* <__glink\+0xc>
|
|
.*: (39 6b 00 0c|0c 00 6b 39) addi r11,r11,12
|
|
.*: (7d 88 02 a6|a6 02 88 7d) mflr r12
|
|
.*: (7c 08 03 a6|a6 03 08 7c) mtlr r0
|
|
.*: (7d 6c 58 50|50 58 6c 7d) subf r11,r12,r11
|
|
.*: (3d 8c 00 01|01 00 8c 3d) addis r12,r12,1
|
|
.*: (80 0c 01 30|30 01 0c 80) lwz r0,304\(r12\)
|
|
.*: (81 8c 01 34|34 01 8c 81) lwz r12,308\(r12\)
|
|
.*: (7c 09 03 a6|a6 03 09 7c) mtctr r0
|
|
.*: (7c 0b 5a 14|14 5a 0b 7c) add r0,r11,r11
|
|
.*: (7d 60 5a 14|14 5a 60 7d) add r11,r0,r11
|
|
.*: (4e 80 04 20|20 04 80 4e) bctr
|
|
.*: (60 00 00 00|00 00 00 60) nop
|
|
.*: (60 00 00 00|00 00 00 60) nop
|