mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
bb363086e7
There are actually 2 different bugs: 1. TLS transition is broken in PIE mode. 2. TLS is broken in PIC/PIE mode when the __tls_get_addr symbol is versioned (as is the case on Linux and Solaris at least). The 1st bug is fixed by reverting the problematic change for now (note that the associated test doesn't pass on SPARC because of another issue so there is no formal regression in the testsuite). The 2nd bug is fixed by changing the call to _bfd_generic_link_add_one_symbol on __tls_get_addr into a mere lookup in _bfd_sparc_elf_check_relocs. bfd/ * elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>: Do a mere lookup of the __tls_get_addr symbol instead of adding it. Revert 2017-10-19 H.J. Lu <hongjiu.lu@intel.com> PR ld/22263 * elfxx-sparc.c (sparc_elf_tls_transition): Replace bfd_link_pic with !bfd_link_executable, !bfd_link_pic with bfd_link_executable for TLS check. (_bfd_sparc_elf_check_relocs): Likewise. (allocate_dynrelocs): Likewise. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * testsuite/ld-sparc/sparc.exp (32-bit: Helper shared library): Link with a version script. (32-bit: TLS -fpie): New test. (64-bit: Helper shared library): Link with a version script. (64-bit: TLS -fpie): New test. (64-bit: GOTDATA relocations): Pass -Av9 to the assembler. * testsuite/ld-sparc/tlslib.ver: New file. * testsuite/ld-sparc/tlspie32.dd: Likewise. * testsuite/ld-sparc/tlspie32.s: Likewise. * testsuite/ld-sparc/tlspie64.dd: Likewise. * testsuite/ld-sparc/tlspie64.s: Likewise. * testsuite/ld-sparc/tlssunbin32.dd: Adjust for versioned symbol. * testsuite/ld-sparc/tlssunbin32.rd: Likewise. * testsuite/ld-sparc/tlssunbin32.sd: Likewise. * testsuite/ld-sparc/tlssunbin64.dd: Likewise. * testsuite/ld-sparc/tlssunbin64.rd: Likewise. * testsuite/ld-sparc/tlssunbin64.sd: Likewise.
274 lines
8.9 KiB
Plaintext
274 lines
8.9 KiB
Plaintext
#source: tlssunbin32.s
|
|
#as: --32
|
|
#ld: -shared -melf32_sparc tmpdir/libtlslib32.so tmpdir/tlssunbinpic32.o
|
|
#objdump: -drj.text
|
|
#target: sparc*-*-*
|
|
|
|
.*: +file format elf32-sparc
|
|
|
|
Disassembly of section .text:
|
|
|
|
0+11000 <fn2-0x8>:
|
|
+11000: 81 c3 e0 08 retl *
|
|
+11004: ae 03 c0 17 add %o7, %l7, %l7
|
|
|
|
0+11008 <fn2>:
|
|
+11008: 9d e3 bf 98 save %sp, -104, %sp
|
|
+1100c: 2f 00 00 48 sethi %hi\(0x12000\), %l7
|
|
+11010: 7f ff ff fc call 11000 <.*>
|
|
+11014: ae 05 e2 7c add %l7, 0x27c, %l7 ! 1227c <.*>
|
|
+11018: 01 00 00 00 nop *
|
|
+1101c: 01 00 00 00 nop *
|
|
+11020: 01 00 00 00 nop *
|
|
+11024: 01 00 00 00 nop *
|
|
+11028: 23 00 00 00 sethi %hi\(0\), %l1
|
|
+1102c: 01 00 00 00 nop *
|
|
+11030: a4 04 60 10 add %l1, 0x10, %l2
|
|
+11034: 01 00 00 00 nop *
|
|
+11038: d0 05 c0 12 ld \[ %l7 \+ %l2 \], %o0
|
|
+1103c: 01 00 00 00 nop *
|
|
+11040: 01 00 00 00 nop *
|
|
+11044: 90 01 c0 08 add %g7, %o0, %o0
|
|
+11048: 01 00 00 00 nop *
|
|
+1104c: 01 00 00 00 nop *
|
|
+11050: 01 00 00 00 nop *
|
|
+11054: 01 00 00 00 nop *
|
|
+11058: 11 00 00 00 sethi %hi\(0\), %o0
|
|
+1105c: 92 02 20 08 add %o0, 8, %o1 ! 8 <.*>
|
|
+11060: d0 05 c0 09 ld \[ %l7 \+ %o1 \], %o0
|
|
+11064: 01 00 00 00 nop *
|
|
+11068: 90 01 c0 08 add %g7, %o0, %o0
|
|
+1106c: 01 00 00 00 nop *
|
|
+11070: 01 00 00 00 nop *
|
|
+11074: 01 00 00 00 nop *
|
|
+11078: 01 00 00 00 nop *
|
|
+1107c: 21 00 00 04 sethi %hi\(0x1000\), %l0
|
|
+11080: aa 1c 3f 60 xor %l0, -160, %l5
|
|
+11084: 90 01 c0 15 add %g7, %l5, %o0
|
|
+11088: 01 00 00 00 nop *
|
|
+1108c: 01 00 00 00 nop *
|
|
+11090: 01 00 00 00 nop *
|
|
+11094: 01 00 00 00 nop *
|
|
+11098: 01 00 00 00 nop *
|
|
+1109c: 01 00 00 00 nop *
|
|
+110a0: 11 00 00 00 sethi %hi\(0\), %o0
|
|
+110a4: 92 1a 3f 80 xor %o0, -128, %o1
|
|
+110a8: 90 01 c0 09 add %g7, %o1, %o0
|
|
+110ac: 01 00 00 00 nop *
|
|
+110b0: 01 00 00 00 nop *
|
|
+110b4: 01 00 00 00 nop *
|
|
+110b8: 01 00 00 00 nop *
|
|
+110bc: 01 00 00 00 nop *
|
|
+110c0: 01 00 00 00 nop *
|
|
+110c4: 11 00 00 00 sethi %hi\(0\), %o0
|
|
+110c8: 92 1a 3f a0 xor %o0, -96, %o1
|
|
+110cc: 90 01 c0 09 add %g7, %o1, %o0
|
|
+110d0: 01 00 00 00 nop *
|
|
+110d4: 01 00 00 00 nop *
|
|
+110d8: 01 00 00 00 nop *
|
|
+110dc: 01 00 00 00 nop *
|
|
+110e0: 01 00 00 00 nop *
|
|
+110e4: 01 00 00 00 nop *
|
|
+110e8: 01 00 00 00 nop *
|
|
+110ec: 01 00 00 00 nop *
|
|
+110f0: 01 00 00 00 nop *
|
|
+110f4: 01 00 00 00 nop *
|
|
+110f8: 01 00 00 00 nop *
|
|
+110fc: 01 00 00 00 nop *
|
|
+11100: 90 10 00 00 mov %g0, %o0
|
|
+11104: 01 00 00 00 nop *
|
|
+11108: 27 00 00 00 sethi %hi\(0\), %l3
|
|
+1110c: 01 00 00 00 nop *
|
|
+11110: a8 1c ff 80 xor %l3, -128, %l4
|
|
+11114: 01 00 00 00 nop *
|
|
+11118: aa 01 c0 14 add %g7, %l4, %l5
|
|
+1111c: 01 00 00 00 nop *
|
|
+11120: 25 00 00 00 sethi %hi\(0\), %l2
|
|
+11124: 01 00 00 00 nop *
|
|
+11128: a6 1c bf 86 xor %l2, -122, %l3
|
|
+1112c: 01 00 00 00 nop *
|
|
+11130: ec 11 c0 13 lduh \[ %g7 \+ %l3 \], %l6
|
|
+11134: 01 00 00 00 nop *
|
|
+11138: 01 00 00 00 nop *
|
|
+1113c: 01 00 00 00 nop *
|
|
+11140: 01 00 00 00 nop *
|
|
+11144: 01 00 00 00 nop *
|
|
+11148: 27 00 00 00 sethi %hi\(0\), %l3
|
|
+1114c: 01 00 00 00 nop *
|
|
+11150: 25 00 00 00 sethi %hi\(0\), %l2
|
|
+11154: 01 00 00 00 nop *
|
|
+11158: a8 1c ff a0 xor %l3, -96, %l4
|
|
+1115c: 90 10 00 00 mov %g0, %o0
|
|
+11160: a6 1c bf a5 xor %l2, -91, %l3
|
|
+11164: aa 01 c0 14 add %g7, %l4, %l5
|
|
+11168: ec 09 c0 13 ldub \[ %g7 \+ %l3 \], %l6
|
|
+1116c: 01 00 00 00 nop *
|
|
+11170: 01 00 00 00 nop *
|
|
+11174: 01 00 00 00 nop *
|
|
+11178: 01 00 00 00 nop *
|
|
+1117c: 23 00 00 00 sethi %hi\(0\), %l1
|
|
+11180: 01 00 00 00 nop *
|
|
+11184: a4 04 60 08 add %l1, 8, %l2
|
|
+11188: 01 00 00 00 nop *
|
|
+1118c: e4 05 c0 12 ld \[ %l7 \+ %l2 \], %l2
|
|
+11190: 01 00 00 00 nop *
|
|
+11194: a4 01 c0 12 add %g7, %l2, %l2
|
|
+11198: 01 00 00 00 nop *
|
|
+1119c: 01 00 00 00 nop *
|
|
+111a0: 01 00 00 00 nop *
|
|
+111a4: 01 00 00 00 nop *
|
|
+111a8: 17 00 00 04 sethi %hi\(0x1000\), %o3
|
|
+111ac: 96 1a ff 60 xor %o3, -160, %o3
|
|
+111b0: 01 00 00 00 nop *
|
|
+111b4: 98 01 c0 0b add %g7, %o3, %o4
|
|
+111b8: 01 00 00 00 nop *
|
|
+111bc: 01 00 00 00 nop *
|
|
+111c0: 01 00 00 00 nop *
|
|
+111c4: 01 00 00 00 nop *
|
|
+111c8: 29 00 00 00 sethi %hi\(0\), %l4
|
|
+111cc: a2 1d 3f 80 xor %l4, -128, %l1
|
|
+111d0: a6 10 00 11 mov %l1, %l3
|
|
+111d4: a6 01 c0 13 add %g7, %l3, %l3
|
|
+111d8: 01 00 00 00 nop *
|
|
+111dc: 01 00 00 00 nop *
|
|
+111e0: 01 00 00 00 nop *
|
|
+111e4: 01 00 00 00 nop *
|
|
+111e8: 13 00 00 00 sethi %hi\(0\), %o1
|
|
+111ec: 96 1a 7f a0 xor %o1, -96, %o3
|
|
+111f0: 90 10 00 0b mov %o3, %o0
|
|
+111f4: 96 01 c0 08 add %g7, %o0, %o3
|
|
+111f8: 01 00 00 00 nop *
|
|
+111fc: 01 00 00 00 nop *
|
|
+11200: 01 00 00 00 nop *
|
|
+11204: 01 00 00 00 nop *
|
|
+11208: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+1120c: 96 02 e0 04 add %o3, 4, %o3 ! 4 <.*>
|
|
+11210: d4 05 c0 0b ld \[ %l7 \+ %o3 \], %o2
|
|
+11214: d8 01 c0 0a ld \[ %g7 \+ %o2 \], %o4
|
|
+11218: 01 00 00 00 nop *
|
|
+1121c: 01 00 00 00 nop *
|
|
+11220: 01 00 00 00 nop *
|
|
+11224: 01 00 00 00 nop *
|
|
+11228: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+1122c: 96 1a ff 90 xor %o3, -112, %o3
|
|
+11230: 94 10 00 0b mov %o3, %o2
|
|
+11234: d8 29 c0 0a stb %o4, \[ %g7 \+ %o2 \]
|
|
+11238: 01 00 00 00 nop *
|
|
+1123c: 01 00 00 00 nop *
|
|
+11240: 01 00 00 00 nop *
|
|
+11244: 01 00 00 00 nop *
|
|
+11248: 1b 00 00 00 sethi %hi\(0\), %o5
|
|
+1124c: 96 1b 7f b0 xor %o5, -80, %o3
|
|
+11250: 94 10 00 0b mov %o3, %o2
|
|
+11254: d8 49 c0 0a ldsb \[ %g7 \+ %o2 \], %o4
|
|
+11258: 01 00 00 00 nop *
|
|
+1125c: 01 00 00 00 nop *
|
|
+11260: 01 00 00 00 nop *
|
|
+11264: 01 00 00 00 nop *
|
|
+11268: 81 c7 e0 08 ret *
|
|
+1126c: 81 e8 00 00 restore *
|
|
#...
|
|
|
|
00012000 <_start>:
|
|
+12000: 9d e3 bf 98 save %sp, -104, %sp
|
|
+12004: 29 00 00 8c sethi %hi\(0x23000\), %l4
|
|
+12008: a8 15 22 8c or %l4, 0x28c, %l4 ! 2328c <.*>
|
|
+1200c: 01 00 00 00 nop *
|
|
+12010: 01 00 00 00 nop *
|
|
+12014: 01 00 00 00 nop *
|
|
+12018: 01 00 00 00 nop *
|
|
+1201c: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+12020: 96 02 e0 0c add %o3, 0xc, %o3 ! c <.*>
|
|
+12024: d4 05 00 0b ld \[ %l4 \+ %o3 \], %o2
|
|
+12028: 98 01 c0 0a add %g7, %o2, %o4
|
|
+1202c: 01 00 00 00 nop *
|
|
+12030: 01 00 00 00 nop *
|
|
+12034: 01 00 00 00 nop *
|
|
+12038: 01 00 00 00 nop *
|
|
+1203c: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+12040: 9a 1a ff d4 xor %o3, -44, %o5
|
|
+12044: 94 10 00 0d mov %o5, %o2
|
|
+12048: 98 01 c0 0a add %g7, %o2, %o4
|
|
+1204c: 01 00 00 00 nop *
|
|
+12050: 01 00 00 00 nop *
|
|
+12054: 01 00 00 00 nop *
|
|
+12058: 01 00 00 00 nop *
|
|
+1205c: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+12060: 9a 1a ff f4 xor %o3, -12, %o5
|
|
+12064: a4 10 00 0d mov %o5, %l2
|
|
+12068: a4 01 c0 12 add %g7, %l2, %l2
|
|
+1206c: 01 00 00 00 nop *
|
|
+12070: 01 00 00 00 nop *
|
|
+12074: 01 00 00 00 nop *
|
|
+12078: 01 00 00 00 nop *
|
|
+1207c: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+12080: 9a 1a ff fc xor %o3, -4, %o5
|
|
+12084: a4 10 00 0d mov %o5, %l2
|
|
+12088: e4 01 c0 12 ld \[ %g7 \+ %l2 \], %l2
|
|
+1208c: 01 00 00 00 nop *
|
|
+12090: 01 00 00 00 nop *
|
|
+12094: 01 00 00 00 nop *
|
|
+12098: 01 00 00 00 nop *
|
|
+1209c: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+120a0: 9a 1a ff b4 xor %o3, -76, %o5
|
|
+120a4: a4 10 00 0d mov %o5, %l2
|
|
+120a8: a4 01 c0 12 add %g7, %l2, %l2
|
|
+120ac: 01 00 00 00 nop *
|
|
+120b0: 01 00 00 00 nop *
|
|
+120b4: 01 00 00 00 nop *
|
|
+120b8: 01 00 00 00 nop *
|
|
+120bc: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+120c0: 9a 1a ff fc xor %o3, -4, %o5
|
|
+120c4: a4 10 00 0d mov %o5, %l2
|
|
+120c8: e2 29 c0 12 stb %l1, \[ %g7 \+ %l2 \]
|
|
+120cc: 01 00 00 00 nop *
|
|
+120d0: 01 00 00 00 nop *
|
|
+120d4: 01 00 00 00 nop *
|
|
+120d8: 01 00 00 00 nop *
|
|
+120dc: 23 00 00 00 sethi %hi\(0\), %l1
|
|
+120e0: 01 00 00 00 nop *
|
|
+120e4: a4 1c 7f 64 xor %l1, -156, %l2
|
|
+120e8: 01 00 00 00 nop *
|
|
+120ec: a6 01 c0 12 add %g7, %l2, %l3
|
|
+120f0: 01 00 00 00 nop *
|
|
+120f4: 01 00 00 00 nop *
|
|
+120f8: 01 00 00 00 nop *
|
|
+120fc: 01 00 00 00 nop *
|
|
+12100: 11 00 00 00 sethi %hi\(0\), %o0
|
|
+12104: 90 1a 3f e6 xor %o0, -26, %o0
|
|
+12108: 90 01 c0 08 add %g7, %o0, %o0
|
|
+1210c: 01 00 00 00 nop *
|
|
+12110: 01 00 00 00 nop *
|
|
+12114: 01 00 00 00 nop *
|
|
+12118: 01 00 00 00 nop *
|
|
+1211c: 23 00 00 00 sethi %hi\(0\), %l1
|
|
+12120: 9a 1c 7f a5 xor %l1, -91, %o5
|
|
+12124: 92 01 c0 0d add %g7, %o5, %o1
|
|
+12128: 01 00 00 00 nop *
|
|
+1212c: 01 00 00 00 nop *
|
|
+12130: 01 00 00 00 nop *
|
|
+12134: 01 00 00 00 nop *
|
|
+12138: 23 00 00 00 sethi %hi\(0\), %l1
|
|
+1213c: 9a 1c 7f 68 xor %l1, -152, %o5
|
|
+12140: d2 01 c0 0d ld \[ %g7 \+ %o5 \], %o1
|
|
+12144: 01 00 00 00 nop *
|
|
+12148: 01 00 00 00 nop *
|
|
+1214c: 01 00 00 00 nop *
|
|
+12150: 01 00 00 00 nop *
|
|
+12154: 11 00 00 00 sethi %hi\(0\), %o0
|
|
+12158: 90 1a 3f eb xor %o0, -21, %o0
|
|
+1215c: d2 29 c0 08 stb %o1, \[ %g7 \+ %o0 \]
|
|
+12160: 01 00 00 00 nop *
|
|
+12164: 01 00 00 00 nop *
|
|
+12168: 01 00 00 00 nop *
|
|
+1216c: 01 00 00 00 nop *
|
|
+12170: 15 00 00 00 sethi %hi\(0\), %o2
|
|
+12174: 98 1a bf ab xor %o2, -85, %o4
|
|
+12178: da 69 c0 0c ldstub \[ %g7 \+ %o4 \], %o5
|
|
+1217c: 01 00 00 00 nop *
|
|
+12180: 01 00 00 00 nop *
|
|
+12184: 01 00 00 00 nop *
|
|
+12188: 01 00 00 00 nop *
|
|
+1218c: 81 c7 e0 08 ret *
|
|
+12190: 81 e8 00 00 restore *
|