From bb363086e7743506d78bc6b1e56face0fb1fc93f Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 25 Jan 2018 12:16:06 +0100 Subject: [PATCH] Fix PR ld/22727 (TLS breakage in PIC/PIE mode on SPARC). 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) : Do a mere lookup of the __tls_get_addr symbol instead of adding it. Revert 2017-10-19 H.J. Lu 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. --- bfd/ChangeLog | 17 ++++++ bfd/elfxx-sparc.c | 31 ++++------ ld/ChangeLog | 20 ++++++ ld/testsuite/ld-sparc/sparc.exp | 14 ++++- ld/testsuite/ld-sparc/tlslib.ver | 4 ++ ld/testsuite/ld-sparc/tlspie32.dd | 18 ++++++ ld/testsuite/ld-sparc/tlspie32.s | 20 ++++++ ld/testsuite/ld-sparc/tlspie64.dd | 18 ++++++ ld/testsuite/ld-sparc/tlspie64.s | 20 ++++++ ld/testsuite/ld-sparc/tlssunbin32.dd | 4 +- ld/testsuite/ld-sparc/tlssunbin32.rd | 114 ++++++++++++++++++----------------- ld/testsuite/ld-sparc/tlssunbin32.sd | 4 +- ld/testsuite/ld-sparc/tlssunbin64.dd | 4 +- ld/testsuite/ld-sparc/tlssunbin64.rd | 114 ++++++++++++++++++----------------- ld/testsuite/ld-sparc/tlssunbin64.sd | 6 +- 15 files changed, 268 insertions(+), 140 deletions(-) create mode 100644 ld/testsuite/ld-sparc/tlslib.ver create mode 100644 ld/testsuite/ld-sparc/tlspie32.dd create mode 100644 ld/testsuite/ld-sparc/tlspie32.s create mode 100644 ld/testsuite/ld-sparc/tlspie64.dd create mode 100644 ld/testsuite/ld-sparc/tlspie64.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b9fed6f..ba9074e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,20 @@ +2018-01-25 Eric Botcazou + + PR ld/22727 + * elfxx-sparc.c (_bfd_sparc_elf_check_relocs) : + Do a mere lookup of the __tls_get_addr symbol instead of adding it. + + Revert + 2017-10-19 H.J. Lu + + 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. + 2018-01-24 Renlin Li * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Add support for diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index f99d052..9f9feda 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -1333,7 +1333,7 @@ sparc_elf_tls_transition (struct bfd_link_info *info, bfd *abfd, && ! _bfd_sparc_elf_tdata (abfd)->has_tlsgd) r_type = R_SPARC_REV32; - if (!bfd_link_executable (info)) + if (bfd_link_pic (info)) return r_type; switch (r_type) @@ -1505,13 +1505,13 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_SPARC_TLS_LE_HIX22: case R_SPARC_TLS_LE_LOX10: - if (!bfd_link_executable (info)) + if (bfd_link_pic (info)) goto r_sparc_plt32; break; case R_SPARC_TLS_IE_HI22: case R_SPARC_TLS_IE_LO10: - if (!bfd_link_executable (info)) + if (bfd_link_pic (info)) info->flags |= DF_STATIC_TLS; /* Fall through */ @@ -1625,18 +1625,13 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_SPARC_TLS_GD_CALL: case R_SPARC_TLS_LDM_CALL: - if (!bfd_link_executable (info)) + if (bfd_link_pic (info)) { /* These are basically R_SPARC_TLS_WPLT30 relocs against __tls_get_addr. */ - struct bfd_link_hash_entry *bh = NULL; - if (! _bfd_generic_link_add_one_symbol (info, abfd, - "__tls_get_addr", 0, - bfd_und_section_ptr, 0, - NULL, FALSE, FALSE, - &bh)) - return FALSE; - h = (struct elf_link_hash_entry *) bh; + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (info->hash, "__tls_get_addr", TRUE, + FALSE, TRUE); } else break; @@ -2232,7 +2227,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* If R_SPARC_TLS_IE_{HI22,LO10} symbol is now local to the binary, make it a R_SPARC_TLS_LE_{HI22,LO10} requiring no TLS entry. */ if (h->got.refcount > 0 - && bfd_link_executable (info) + && !bfd_link_pic (info) && h->dynindx == -1 && _bfd_sparc_elf_hash_entry(h)->tls_type == GOT_TLS_IE) h->got.offset = (bfd_vma) -1; @@ -3576,7 +3571,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, else if (h != NULL) { tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type; - if (bfd_link_executable (info) + if (!bfd_link_pic (info) && h->dynindx == -1 && tls_type == GOT_TLS_IE) switch (SPARC_ELF_R_TYPE (rel->r_info)) @@ -3723,7 +3718,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, case R_SPARC_TLS_LE_HIX22: case R_SPARC_TLS_LE_LOX10: - if (!bfd_link_executable (info)) + if (bfd_link_pic (info)) { Elf_Internal_Rela outrel; bfd_boolean skip; @@ -3755,7 +3750,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, break; case R_SPARC_TLS_LDM_CALL: - if (bfd_link_executable (info)) + if (! bfd_link_pic (info)) { /* mov %g0, %o0 */ bfd_put_32 (output_bfd, 0x90100000, contents + rel->r_offset); @@ -3769,7 +3764,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx]; else if (h != NULL) tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type; - if (bfd_link_executable (info) + if (! bfd_link_pic (info) || (r_type == R_SPARC_TLS_GD_CALL && tls_type == GOT_TLS_IE)) { Elf_Internal_Rela *rel2; @@ -3878,7 +3873,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, case R_SPARC_TLS_IE_LD: case R_SPARC_TLS_IE_LDX: - if (bfd_link_executable (info) && (h == NULL || h->dynindx == -1)) + if (! bfd_link_pic (info) && (h == NULL || h->dynindx == -1)) { bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset); int rs2 = insn & 0x1f; diff --git a/ld/ChangeLog b/ld/ChangeLog index 5271a6a..b641638 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,23 @@ +2018-01-25 Eric Botcazou + + * 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. + 2018-01-24 Renlin Li * testsuite/ld-aarch64/aarch64-elf.exp: Run new testes. diff --git a/ld/testsuite/ld-sparc/sparc.exp b/ld/testsuite/ld-sparc/sparc.exp index 1f87c93..e8aa0c2 100644 --- a/ld/testsuite/ld-sparc/sparc.exp +++ b/ld/testsuite/ld-sparc/sparc.exp @@ -74,7 +74,8 @@ set sparctests { {{readelf -WSsrl tlssunpic32.rd} {objdump -drj.text tlssunpic32.dd} {objdump -sj.got tlssunpic32.sd} {objdump -sj.tdata tlssunpic32.td}} "libtlssunpic32.so"} - {"32-bit: Helper shared library" "-shared -melf32_sparc" "" + {"32-bit: Helper shared library" + "-shared -melf32_sparc -version-script tlslib.ver" "" "--32 -K PIC" {tlslib.s} {} "libtlslib32.so"} {"32-bit: Another helper shared library" "-shared -melf32_sparc" "" "--32 -K PIC" {tlssunbinpic32.s} {} "libtlssunbinpic32.so"} @@ -92,6 +93,9 @@ set sparctests { {"32-bit: TLS in debug sections" "-melf32_sparc" "" "--32" {tlsg32.s} {{objdump -sj.debug_foobar tlsg32.sd}} "tlsg32"} + {"32-bit: TLS -fpie" "-melf32_sparc -pie tmpdir/libtlslib32.so" "" + "--32 -K PIC" {tlspie32.s} + {{objdump -drj.text tlspie32.dd}} "tlspie32"} {"32-bit: GOTDATA relocations" "-shared -melf32_sparc --hash-style=sysv" "" "--32 -K PIC" {gotop32.s} @@ -109,7 +113,8 @@ set sparc64tests { {{readelf -WSsrl tlssunpic64.rd} {objdump -drj.text tlssunpic64.dd} {objdump -sj.got tlssunpic64.sd} {objdump -sj.tdata tlssunpic64.td}} "libtlssunpic64.so"} - {"64-bit: Helper shared library" "-shared -melf64_sparc" "" + {"64-bit: Helper shared library" + "-shared -melf64_sparc -version-script tlslib.ver" "" "--64 -Av9 -K PIC" {tlslib.s} {} "libtlslib64.so"} {"64-bit: Another helper shared library" "-shared -melf64_sparc" "" "--64 -Av9 -K PIC" {tlssunbinpic64.s} {} "libtlssunbinpic64.so"} @@ -127,9 +132,12 @@ set sparc64tests { {"64-bit: TLS in debug sections" "-melf64_sparc" "" "--64 -Av9" {tlsg64.s} {{objdump -sj.debug_foobar tlsg64.sd}} "tlsg64"} + {"64-bit: TLS -fpie" "-melf64_sparc -pie tmpdir/libtlslib64.so" "" + "--64 -Av9 -K PIC" {tlspie64.s} + {{objdump -drj.text tlspie64.dd}} "tlspie64"} {"64-bit: GOTDATA relocations" "-shared -melf64_sparc --hash-style=sysv" "" - "--64 -K PIC" {gotop64.s} + "--64 -Av9 -K PIC" {gotop64.s} {{readelf -WSsrl gotop64.rd} {objdump -drj.text gotop64.dd} {objdump -sj.got gotop64.sd} {objdump -sj.data gotop64.td}} "libgotop64.so"} diff --git a/ld/testsuite/ld-sparc/tlslib.ver b/ld/testsuite/ld-sparc/tlslib.ver new file mode 100644 index 0000000..40e4063 --- /dev/null +++ b/ld/testsuite/ld-sparc/tlslib.ver @@ -0,0 +1,4 @@ +SUNWprivate_1.1 { + global: + __tls_get_addr; +}; diff --git a/ld/testsuite/ld-sparc/tlspie32.dd b/ld/testsuite/ld-sparc/tlspie32.dd new file mode 100644 index 0000000..c31bcf5 --- /dev/null +++ b/ld/testsuite/ld-sparc/tlspie32.dd @@ -0,0 +1,18 @@ +#source: tlspie32.s +#source: tlspic.s +#as: --32 -K PIC +#ld: -shared -melf32_sparc +#objdump: -drj.text +#target: sparc*-*-* + +.*: +file format elf32-sparc + + +Disassembly of section .text: + +0[0-9a-f]+ : + +[0-9a-f]+: 03 00 00 00 sethi %hi\(0\), %g1 + +[0-9a-f]+: 82 00 60 04 add %g1, 4, %g1 ! 4 + +[0-9a-f]+: 90 05 c0 01 add %l7, %g1, %o0 + +[0-9a-f]+: 40 00 40 43 call [0-9a-f]+ <__tls_get_addr@plt> + +[0-9a-f]+: 01 00 00 00 nop diff --git a/ld/testsuite/ld-sparc/tlspie32.s b/ld/testsuite/ld-sparc/tlspie32.s new file mode 100644 index 0000000..4d38d30 --- /dev/null +++ b/ld/testsuite/ld-sparc/tlspie32.s @@ -0,0 +1,20 @@ + .section ".text" + .global tls_gd + .section .tbss,"awT",@nobits + .align 4 + .type tls_gd, #object + .size tls_gd, 4 +tls_gd: + .skip 4 + .section ".text" + .align 4 + .global get_gdp + .type get_gdp, #function + .proc 0104 +get_gdp: + sethi %tgd_hi22(tls_gd), %g1 + add %g1, %tgd_lo10(tls_gd), %g1 + add %l7, %g1, %o0, %tgd_add(tls_gd) + call __tls_get_addr, %tgd_call(tls_gd) + nop + .size get_gdp, .-get_gdp diff --git a/ld/testsuite/ld-sparc/tlspie64.dd b/ld/testsuite/ld-sparc/tlspie64.dd new file mode 100644 index 0000000..bc4532e --- /dev/null +++ b/ld/testsuite/ld-sparc/tlspie64.dd @@ -0,0 +1,18 @@ +#source: tlspie64.s +#source: tlspic.s +#as: --64 -Av9 -K PIC +#ld: -shared -melf64_sparc +#objdump: -drj.text +#target: sparc*-*-* + +.*: +file format elf64-sparc + + +Disassembly of section .text: + +0[0-9a-f]+ : + +[0-9a-f]+: 03 00 00 00 sethi %hi\(0\), %g1 + +[0-9a-f]+: 82 00 60 08 add %g1, 8, %g1 ! 8 + +[0-9a-f]+: 90 05 c0 01 add %l7, %g1, %o0 + +[0-9a-f]+: 40 04 00 bb call [0-9a-f]+ <__tls_get_addr@plt> + +[0-9a-f]+: 01 00 00 00 nop diff --git a/ld/testsuite/ld-sparc/tlspie64.s b/ld/testsuite/ld-sparc/tlspie64.s new file mode 100644 index 0000000..4d38d30 --- /dev/null +++ b/ld/testsuite/ld-sparc/tlspie64.s @@ -0,0 +1,20 @@ + .section ".text" + .global tls_gd + .section .tbss,"awT",@nobits + .align 4 + .type tls_gd, #object + .size tls_gd, 4 +tls_gd: + .skip 4 + .section ".text" + .align 4 + .global get_gdp + .type get_gdp, #function + .proc 0104 +get_gdp: + sethi %tgd_hi22(tls_gd), %g1 + add %g1, %tgd_lo10(tls_gd), %g1 + add %l7, %g1, %o0, %tgd_add(tls_gd) + call __tls_get_addr, %tgd_call(tls_gd) + nop + .size get_gdp, .-get_gdp diff --git a/ld/testsuite/ld-sparc/tlssunbin32.dd b/ld/testsuite/ld-sparc/tlssunbin32.dd index c31d190..ce8b174 100644 --- a/ld/testsuite/ld-sparc/tlssunbin32.dd +++ b/ld/testsuite/ld-sparc/tlssunbin32.dd @@ -16,7 +16,7 @@ Disassembly of section .text: +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 64 add %l7, 0x264, %l7 ! 12264 <.*> + +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 * @@ -172,7 +172,7 @@ Disassembly of section .text: 00012000 <_start>: +12000: 9d e3 bf 98 save %sp, -104, %sp +12004: 29 00 00 8c sethi %hi\(0x23000\), %l4 - +12008: a8 15 22 74 or %l4, 0x274, %l4 ! 23274 <.*> + +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 * diff --git a/ld/testsuite/ld-sparc/tlssunbin32.rd b/ld/testsuite/ld-sparc/tlssunbin32.rd index 678a4a1..75e40e5 100644 --- a/ld/testsuite/ld-sparc/tlssunbin32.rd +++ b/ld/testsuite/ld-sparc/tlssunbin32.rd @@ -13,12 +13,14 @@ Section Headers: +\[[ 0-9]+\] .hash +.* +\[[ 0-9]+\] .dynsym +.* +\[[ 0-9]+\] .dynstr +.* + +\[[ 0-9]+\] .gnu.version +.* + +\[[ 0-9]+\] .gnu.version_r +.* +\[[ 0-9]+\] .rela.dyn +.* +\[[ 0-9]+\] .text +PROGBITS +0+11000 0+1000 0+1194 00 +AX +0 +0 4096 +\[[ 0-9]+\] .tdata +PROGBITS +0+22194 0+2194 0+1060 00 WAT +0 +0 +4 +\[[ 0-9]+\] .tbss +NOBITS +0+231f4 0+31f4 0+40 00 WAT +0 +0 +4 - +\[[ 0-9]+\] .dynamic +DYNAMIC +0+231f4 0+31f4 0+80 08 +WA +4 +0 +4 - +\[[ 0-9]+\] .got +PROGBITS +0+23274 0+3274 0+14 04 +WA +0 +0 +4 + +\[[ 0-9]+\] .dynamic +DYNAMIC +0+231f4 0+31f4 0+98 08 +WA +4 +0 +4 + +\[[ 0-9]+\] .got +PROGBITS +0+2328c 0+328c 0+14 04 +WA +0 +0 +4 +\[[ 0-9]+\] .symtab +.* +\[[ 0-9]+\] .strtab +.* +\[[ 0-9]+\] .shstrtab +.* @@ -51,12 +53,12 @@ Symbol table '\.dynsym' contains [0-9]+ entries: .* NOTYPE +LOCAL +DEFAULT +UND * .* TLS +GLOBAL +DEFAULT +UND sG5 .* TLS +GLOBAL +DEFAULT +UND sG2 -.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr -.* NOTYPE +GLOBAL +DEFAULT +10 __bss_start +.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr@SUNWprivate_1.1 \(2\) +.* NOTYPE +GLOBAL +DEFAULT +12 __bss_start .* TLS +GLOBAL +DEFAULT +UND sG6 .* TLS +GLOBAL +DEFAULT +UND sG1 -.* NOTYPE +GLOBAL +DEFAULT +10 _edata -.* NOTYPE +GLOBAL +DEFAULT +10 _end +.* NOTYPE +GLOBAL +DEFAULT +12 _edata +.* NOTYPE +GLOBAL +DEFAULT +12 _end Symbol table '\.symtab' contains [0-9]+ entries: +Num: +Value +Size +Type +Bind +Vis +Ndx +Name @@ -71,59 +73,61 @@ Symbol table '\.symtab' contains [0-9]+ entries: .* SECTION +LOCAL +DEFAULT +8 * .* SECTION +LOCAL +DEFAULT +9 * .* SECTION +LOCAL +DEFAULT +10 * +.* SECTION +LOCAL +DEFAULT +11 * +.* SECTION +LOCAL +DEFAULT +12 * .* FILE +LOCAL +DEFAULT +ABS .* -.* TLS +LOCAL +DEFAULT +7 sl1 -.* TLS +LOCAL +DEFAULT +7 sl2 -.* TLS +LOCAL +DEFAULT +7 sl3 -.* TLS +LOCAL +DEFAULT +7 sl4 -.* TLS +LOCAL +DEFAULT +7 sl5 -.* TLS +LOCAL +DEFAULT +7 sl6 -.* TLS +LOCAL +DEFAULT +7 sl7 -.* TLS +LOCAL +DEFAULT +7 sl8 +.* TLS +LOCAL +DEFAULT +9 sl1 +.* TLS +LOCAL +DEFAULT +9 sl2 +.* TLS +LOCAL +DEFAULT +9 sl3 +.* TLS +LOCAL +DEFAULT +9 sl4 +.* TLS +LOCAL +DEFAULT +9 sl5 +.* TLS +LOCAL +DEFAULT +9 sl6 +.* TLS +LOCAL +DEFAULT +9 sl7 +.* TLS +LOCAL +DEFAULT +9 sl8 .* FILE +LOCAL +DEFAULT +ABS .* -.* TLS +LOCAL +DEFAULT +8 bl1 -.* TLS +LOCAL +DEFAULT +8 bl2 -.* TLS +LOCAL +DEFAULT +8 bl3 -.* TLS +LOCAL +DEFAULT +8 bl4 -.* TLS +LOCAL +DEFAULT +8 bl5 -.* TLS +LOCAL +DEFAULT +8 bl6 -.* TLS +LOCAL +DEFAULT +8 bl7 -.* TLS +LOCAL +DEFAULT +8 bl8 +.* TLS +LOCAL +DEFAULT +10 bl1 +.* TLS +LOCAL +DEFAULT +10 bl2 +.* TLS +LOCAL +DEFAULT +10 bl3 +.* TLS +LOCAL +DEFAULT +10 bl4 +.* TLS +LOCAL +DEFAULT +10 bl5 +.* TLS +LOCAL +DEFAULT +10 bl6 +.* TLS +LOCAL +DEFAULT +10 bl7 +.* TLS +LOCAL +DEFAULT +10 bl8 .* FILE +LOCAL +DEFAULT +ABS .* -.* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC -.* OBJECT +LOCAL +DEFAULT +10 _PROCEDURE_LINKAGE_TABLE_ -.* OBJECT +LOCAL +DEFAULT +10 _GLOBAL_OFFSET_TABLE_ -.* TLS +GLOBAL +DEFAULT +7 sg8 -.* TLS +GLOBAL +DEFAULT +8 bg8 -.* TLS +GLOBAL +DEFAULT +8 bg6 +.* OBJECT +LOCAL +DEFAULT +11 _DYNAMIC +.* OBJECT +LOCAL +DEFAULT +12 _PROCEDURE_LINKAGE_TABLE_ +.* OBJECT +LOCAL +DEFAULT +12 _GLOBAL_OFFSET_TABLE_ +.* TLS +GLOBAL +DEFAULT +9 sg8 +.* TLS +GLOBAL +DEFAULT +10 bg8 +.* TLS +GLOBAL +DEFAULT +10 bg6 .* TLS +GLOBAL +DEFAULT +UND sG5 -.* TLS +GLOBAL +DEFAULT +8 bg3 -.* TLS +GLOBAL +DEFAULT +7 sg3 -.* TLS +GLOBAL +HIDDEN +7 sh3 +.* TLS +GLOBAL +DEFAULT +10 bg3 +.* TLS +GLOBAL +DEFAULT +9 sg3 +.* TLS +GLOBAL +HIDDEN +9 sh3 .* TLS +GLOBAL +DEFAULT +UND sG2 -.* TLS +GLOBAL +DEFAULT +7 sg4 -.* TLS +GLOBAL +DEFAULT +7 sg5 -.* TLS +GLOBAL +DEFAULT +8 bg5 -.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr -.* TLS +GLOBAL +HIDDEN +7 sh7 -.* TLS +GLOBAL +HIDDEN +7 sh8 -.* TLS +GLOBAL +DEFAULT +7 sg1 -.* FUNC +GLOBAL +DEFAULT +6 _start -.* TLS +GLOBAL +HIDDEN +7 sh4 -.* TLS +GLOBAL +DEFAULT +8 bg7 -.* TLS +GLOBAL +HIDDEN +7 sh5 -.* NOTYPE +GLOBAL +DEFAULT +10 __bss_start +.* TLS +GLOBAL +DEFAULT +9 sg4 +.* TLS +GLOBAL +DEFAULT +9 sg5 +.* TLS +GLOBAL +DEFAULT +10 bg5 +.* TLS +GLOBAL +HIDDEN +9 sh7 +.* TLS +GLOBAL +HIDDEN +9 sh8 +.* TLS +GLOBAL +DEFAULT +9 sg1 +.* FUNC +GLOBAL +DEFAULT +8 _start +.* TLS +GLOBAL +HIDDEN +9 sh4 +.* TLS +GLOBAL +DEFAULT +10 bg7 +.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr@@SUNWprivate_1.1 +.* TLS +GLOBAL +HIDDEN +9 sh5 +.* NOTYPE +GLOBAL +DEFAULT +12 __bss_start .* TLS +GLOBAL +DEFAULT +UND sG6 -.* FUNC +GLOBAL +DEFAULT +6 fn2 -.* TLS +GLOBAL +DEFAULT +7 sg2 +.* FUNC +GLOBAL +DEFAULT +8 fn2 +.* TLS +GLOBAL +DEFAULT +9 sg2 .* TLS +GLOBAL +DEFAULT +UND sG1 -.* TLS +GLOBAL +HIDDEN +7 sh1 -.* TLS +GLOBAL +DEFAULT +7 sg6 -.* TLS +GLOBAL +DEFAULT +7 sg7 -.* NOTYPE +GLOBAL +DEFAULT +10 _edata -.* NOTYPE +GLOBAL +DEFAULT +10 _end -.* TLS +GLOBAL +HIDDEN +7 sh2 -.* TLS +GLOBAL +HIDDEN +7 sh6 -.* TLS +GLOBAL +DEFAULT +8 bg2 -.* TLS +GLOBAL +DEFAULT +8 bg1 -.* TLS +GLOBAL +DEFAULT +8 bg4 +.* TLS +GLOBAL +HIDDEN +9 sh1 +.* TLS +GLOBAL +DEFAULT +9 sg6 +.* TLS +GLOBAL +DEFAULT +9 sg7 +.* NOTYPE +GLOBAL +DEFAULT +12 _edata +.* NOTYPE +GLOBAL +DEFAULT +12 _end +.* TLS +GLOBAL +HIDDEN +9 sh2 +.* TLS +GLOBAL +HIDDEN +9 sh6 +.* TLS +GLOBAL +DEFAULT +10 bg2 +.* TLS +GLOBAL +DEFAULT +10 bg1 +.* TLS +GLOBAL +DEFAULT +10 bg4 diff --git a/ld/testsuite/ld-sparc/tlssunbin32.sd b/ld/testsuite/ld-sparc/tlssunbin32.sd index 7db88c9..6c5509e 100644 --- a/ld/testsuite/ld-sparc/tlssunbin32.sd +++ b/ld/testsuite/ld-sparc/tlssunbin32.sd @@ -7,5 +7,5 @@ .*: +file format elf32-sparc Contents of section .got: - 23274 000231f4 0+ 0+ 0+ .* - 23284 0+ .* + 2328c 000231f4 0+ 0+ 0+ .* + 2329c 0+ .* diff --git a/ld/testsuite/ld-sparc/tlssunbin64.dd b/ld/testsuite/ld-sparc/tlssunbin64.dd index bc6b761..5893556 100644 --- a/ld/testsuite/ld-sparc/tlssunbin64.dd +++ b/ld/testsuite/ld-sparc/tlssunbin64.dd @@ -16,7 +16,7 @@ Disassembly of section .text: +101008: 9d e3 bf 60 save %sp, -160, %sp +10100c: 2f 00 04 04 sethi %hi\(0x101000\), %l7 +101010: 7f ff ff fc call 101000 <.*> - +101014: ae 05 e2 f8 add %l7, 0x2f8, %l7 ! 1012f8 <.*> + +101014: ae 05 e3 28 add %l7, 0x328, %l7 ! 101328 <.*> +101018: 01 00 00 00 nop * +10101c: 01 00 00 00 nop * +101020: 01 00 00 00 nop * @@ -174,7 +174,7 @@ Disassembly of section .text: +102004: 23 00 00 00 sethi %hi\(0\), %l1 +102008: 25 00 08 08 sethi %hi\(0x202000\), %l2 +10200c: a2 14 60 00 mov %l1, %l1 - +102010: a4 14 a3 08 or %l2, 0x308, %l2 + +102010: a4 14 a3 38 or %l2, 0x338, %l2 +102014: a3 2c 70 20 sllx %l1, 0x20, %l1 +102018: a8 04 40 12 add %l1, %l2, %l4 +10201c: 01 00 00 00 nop * diff --git a/ld/testsuite/ld-sparc/tlssunbin64.rd b/ld/testsuite/ld-sparc/tlssunbin64.rd index 420d595..2956cfe 100644 --- a/ld/testsuite/ld-sparc/tlssunbin64.rd +++ b/ld/testsuite/ld-sparc/tlssunbin64.rd @@ -13,12 +13,14 @@ Section Headers: +\[[ 0-9]+\] .hash +.* +\[[ 0-9]+\] .dynsym +.* +\[[ 0-9]+\] .dynstr +.* + +\[[ 0-9]+\] .gnu.version +.* + +\[[ 0-9]+\] .gnu.version_r +.* +\[[ 0-9]+\] .rela.dyn +.* +\[[ 0-9]+\] .text +PROGBITS +0+101000 0+1000 0+11a4 00 +AX +0 +0 4096 +\[[ 0-9]+\] .tdata +PROGBITS +0+2021a4 0+21a4 0+0060 00 WAT +0 +0 +4 +\[[ 0-9]+\] .tbss +NOBITS +0+202204 0+2204 0+40 00 WAT +0 +0 +4 - +\[[ 0-9]+\] .dynamic +DYNAMIC +0+202208 0+2208 0+100 10 +WA +4 +0 +8 - +\[[ 0-9]+\] .got +PROGBITS +0+202308 0+2308 0+28 08 +WA +0 +0 +8 + +\[[ 0-9]+\] .dynamic +DYNAMIC +0+202208 0+2208 0+130 10 +WA +4 +0 +8 + +\[[ 0-9]+\] .got +PROGBITS +0+202338 0+2338 0+28 08 +WA +0 +0 +8 +\[[ 0-9]+\] .symtab +.* +\[[ 0-9]+\] .strtab +.* +\[[ 0-9]+\] .shstrtab +.* @@ -51,12 +53,12 @@ Symbol table '\.dynsym' contains [0-9]+ entries: .* NOTYPE +LOCAL +DEFAULT +UND * .* TLS +GLOBAL +DEFAULT +UND sG5 .* TLS +GLOBAL +DEFAULT +UND sG2 -.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr -.* NOTYPE +GLOBAL +DEFAULT +10 __bss_start +.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr@SUNWprivate_1.1 \(2\) +.* NOTYPE +GLOBAL +DEFAULT +12 __bss_start .* TLS +GLOBAL +DEFAULT +UND sG6 .* TLS +GLOBAL +DEFAULT +UND sG1 -.* NOTYPE +GLOBAL +DEFAULT +10 _edata -.* NOTYPE +GLOBAL +DEFAULT +10 _end +.* NOTYPE +GLOBAL +DEFAULT +12 _edata +.* NOTYPE +GLOBAL +DEFAULT +12 _end Symbol table '\.symtab' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name @@ -71,59 +73,61 @@ Symbol table '\.symtab' contains [0-9]+ entries: .* SECTION +LOCAL +DEFAULT +8 * .* SECTION +LOCAL +DEFAULT +9 * .* SECTION +LOCAL +DEFAULT +10 * +.* SECTION +LOCAL +DEFAULT +11 * +.* SECTION +LOCAL +DEFAULT +12 * .* FILE +LOCAL +DEFAULT +ABS .* -.* TLS +LOCAL +DEFAULT +7 sl1 -.* TLS +LOCAL +DEFAULT +7 sl2 -.* TLS +LOCAL +DEFAULT +7 sl3 -.* TLS +LOCAL +DEFAULT +7 sl4 -.* TLS +LOCAL +DEFAULT +7 sl5 -.* TLS +LOCAL +DEFAULT +7 sl6 -.* TLS +LOCAL +DEFAULT +7 sl7 -.* TLS +LOCAL +DEFAULT +7 sl8 +.* TLS +LOCAL +DEFAULT +9 sl1 +.* TLS +LOCAL +DEFAULT +9 sl2 +.* TLS +LOCAL +DEFAULT +9 sl3 +.* TLS +LOCAL +DEFAULT +9 sl4 +.* TLS +LOCAL +DEFAULT +9 sl5 +.* TLS +LOCAL +DEFAULT +9 sl6 +.* TLS +LOCAL +DEFAULT +9 sl7 +.* TLS +LOCAL +DEFAULT +9 sl8 .* FILE +LOCAL +DEFAULT +ABS .* -.* TLS +LOCAL +DEFAULT +8 bl1 -.* TLS +LOCAL +DEFAULT +8 bl2 -.* TLS +LOCAL +DEFAULT +8 bl3 -.* TLS +LOCAL +DEFAULT +8 bl4 -.* TLS +LOCAL +DEFAULT +8 bl5 -.* TLS +LOCAL +DEFAULT +8 bl6 -.* TLS +LOCAL +DEFAULT +8 bl7 -.* TLS +LOCAL +DEFAULT +8 bl8 +.* TLS +LOCAL +DEFAULT +10 bl1 +.* TLS +LOCAL +DEFAULT +10 bl2 +.* TLS +LOCAL +DEFAULT +10 bl3 +.* TLS +LOCAL +DEFAULT +10 bl4 +.* TLS +LOCAL +DEFAULT +10 bl5 +.* TLS +LOCAL +DEFAULT +10 bl6 +.* TLS +LOCAL +DEFAULT +10 bl7 +.* TLS +LOCAL +DEFAULT +10 bl8 .* FILE +LOCAL +DEFAULT +ABS .* -.* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC -.* OBJECT +LOCAL +DEFAULT +10 _PROCEDURE_LINKAGE_TABLE_ -.* OBJECT +LOCAL +DEFAULT +10 _GLOBAL_OFFSET_TABLE_ -.* TLS +GLOBAL +DEFAULT +7 sg8 -.* TLS +GLOBAL +DEFAULT +8 bg8 -.* TLS +GLOBAL +DEFAULT +8 bg6 +.* OBJECT +LOCAL +DEFAULT +11 _DYNAMIC +.* OBJECT +LOCAL +DEFAULT +12 _PROCEDURE_LINKAGE_TABLE_ +.* OBJECT +LOCAL +DEFAULT +12 _GLOBAL_OFFSET_TABLE_ +.* TLS +GLOBAL +DEFAULT +9 sg8 +.* TLS +GLOBAL +DEFAULT +10 bg8 +.* TLS +GLOBAL +DEFAULT +10 bg6 .* TLS +GLOBAL +DEFAULT +UND sG5 -.* TLS +GLOBAL +DEFAULT +8 bg3 -.* TLS +GLOBAL +DEFAULT +7 sg3 -.* TLS +GLOBAL +HIDDEN +7 sh3 +.* TLS +GLOBAL +DEFAULT +10 bg3 +.* TLS +GLOBAL +DEFAULT +9 sg3 +.* TLS +GLOBAL +HIDDEN +9 sh3 .* TLS +GLOBAL +DEFAULT +UND sG2 -.* TLS +GLOBAL +DEFAULT +7 sg4 -.* TLS +GLOBAL +DEFAULT +7 sg5 -.* TLS +GLOBAL +DEFAULT +8 bg5 -.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr -.* TLS +GLOBAL +HIDDEN +7 sh7 -.* TLS +GLOBAL +HIDDEN +7 sh8 -.* TLS +GLOBAL +DEFAULT +7 sg1 -.* FUNC +GLOBAL +DEFAULT +6 _start -.* TLS +GLOBAL +HIDDEN +7 sh4 -.* TLS +GLOBAL +DEFAULT +8 bg7 -.* TLS +GLOBAL +HIDDEN +7 sh5 -.* NOTYPE +GLOBAL +DEFAULT +10 __bss_start +.* TLS +GLOBAL +DEFAULT +9 sg4 +.* TLS +GLOBAL +DEFAULT +9 sg5 +.* TLS +GLOBAL +DEFAULT +10 bg5 +.* TLS +GLOBAL +HIDDEN +9 sh7 +.* TLS +GLOBAL +HIDDEN +9 sh8 +.* TLS +GLOBAL +DEFAULT +9 sg1 +.* FUNC +GLOBAL +DEFAULT +8 _start +.* TLS +GLOBAL +HIDDEN +9 sh4 +.* TLS +GLOBAL +DEFAULT +10 bg7 +.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr@@SUNWprivate_1.1 +.* TLS +GLOBAL +HIDDEN +9 sh5 +.* NOTYPE +GLOBAL +DEFAULT +12 __bss_start .* TLS +GLOBAL +DEFAULT +UND sG6 -.* FUNC +GLOBAL +DEFAULT +6 fn2 -.* TLS +GLOBAL +DEFAULT +7 sg2 +.* FUNC +GLOBAL +DEFAULT +8 fn2 +.* TLS +GLOBAL +DEFAULT +9 sg2 .* TLS +GLOBAL +DEFAULT +UND sG1 -.* TLS +GLOBAL +HIDDEN +7 sh1 -.* TLS +GLOBAL +DEFAULT +7 sg6 -.* TLS +GLOBAL +DEFAULT +7 sg7 -.* NOTYPE +GLOBAL +DEFAULT +10 _edata -.* NOTYPE +GLOBAL +DEFAULT +10 _end -.* TLS +GLOBAL +HIDDEN +7 sh2 -.* TLS +GLOBAL +HIDDEN +7 sh6 -.* TLS +GLOBAL +DEFAULT +8 bg2 -.* TLS +GLOBAL +DEFAULT +8 bg1 -.* TLS +GLOBAL +DEFAULT +8 bg4 +.* TLS +GLOBAL +HIDDEN +9 sh1 +.* TLS +GLOBAL +DEFAULT +9 sg6 +.* TLS +GLOBAL +DEFAULT +9 sg7 +.* NOTYPE +GLOBAL +DEFAULT +12 _edata +.* NOTYPE +GLOBAL +DEFAULT +12 _end +.* TLS +GLOBAL +HIDDEN +9 sh2 +.* TLS +GLOBAL +HIDDEN +9 sh6 +.* TLS +GLOBAL +DEFAULT +10 bg2 +.* TLS +GLOBAL +DEFAULT +10 bg1 +.* TLS +GLOBAL +DEFAULT +10 bg4 diff --git a/ld/testsuite/ld-sparc/tlssunbin64.sd b/ld/testsuite/ld-sparc/tlssunbin64.sd index 73a87e0..68e0d97 100644 --- a/ld/testsuite/ld-sparc/tlssunbin64.sd +++ b/ld/testsuite/ld-sparc/tlssunbin64.sd @@ -7,6 +7,6 @@ .*: +file format elf64-sparc Contents of section .got: - 202308 0+ 0+202208 0+ 0+ .* - 202318 0+ 0+ 0+ 0+ .* - 202328 0+ 0+ +.* + 202338 0+ 0+202208 0+ 0+ .* + 202348 0+ 0+ 0+ 0+ .* + 202358 0+ 0+ +.* -- 2.7.4