• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂bb363086e7743506d78bc6b1e56face0fb1fc93f (tree)
時間2018-01-25 20:16:06
作者Eric Botcazou <ebotcazou@gcc....>
CommiterEric Botcazou

Log Message

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) <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.

Change Summary

差異

--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,20 @@
1+2018-01-25 Eric Botcazou <ebotcazou@adacore.com>
2+
3+ PR ld/22727
4+ * elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>:
5+ Do a mere lookup of the __tls_get_addr symbol instead of adding it.
6+
7+ Revert
8+ 2017-10-19 H.J. Lu <hongjiu.lu@intel.com>
9+
10+ PR ld/22263
11+ * elfxx-sparc.c (sparc_elf_tls_transition): Replace
12+ bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
13+ bfd_link_executable for TLS check.
14+ (_bfd_sparc_elf_check_relocs): Likewise.
15+ (allocate_dynrelocs): Likewise.
16+ (_bfd_sparc_elf_relocate_section): Likewise.
17+
118 2018-01-24 Renlin Li <renlin.li@arm.com>
219
320 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Add support for
--- 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,
13331333 && ! _bfd_sparc_elf_tdata (abfd)->has_tlsgd)
13341334 r_type = R_SPARC_REV32;
13351335
1336- if (!bfd_link_executable (info))
1336+ if (bfd_link_pic (info))
13371337 return r_type;
13381338
13391339 switch (r_type)
@@ -1505,13 +1505,13 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
15051505
15061506 case R_SPARC_TLS_LE_HIX22:
15071507 case R_SPARC_TLS_LE_LOX10:
1508- if (!bfd_link_executable (info))
1508+ if (bfd_link_pic (info))
15091509 goto r_sparc_plt32;
15101510 break;
15111511
15121512 case R_SPARC_TLS_IE_HI22:
15131513 case R_SPARC_TLS_IE_LO10:
1514- if (!bfd_link_executable (info))
1514+ if (bfd_link_pic (info))
15151515 info->flags |= DF_STATIC_TLS;
15161516 /* Fall through */
15171517
@@ -1625,18 +1625,13 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
16251625
16261626 case R_SPARC_TLS_GD_CALL:
16271627 case R_SPARC_TLS_LDM_CALL:
1628- if (!bfd_link_executable (info))
1628+ if (bfd_link_pic (info))
16291629 {
16301630 /* These are basically R_SPARC_TLS_WPLT30 relocs against
16311631 __tls_get_addr. */
1632- struct bfd_link_hash_entry *bh = NULL;
1633- if (! _bfd_generic_link_add_one_symbol (info, abfd,
1634- "__tls_get_addr", 0,
1635- bfd_und_section_ptr, 0,
1636- NULL, FALSE, FALSE,
1637- &bh))
1638- return FALSE;
1639- h = (struct elf_link_hash_entry *) bh;
1632+ h = (struct elf_link_hash_entry *)
1633+ bfd_link_hash_lookup (info->hash, "__tls_get_addr", TRUE,
1634+ FALSE, TRUE);
16401635 }
16411636 else
16421637 break;
@@ -2232,7 +2227,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
22322227 /* If R_SPARC_TLS_IE_{HI22,LO10} symbol is now local to the binary,
22332228 make it a R_SPARC_TLS_LE_{HI22,LO10} requiring no TLS entry. */
22342229 if (h->got.refcount > 0
2235- && bfd_link_executable (info)
2230+ && !bfd_link_pic (info)
22362231 && h->dynindx == -1
22372232 && _bfd_sparc_elf_hash_entry(h)->tls_type == GOT_TLS_IE)
22382233 h->got.offset = (bfd_vma) -1;
@@ -3576,7 +3571,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
35763571 else if (h != NULL)
35773572 {
35783573 tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
3579- if (bfd_link_executable (info)
3574+ if (!bfd_link_pic (info)
35803575 && h->dynindx == -1
35813576 && tls_type == GOT_TLS_IE)
35823577 switch (SPARC_ELF_R_TYPE (rel->r_info))
@@ -3723,7 +3718,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
37233718
37243719 case R_SPARC_TLS_LE_HIX22:
37253720 case R_SPARC_TLS_LE_LOX10:
3726- if (!bfd_link_executable (info))
3721+ if (bfd_link_pic (info))
37273722 {
37283723 Elf_Internal_Rela outrel;
37293724 bfd_boolean skip;
@@ -3755,7 +3750,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
37553750 break;
37563751
37573752 case R_SPARC_TLS_LDM_CALL:
3758- if (bfd_link_executable (info))
3753+ if (! bfd_link_pic (info))
37593754 {
37603755 /* mov %g0, %o0 */
37613756 bfd_put_32 (output_bfd, 0x90100000, contents + rel->r_offset);
@@ -3769,7 +3764,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
37693764 tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx];
37703765 else if (h != NULL)
37713766 tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
3772- if (bfd_link_executable (info)
3767+ if (! bfd_link_pic (info)
37733768 || (r_type == R_SPARC_TLS_GD_CALL && tls_type == GOT_TLS_IE))
37743769 {
37753770 Elf_Internal_Rela *rel2;
@@ -3878,7 +3873,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
38783873
38793874 case R_SPARC_TLS_IE_LD:
38803875 case R_SPARC_TLS_IE_LDX:
3881- if (bfd_link_executable (info) && (h == NULL || h->dynindx == -1))
3876+ if (! bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
38823877 {
38833878 bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
38843879 int rs2 = insn & 0x1f;
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,23 @@
1+2018-01-25 Eric Botcazou <ebotcazou@adacore.com>
2+
3+ * testsuite/ld-sparc/sparc.exp (32-bit: Helper shared library):
4+ Link with a version script.
5+ (32-bit: TLS -fpie): New test.
6+ (64-bit: Helper shared library): Link with a version script.
7+ (64-bit: TLS -fpie): New test.
8+ (64-bit: GOTDATA relocations): Pass -Av9 to the assembler.
9+ * testsuite/ld-sparc/tlslib.ver: New file.
10+ * testsuite/ld-sparc/tlspie32.dd: Likewise.
11+ * testsuite/ld-sparc/tlspie32.s: Likewise.
12+ * testsuite/ld-sparc/tlspie64.dd: Likewise.
13+ * testsuite/ld-sparc/tlspie64.s: Likewise.
14+ * testsuite/ld-sparc/tlssunbin32.dd: Adjust for versioned symbol.
15+ * testsuite/ld-sparc/tlssunbin32.rd: Likewise.
16+ * testsuite/ld-sparc/tlssunbin32.sd: Likewise.
17+ * testsuite/ld-sparc/tlssunbin64.dd: Likewise.
18+ * testsuite/ld-sparc/tlssunbin64.rd: Likewise.
19+ * testsuite/ld-sparc/tlssunbin64.sd: Likewise.
20+
121 2018-01-24 Renlin Li <renlin.li@arm.com>
222
323 * testsuite/ld-aarch64/aarch64-elf.exp: Run new testes.
--- a/ld/testsuite/ld-sparc/sparc.exp
+++ b/ld/testsuite/ld-sparc/sparc.exp
@@ -74,7 +74,8 @@ set sparctests {
7474 {{readelf -WSsrl tlssunpic32.rd} {objdump -drj.text tlssunpic32.dd}
7575 {objdump -sj.got tlssunpic32.sd} {objdump -sj.tdata tlssunpic32.td}}
7676 "libtlssunpic32.so"}
77- {"32-bit: Helper shared library" "-shared -melf32_sparc" ""
77+ {"32-bit: Helper shared library"
78+ "-shared -melf32_sparc -version-script tlslib.ver" ""
7879 "--32 -K PIC" {tlslib.s} {} "libtlslib32.so"}
7980 {"32-bit: Another helper shared library" "-shared -melf32_sparc" ""
8081 "--32 -K PIC" {tlssunbinpic32.s} {} "libtlssunbinpic32.so"}
@@ -92,6 +93,9 @@ set sparctests {
9293 {"32-bit: TLS in debug sections" "-melf32_sparc" ""
9394 "--32" {tlsg32.s}
9495 {{objdump -sj.debug_foobar tlsg32.sd}} "tlsg32"}
96+ {"32-bit: TLS -fpie" "-melf32_sparc -pie tmpdir/libtlslib32.so" ""
97+ "--32 -K PIC" {tlspie32.s}
98+ {{objdump -drj.text tlspie32.dd}} "tlspie32"}
9599 {"32-bit: GOTDATA relocations"
96100 "-shared -melf32_sparc --hash-style=sysv" ""
97101 "--32 -K PIC" {gotop32.s}
@@ -109,7 +113,8 @@ set sparc64tests {
109113 {{readelf -WSsrl tlssunpic64.rd} {objdump -drj.text tlssunpic64.dd}
110114 {objdump -sj.got tlssunpic64.sd} {objdump -sj.tdata tlssunpic64.td}}
111115 "libtlssunpic64.so"}
112- {"64-bit: Helper shared library" "-shared -melf64_sparc" ""
116+ {"64-bit: Helper shared library"
117+ "-shared -melf64_sparc -version-script tlslib.ver" ""
113118 "--64 -Av9 -K PIC" {tlslib.s} {} "libtlslib64.so"}
114119 {"64-bit: Another helper shared library" "-shared -melf64_sparc" ""
115120 "--64 -Av9 -K PIC" {tlssunbinpic64.s} {} "libtlssunbinpic64.so"}
@@ -127,9 +132,12 @@ set sparc64tests {
127132 {"64-bit: TLS in debug sections" "-melf64_sparc" ""
128133 "--64 -Av9" {tlsg64.s}
129134 {{objdump -sj.debug_foobar tlsg64.sd}} "tlsg64"}
135+ {"64-bit: TLS -fpie" "-melf64_sparc -pie tmpdir/libtlslib64.so" ""
136+ "--64 -Av9 -K PIC" {tlspie64.s}
137+ {{objdump -drj.text tlspie64.dd}} "tlspie64"}
130138 {"64-bit: GOTDATA relocations"
131139 "-shared -melf64_sparc --hash-style=sysv" ""
132- "--64 -K PIC" {gotop64.s}
140+ "--64 -Av9 -K PIC" {gotop64.s}
133141 {{readelf -WSsrl gotop64.rd} {objdump -drj.text gotop64.dd}
134142 {objdump -sj.got gotop64.sd} {objdump -sj.data gotop64.td}}
135143 "libgotop64.so"}
--- /dev/null
+++ b/ld/testsuite/ld-sparc/tlslib.ver
@@ -0,0 +1,4 @@
1+SUNWprivate_1.1 {
2+ global:
3+ __tls_get_addr;
4+};
--- /dev/null
+++ b/ld/testsuite/ld-sparc/tlspie32.dd
@@ -0,0 +1,18 @@
1+#source: tlspie32.s
2+#source: tlspic.s
3+#as: --32 -K PIC
4+#ld: -shared -melf32_sparc
5+#objdump: -drj.text
6+#target: sparc*-*-*
7+
8+.*: +file format elf32-sparc
9+
10+
11+Disassembly of section .text:
12+
13+0[0-9a-f]+ <get_gdp>:
14+ +[0-9a-f]+: 03 00 00 00 sethi %hi\(0\), %g1
15+ +[0-9a-f]+: 82 00 60 04 add %g1, 4, %g1 ! 4 <tls_gd\+0x4>
16+ +[0-9a-f]+: 90 05 c0 01 add %l7, %g1, %o0
17+ +[0-9a-f]+: 40 00 40 43 call [0-9a-f]+ <__tls_get_addr@plt>
18+ +[0-9a-f]+: 01 00 00 00 nop
--- /dev/null
+++ b/ld/testsuite/ld-sparc/tlspie32.s
@@ -0,0 +1,20 @@
1+ .section ".text"
2+ .global tls_gd
3+ .section .tbss,"awT",@nobits
4+ .align 4
5+ .type tls_gd, #object
6+ .size tls_gd, 4
7+tls_gd:
8+ .skip 4
9+ .section ".text"
10+ .align 4
11+ .global get_gdp
12+ .type get_gdp, #function
13+ .proc 0104
14+get_gdp:
15+ sethi %tgd_hi22(tls_gd), %g1
16+ add %g1, %tgd_lo10(tls_gd), %g1
17+ add %l7, %g1, %o0, %tgd_add(tls_gd)
18+ call __tls_get_addr, %tgd_call(tls_gd)
19+ nop
20+ .size get_gdp, .-get_gdp
--- /dev/null
+++ b/ld/testsuite/ld-sparc/tlspie64.dd
@@ -0,0 +1,18 @@
1+#source: tlspie64.s
2+#source: tlspic.s
3+#as: --64 -Av9 -K PIC
4+#ld: -shared -melf64_sparc
5+#objdump: -drj.text
6+#target: sparc*-*-*
7+
8+.*: +file format elf64-sparc
9+
10+
11+Disassembly of section .text:
12+
13+0[0-9a-f]+ <get_gdp>:
14+ +[0-9a-f]+: 03 00 00 00 sethi %hi\(0\), %g1
15+ +[0-9a-f]+: 82 00 60 08 add %g1, 8, %g1 ! 8 <tls_gd\+0x8>
16+ +[0-9a-f]+: 90 05 c0 01 add %l7, %g1, %o0
17+ +[0-9a-f]+: 40 04 00 bb call [0-9a-f]+ <__tls_get_addr@plt>
18+ +[0-9a-f]+: 01 00 00 00 nop
--- /dev/null
+++ b/ld/testsuite/ld-sparc/tlspie64.s
@@ -0,0 +1,20 @@
1+ .section ".text"
2+ .global tls_gd
3+ .section .tbss,"awT",@nobits
4+ .align 4
5+ .type tls_gd, #object
6+ .size tls_gd, 4
7+tls_gd:
8+ .skip 4
9+ .section ".text"
10+ .align 4
11+ .global get_gdp
12+ .type get_gdp, #function
13+ .proc 0104
14+get_gdp:
15+ sethi %tgd_hi22(tls_gd), %g1
16+ add %g1, %tgd_lo10(tls_gd), %g1
17+ add %l7, %g1, %o0, %tgd_add(tls_gd)
18+ call __tls_get_addr, %tgd_call(tls_gd)
19+ nop
20+ .size get_gdp, .-get_gdp
--- a/ld/testsuite/ld-sparc/tlssunbin32.dd
+++ b/ld/testsuite/ld-sparc/tlssunbin32.dd
@@ -16,7 +16,7 @@ Disassembly of section .text:
1616 +11008: 9d e3 bf 98 save %sp, -104, %sp
1717 +1100c: 2f 00 00 48 sethi %hi\(0x12000\), %l7
1818 +11010: 7f ff ff fc call 11000 <.*>
19- +11014: ae 05 e2 64 add %l7, 0x264, %l7 ! 12264 <.*>
19+ +11014: ae 05 e2 7c add %l7, 0x27c, %l7 ! 1227c <.*>
2020 +11018: 01 00 00 00 nop *
2121 +1101c: 01 00 00 00 nop *
2222 +11020: 01 00 00 00 nop *
@@ -172,7 +172,7 @@ Disassembly of section .text:
172172 00012000 <_start>:
173173 +12000: 9d e3 bf 98 save %sp, -104, %sp
174174 +12004: 29 00 00 8c sethi %hi\(0x23000\), %l4
175- +12008: a8 15 22 74 or %l4, 0x274, %l4 ! 23274 <.*>
175+ +12008: a8 15 22 8c or %l4, 0x28c, %l4 ! 2328c <.*>
176176 +1200c: 01 00 00 00 nop *
177177 +12010: 01 00 00 00 nop *
178178 +12014: 01 00 00 00 nop *
--- a/ld/testsuite/ld-sparc/tlssunbin32.rd
+++ b/ld/testsuite/ld-sparc/tlssunbin32.rd
@@ -13,12 +13,14 @@ Section Headers:
1313 +\[[ 0-9]+\] .hash +.*
1414 +\[[ 0-9]+\] .dynsym +.*
1515 +\[[ 0-9]+\] .dynstr +.*
16+ +\[[ 0-9]+\] .gnu.version +.*
17+ +\[[ 0-9]+\] .gnu.version_r +.*
1618 +\[[ 0-9]+\] .rela.dyn +.*
1719 +\[[ 0-9]+\] .text +PROGBITS +0+11000 0+1000 0+1194 00 +AX +0 +0 4096
1820 +\[[ 0-9]+\] .tdata +PROGBITS +0+22194 0+2194 0+1060 00 WAT +0 +0 +4
1921 +\[[ 0-9]+\] .tbss +NOBITS +0+231f4 0+31f4 0+40 00 WAT +0 +0 +4
20- +\[[ 0-9]+\] .dynamic +DYNAMIC +0+231f4 0+31f4 0+80 08 +WA +4 +0 +4
21- +\[[ 0-9]+\] .got +PROGBITS +0+23274 0+3274 0+14 04 +WA +0 +0 +4
22+ +\[[ 0-9]+\] .dynamic +DYNAMIC +0+231f4 0+31f4 0+98 08 +WA +4 +0 +4
23+ +\[[ 0-9]+\] .got +PROGBITS +0+2328c 0+328c 0+14 04 +WA +0 +0 +4
2224 +\[[ 0-9]+\] .symtab +.*
2325 +\[[ 0-9]+\] .strtab +.*
2426 +\[[ 0-9]+\] .shstrtab +.*
@@ -51,12 +53,12 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
5153 .* NOTYPE +LOCAL +DEFAULT +UND *
5254 .* TLS +GLOBAL +DEFAULT +UND sG5
5355 .* TLS +GLOBAL +DEFAULT +UND sG2
54-.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr
55-.* NOTYPE +GLOBAL +DEFAULT +10 __bss_start
56+.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr@SUNWprivate_1.1 \(2\)
57+.* NOTYPE +GLOBAL +DEFAULT +12 __bss_start
5658 .* TLS +GLOBAL +DEFAULT +UND sG6
5759 .* TLS +GLOBAL +DEFAULT +UND sG1
58-.* NOTYPE +GLOBAL +DEFAULT +10 _edata
59-.* NOTYPE +GLOBAL +DEFAULT +10 _end
60+.* NOTYPE +GLOBAL +DEFAULT +12 _edata
61+.* NOTYPE +GLOBAL +DEFAULT +12 _end
6062
6163 Symbol table '\.symtab' contains [0-9]+ entries:
6264 +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
@@ -71,59 +73,61 @@ Symbol table '\.symtab' contains [0-9]+ entries:
7173 .* SECTION +LOCAL +DEFAULT +8 *
7274 .* SECTION +LOCAL +DEFAULT +9 *
7375 .* SECTION +LOCAL +DEFAULT +10 *
76+.* SECTION +LOCAL +DEFAULT +11 *
77+.* SECTION +LOCAL +DEFAULT +12 *
7478 .* FILE +LOCAL +DEFAULT +ABS .*
75-.* TLS +LOCAL +DEFAULT +7 sl1
76-.* TLS +LOCAL +DEFAULT +7 sl2
77-.* TLS +LOCAL +DEFAULT +7 sl3
78-.* TLS +LOCAL +DEFAULT +7 sl4
79-.* TLS +LOCAL +DEFAULT +7 sl5
80-.* TLS +LOCAL +DEFAULT +7 sl6
81-.* TLS +LOCAL +DEFAULT +7 sl7
82-.* TLS +LOCAL +DEFAULT +7 sl8
79+.* TLS +LOCAL +DEFAULT +9 sl1
80+.* TLS +LOCAL +DEFAULT +9 sl2
81+.* TLS +LOCAL +DEFAULT +9 sl3
82+.* TLS +LOCAL +DEFAULT +9 sl4
83+.* TLS +LOCAL +DEFAULT +9 sl5
84+.* TLS +LOCAL +DEFAULT +9 sl6
85+.* TLS +LOCAL +DEFAULT +9 sl7
86+.* TLS +LOCAL +DEFAULT +9 sl8
8387 .* FILE +LOCAL +DEFAULT +ABS .*
84-.* TLS +LOCAL +DEFAULT +8 bl1
85-.* TLS +LOCAL +DEFAULT +8 bl2
86-.* TLS +LOCAL +DEFAULT +8 bl3
87-.* TLS +LOCAL +DEFAULT +8 bl4
88-.* TLS +LOCAL +DEFAULT +8 bl5
89-.* TLS +LOCAL +DEFAULT +8 bl6
90-.* TLS +LOCAL +DEFAULT +8 bl7
91-.* TLS +LOCAL +DEFAULT +8 bl8
88+.* TLS +LOCAL +DEFAULT +10 bl1
89+.* TLS +LOCAL +DEFAULT +10 bl2
90+.* TLS +LOCAL +DEFAULT +10 bl3
91+.* TLS +LOCAL +DEFAULT +10 bl4
92+.* TLS +LOCAL +DEFAULT +10 bl5
93+.* TLS +LOCAL +DEFAULT +10 bl6
94+.* TLS +LOCAL +DEFAULT +10 bl7
95+.* TLS +LOCAL +DEFAULT +10 bl8
9296 .* FILE +LOCAL +DEFAULT +ABS .*
93-.* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
94-.* OBJECT +LOCAL +DEFAULT +10 _PROCEDURE_LINKAGE_TABLE_
95-.* OBJECT +LOCAL +DEFAULT +10 _GLOBAL_OFFSET_TABLE_
96-.* TLS +GLOBAL +DEFAULT +7 sg8
97-.* TLS +GLOBAL +DEFAULT +8 bg8
98-.* TLS +GLOBAL +DEFAULT +8 bg6
97+.* OBJECT +LOCAL +DEFAULT +11 _DYNAMIC
98+.* OBJECT +LOCAL +DEFAULT +12 _PROCEDURE_LINKAGE_TABLE_
99+.* OBJECT +LOCAL +DEFAULT +12 _GLOBAL_OFFSET_TABLE_
100+.* TLS +GLOBAL +DEFAULT +9 sg8
101+.* TLS +GLOBAL +DEFAULT +10 bg8
102+.* TLS +GLOBAL +DEFAULT +10 bg6
99103 .* TLS +GLOBAL +DEFAULT +UND sG5
100-.* TLS +GLOBAL +DEFAULT +8 bg3
101-.* TLS +GLOBAL +DEFAULT +7 sg3
102-.* TLS +GLOBAL +HIDDEN +7 sh3
104+.* TLS +GLOBAL +DEFAULT +10 bg3
105+.* TLS +GLOBAL +DEFAULT +9 sg3
106+.* TLS +GLOBAL +HIDDEN +9 sh3
103107 .* TLS +GLOBAL +DEFAULT +UND sG2
104-.* TLS +GLOBAL +DEFAULT +7 sg4
105-.* TLS +GLOBAL +DEFAULT +7 sg5
106-.* TLS +GLOBAL +DEFAULT +8 bg5
107-.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr
108-.* TLS +GLOBAL +HIDDEN +7 sh7
109-.* TLS +GLOBAL +HIDDEN +7 sh8
110-.* TLS +GLOBAL +DEFAULT +7 sg1
111-.* FUNC +GLOBAL +DEFAULT +6 _start
112-.* TLS +GLOBAL +HIDDEN +7 sh4
113-.* TLS +GLOBAL +DEFAULT +8 bg7
114-.* TLS +GLOBAL +HIDDEN +7 sh5
115-.* NOTYPE +GLOBAL +DEFAULT +10 __bss_start
108+.* TLS +GLOBAL +DEFAULT +9 sg4
109+.* TLS +GLOBAL +DEFAULT +9 sg5
110+.* TLS +GLOBAL +DEFAULT +10 bg5
111+.* TLS +GLOBAL +HIDDEN +9 sh7
112+.* TLS +GLOBAL +HIDDEN +9 sh8
113+.* TLS +GLOBAL +DEFAULT +9 sg1
114+.* FUNC +GLOBAL +DEFAULT +8 _start
115+.* TLS +GLOBAL +HIDDEN +9 sh4
116+.* TLS +GLOBAL +DEFAULT +10 bg7
117+.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr@@SUNWprivate_1.1
118+.* TLS +GLOBAL +HIDDEN +9 sh5
119+.* NOTYPE +GLOBAL +DEFAULT +12 __bss_start
116120 .* TLS +GLOBAL +DEFAULT +UND sG6
117-.* FUNC +GLOBAL +DEFAULT +6 fn2
118-.* TLS +GLOBAL +DEFAULT +7 sg2
121+.* FUNC +GLOBAL +DEFAULT +8 fn2
122+.* TLS +GLOBAL +DEFAULT +9 sg2
119123 .* TLS +GLOBAL +DEFAULT +UND sG1
120-.* TLS +GLOBAL +HIDDEN +7 sh1
121-.* TLS +GLOBAL +DEFAULT +7 sg6
122-.* TLS +GLOBAL +DEFAULT +7 sg7
123-.* NOTYPE +GLOBAL +DEFAULT +10 _edata
124-.* NOTYPE +GLOBAL +DEFAULT +10 _end
125-.* TLS +GLOBAL +HIDDEN +7 sh2
126-.* TLS +GLOBAL +HIDDEN +7 sh6
127-.* TLS +GLOBAL +DEFAULT +8 bg2
128-.* TLS +GLOBAL +DEFAULT +8 bg1
129-.* TLS +GLOBAL +DEFAULT +8 bg4
124+.* TLS +GLOBAL +HIDDEN +9 sh1
125+.* TLS +GLOBAL +DEFAULT +9 sg6
126+.* TLS +GLOBAL +DEFAULT +9 sg7
127+.* NOTYPE +GLOBAL +DEFAULT +12 _edata
128+.* NOTYPE +GLOBAL +DEFAULT +12 _end
129+.* TLS +GLOBAL +HIDDEN +9 sh2
130+.* TLS +GLOBAL +HIDDEN +9 sh6
131+.* TLS +GLOBAL +DEFAULT +10 bg2
132+.* TLS +GLOBAL +DEFAULT +10 bg1
133+.* TLS +GLOBAL +DEFAULT +10 bg4
--- a/ld/testsuite/ld-sparc/tlssunbin32.sd
+++ b/ld/testsuite/ld-sparc/tlssunbin32.sd
@@ -7,5 +7,5 @@
77 .*: +file format elf32-sparc
88
99 Contents of section .got:
10- 23274 000231f4 0+ 0+ 0+ .*
11- 23284 0+ .*
10+ 2328c 000231f4 0+ 0+ 0+ .*
11+ 2329c 0+ .*
--- a/ld/testsuite/ld-sparc/tlssunbin64.dd
+++ b/ld/testsuite/ld-sparc/tlssunbin64.dd
@@ -16,7 +16,7 @@ Disassembly of section .text:
1616 +101008: 9d e3 bf 60 save %sp, -160, %sp
1717 +10100c: 2f 00 04 04 sethi %hi\(0x101000\), %l7
1818 +101010: 7f ff ff fc call 101000 <.*>
19- +101014: ae 05 e2 f8 add %l7, 0x2f8, %l7 ! 1012f8 <.*>
19+ +101014: ae 05 e3 28 add %l7, 0x328, %l7 ! 101328 <.*>
2020 +101018: 01 00 00 00 nop *
2121 +10101c: 01 00 00 00 nop *
2222 +101020: 01 00 00 00 nop *
@@ -174,7 +174,7 @@ Disassembly of section .text:
174174 +102004: 23 00 00 00 sethi %hi\(0\), %l1
175175 +102008: 25 00 08 08 sethi %hi\(0x202000\), %l2
176176 +10200c: a2 14 60 00 mov %l1, %l1
177- +102010: a4 14 a3 08 or %l2, 0x308, %l2
177+ +102010: a4 14 a3 38 or %l2, 0x338, %l2
178178 +102014: a3 2c 70 20 sllx %l1, 0x20, %l1
179179 +102018: a8 04 40 12 add %l1, %l2, %l4
180180 +10201c: 01 00 00 00 nop *
--- a/ld/testsuite/ld-sparc/tlssunbin64.rd
+++ b/ld/testsuite/ld-sparc/tlssunbin64.rd
@@ -13,12 +13,14 @@ Section Headers:
1313 +\[[ 0-9]+\] .hash +.*
1414 +\[[ 0-9]+\] .dynsym +.*
1515 +\[[ 0-9]+\] .dynstr +.*
16+ +\[[ 0-9]+\] .gnu.version +.*
17+ +\[[ 0-9]+\] .gnu.version_r +.*
1618 +\[[ 0-9]+\] .rela.dyn +.*
1719 +\[[ 0-9]+\] .text +PROGBITS +0+101000 0+1000 0+11a4 00 +AX +0 +0 4096
1820 +\[[ 0-9]+\] .tdata +PROGBITS +0+2021a4 0+21a4 0+0060 00 WAT +0 +0 +4
1921 +\[[ 0-9]+\] .tbss +NOBITS +0+202204 0+2204 0+40 00 WAT +0 +0 +4
20- +\[[ 0-9]+\] .dynamic +DYNAMIC +0+202208 0+2208 0+100 10 +WA +4 +0 +8
21- +\[[ 0-9]+\] .got +PROGBITS +0+202308 0+2308 0+28 08 +WA +0 +0 +8
22+ +\[[ 0-9]+\] .dynamic +DYNAMIC +0+202208 0+2208 0+130 10 +WA +4 +0 +8
23+ +\[[ 0-9]+\] .got +PROGBITS +0+202338 0+2338 0+28 08 +WA +0 +0 +8
2224 +\[[ 0-9]+\] .symtab +.*
2325 +\[[ 0-9]+\] .strtab +.*
2426 +\[[ 0-9]+\] .shstrtab +.*
@@ -51,12 +53,12 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
5153 .* NOTYPE +LOCAL +DEFAULT +UND *
5254 .* TLS +GLOBAL +DEFAULT +UND sG5
5355 .* TLS +GLOBAL +DEFAULT +UND sG2
54-.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr
55-.* NOTYPE +GLOBAL +DEFAULT +10 __bss_start
56+.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr@SUNWprivate_1.1 \(2\)
57+.* NOTYPE +GLOBAL +DEFAULT +12 __bss_start
5658 .* TLS +GLOBAL +DEFAULT +UND sG6
5759 .* TLS +GLOBAL +DEFAULT +UND sG1
58-.* NOTYPE +GLOBAL +DEFAULT +10 _edata
59-.* NOTYPE +GLOBAL +DEFAULT +10 _end
60+.* NOTYPE +GLOBAL +DEFAULT +12 _edata
61+.* NOTYPE +GLOBAL +DEFAULT +12 _end
6062
6163 Symbol table '\.symtab' contains [0-9]+ entries:
6264 +Num: +Value +Size Type +Bind +Vis +Ndx Name
@@ -71,59 +73,61 @@ Symbol table '\.symtab' contains [0-9]+ entries:
7173 .* SECTION +LOCAL +DEFAULT +8 *
7274 .* SECTION +LOCAL +DEFAULT +9 *
7375 .* SECTION +LOCAL +DEFAULT +10 *
76+.* SECTION +LOCAL +DEFAULT +11 *
77+.* SECTION +LOCAL +DEFAULT +12 *
7478 .* FILE +LOCAL +DEFAULT +ABS .*
75-.* TLS +LOCAL +DEFAULT +7 sl1
76-.* TLS +LOCAL +DEFAULT +7 sl2
77-.* TLS +LOCAL +DEFAULT +7 sl3
78-.* TLS +LOCAL +DEFAULT +7 sl4
79-.* TLS +LOCAL +DEFAULT +7 sl5
80-.* TLS +LOCAL +DEFAULT +7 sl6
81-.* TLS +LOCAL +DEFAULT +7 sl7
82-.* TLS +LOCAL +DEFAULT +7 sl8
79+.* TLS +LOCAL +DEFAULT +9 sl1
80+.* TLS +LOCAL +DEFAULT +9 sl2
81+.* TLS +LOCAL +DEFAULT +9 sl3
82+.* TLS +LOCAL +DEFAULT +9 sl4
83+.* TLS +LOCAL +DEFAULT +9 sl5
84+.* TLS +LOCAL +DEFAULT +9 sl6
85+.* TLS +LOCAL +DEFAULT +9 sl7
86+.* TLS +LOCAL +DEFAULT +9 sl8
8387 .* FILE +LOCAL +DEFAULT +ABS .*
84-.* TLS +LOCAL +DEFAULT +8 bl1
85-.* TLS +LOCAL +DEFAULT +8 bl2
86-.* TLS +LOCAL +DEFAULT +8 bl3
87-.* TLS +LOCAL +DEFAULT +8 bl4
88-.* TLS +LOCAL +DEFAULT +8 bl5
89-.* TLS +LOCAL +DEFAULT +8 bl6
90-.* TLS +LOCAL +DEFAULT +8 bl7
91-.* TLS +LOCAL +DEFAULT +8 bl8
88+.* TLS +LOCAL +DEFAULT +10 bl1
89+.* TLS +LOCAL +DEFAULT +10 bl2
90+.* TLS +LOCAL +DEFAULT +10 bl3
91+.* TLS +LOCAL +DEFAULT +10 bl4
92+.* TLS +LOCAL +DEFAULT +10 bl5
93+.* TLS +LOCAL +DEFAULT +10 bl6
94+.* TLS +LOCAL +DEFAULT +10 bl7
95+.* TLS +LOCAL +DEFAULT +10 bl8
9296 .* FILE +LOCAL +DEFAULT +ABS .*
93-.* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
94-.* OBJECT +LOCAL +DEFAULT +10 _PROCEDURE_LINKAGE_TABLE_
95-.* OBJECT +LOCAL +DEFAULT +10 _GLOBAL_OFFSET_TABLE_
96-.* TLS +GLOBAL +DEFAULT +7 sg8
97-.* TLS +GLOBAL +DEFAULT +8 bg8
98-.* TLS +GLOBAL +DEFAULT +8 bg6
97+.* OBJECT +LOCAL +DEFAULT +11 _DYNAMIC
98+.* OBJECT +LOCAL +DEFAULT +12 _PROCEDURE_LINKAGE_TABLE_
99+.* OBJECT +LOCAL +DEFAULT +12 _GLOBAL_OFFSET_TABLE_
100+.* TLS +GLOBAL +DEFAULT +9 sg8
101+.* TLS +GLOBAL +DEFAULT +10 bg8
102+.* TLS +GLOBAL +DEFAULT +10 bg6
99103 .* TLS +GLOBAL +DEFAULT +UND sG5
100-.* TLS +GLOBAL +DEFAULT +8 bg3
101-.* TLS +GLOBAL +DEFAULT +7 sg3
102-.* TLS +GLOBAL +HIDDEN +7 sh3
104+.* TLS +GLOBAL +DEFAULT +10 bg3
105+.* TLS +GLOBAL +DEFAULT +9 sg3
106+.* TLS +GLOBAL +HIDDEN +9 sh3
103107 .* TLS +GLOBAL +DEFAULT +UND sG2
104-.* TLS +GLOBAL +DEFAULT +7 sg4
105-.* TLS +GLOBAL +DEFAULT +7 sg5
106-.* TLS +GLOBAL +DEFAULT +8 bg5
107-.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr
108-.* TLS +GLOBAL +HIDDEN +7 sh7
109-.* TLS +GLOBAL +HIDDEN +7 sh8
110-.* TLS +GLOBAL +DEFAULT +7 sg1
111-.* FUNC +GLOBAL +DEFAULT +6 _start
112-.* TLS +GLOBAL +HIDDEN +7 sh4
113-.* TLS +GLOBAL +DEFAULT +8 bg7
114-.* TLS +GLOBAL +HIDDEN +7 sh5
115-.* NOTYPE +GLOBAL +DEFAULT +10 __bss_start
108+.* TLS +GLOBAL +DEFAULT +9 sg4
109+.* TLS +GLOBAL +DEFAULT +9 sg5
110+.* TLS +GLOBAL +DEFAULT +10 bg5
111+.* TLS +GLOBAL +HIDDEN +9 sh7
112+.* TLS +GLOBAL +HIDDEN +9 sh8
113+.* TLS +GLOBAL +DEFAULT +9 sg1
114+.* FUNC +GLOBAL +DEFAULT +8 _start
115+.* TLS +GLOBAL +HIDDEN +9 sh4
116+.* TLS +GLOBAL +DEFAULT +10 bg7
117+.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr@@SUNWprivate_1.1
118+.* TLS +GLOBAL +HIDDEN +9 sh5
119+.* NOTYPE +GLOBAL +DEFAULT +12 __bss_start
116120 .* TLS +GLOBAL +DEFAULT +UND sG6
117-.* FUNC +GLOBAL +DEFAULT +6 fn2
118-.* TLS +GLOBAL +DEFAULT +7 sg2
121+.* FUNC +GLOBAL +DEFAULT +8 fn2
122+.* TLS +GLOBAL +DEFAULT +9 sg2
119123 .* TLS +GLOBAL +DEFAULT +UND sG1
120-.* TLS +GLOBAL +HIDDEN +7 sh1
121-.* TLS +GLOBAL +DEFAULT +7 sg6
122-.* TLS +GLOBAL +DEFAULT +7 sg7
123-.* NOTYPE +GLOBAL +DEFAULT +10 _edata
124-.* NOTYPE +GLOBAL +DEFAULT +10 _end
125-.* TLS +GLOBAL +HIDDEN +7 sh2
126-.* TLS +GLOBAL +HIDDEN +7 sh6
127-.* TLS +GLOBAL +DEFAULT +8 bg2
128-.* TLS +GLOBAL +DEFAULT +8 bg1
129-.* TLS +GLOBAL +DEFAULT +8 bg4
124+.* TLS +GLOBAL +HIDDEN +9 sh1
125+.* TLS +GLOBAL +DEFAULT +9 sg6
126+.* TLS +GLOBAL +DEFAULT +9 sg7
127+.* NOTYPE +GLOBAL +DEFAULT +12 _edata
128+.* NOTYPE +GLOBAL +DEFAULT +12 _end
129+.* TLS +GLOBAL +HIDDEN +9 sh2
130+.* TLS +GLOBAL +HIDDEN +9 sh6
131+.* TLS +GLOBAL +DEFAULT +10 bg2
132+.* TLS +GLOBAL +DEFAULT +10 bg1
133+.* TLS +GLOBAL +DEFAULT +10 bg4
--- a/ld/testsuite/ld-sparc/tlssunbin64.sd
+++ b/ld/testsuite/ld-sparc/tlssunbin64.sd
@@ -7,6 +7,6 @@
77 .*: +file format elf64-sparc
88
99 Contents of section .got:
10- 202308 0+ 0+202208 0+ 0+ .*
11- 202318 0+ 0+ 0+ 0+ .*
12- 202328 0+ 0+ +.*
10+ 202338 0+ 0+202208 0+ 0+ .*
11+ 202348 0+ 0+ 0+ 0+ .*
12+ 202358 0+ 0+ +.*