aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2009-09-21 11:51:02 +0000
committerAlan Modra <amodra@gmail.com>2009-09-21 11:51:02 +0000
commita7f2871e66570d025ce909c16bd53be5ff814191 (patch)
treedad2750ab64db9b81da21b0f7fb646de7b1bad85 /ld
parente0d602ecffb0256181ea45c653d261973c819d2b (diff)
downloadgdb-a7f2871e66570d025ce909c16bd53be5ff814191.zip
gdb-a7f2871e66570d025ce909c16bd53be5ff814191.tar.gz
gdb-a7f2871e66570d025ce909c16bd53be5ff814191.tar.bz2
include/elf/
* ppc.h (DT_PPC_TLSOPT): Define. * ppc64.h (DT_PPC64_TLSOPT): Define. bfd/ * elf32-ppc.c (TLS_GET_ADDR_GLINK_SIZE): Define. (ADD_3_12_2, BEQLR, CMPWI_11_0, LWZ_11_3, LWZ_12_3): Define. (MR_0_3, MR_3_0): Define. (struct ppc_elf_link_hash_table): Add no_tls_get_addr_opt. (ppc_elf_select_plt_layout): Save emit_stub_syms param earlier. (ppc_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash table. Check for presense of __tls_get_addr_opt (allocate_dynrelocs): Increase glink entry size for __tls_get_addr. (ppc_elf_size_dynamic_sections): Add DT_PPC_TLS_OPT tag. (write_glink_stub): Add param p. (ppc_elf_relocate_section): Adjust write_glink_stub call. (ppc_elf_finish_dynamic_symbol): Emit special glink call stub for __tls_get_addr. * elf32-ppc.h (ppc_elf_tls_setup): Update prototype. * elf64-ppc.c (struct ppc_link_hash_table): Add no_tls_get_addr_opt. (ppc64_elf_tls_setup): Add no_tls_get_addr_opt param and save to hash table. Check for presense of __tls_get_addr_opt. (ppc64_elf_size_dynamic_sections): Add DT_PPC64_TLS_OPT tag. (LD_R11_0R3, LD_R12_0R3, MR_R0_R3, CMPDI_R11_0, ADD_R3_R12_R13, BEQLR, MR_R3_R0, MFLR_R11, STD_R11_0R1, BCTRL, LD_R11_0R1, LD_R2_0R1, MTLR_R11): Define. (build_tls_get_addr_stub): New function. (ppc_build_one_stub): Call it. (ppc_size_one_stub): Add extra size for __tls_get_addr stub. (ppc64_elf_relocate_section): Don't change nop to ld 2,40(1) for __tls_get_addr plt call. * elf64-ppc.h (ppc64_elf_tls_setup): Update prototype. binutils/ * readelf.c (get_ppc_dynamic_type): Add TLSOPT. (get_ppc64_dynamic_type): Likewise. ld/ * emultempl/ppc32elf.em (no_tls_get_addr_opt): New var. (ppc_before_allocation): Pass to ppc_elf_tls_setup. (OPTION_NO_TLS_GET_ADDR_OPT): Define. Redefine other options in terms of previous option. (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add --no-tls-get-addr-optimize. (PARSE_AND_LIST_ARGS_CASES): Handle it. * emultempl/ppc64elf.em (no_tls_get_addr_opt): New var. (ppc_before_allocation): Pass to ppc64_elf_tls_setup. (OPTION_NO_TLS_GET_ADDR_OPT): Define. (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add --no-tls-get-addr-optimize. (PARSE_AND_LIST_ARGS_CASES): Handle it. ld/testsuite/ * ld-powerpc/tlslib.s: Delete dot-symbol entry syms. Add __tls_get_addr_opt. * ld-powerpc/tlslib32.s: Add __tls_get_addr_opt. * ld-powerpc/oldtlslib.s: New file, old-abi version of tlslib.s. * ld-powerpc/powerpc.exp: Build old-abi library and use it in two new link tests. * ld-powerpc/tlsexe.d: Update for new __tls_get_addr stub. * ld-powerpc/tlsexe.g, * ld-powerpc/tlsexe.r, *ld-powerpc/tlsexe32.d, * ld-powerpc/tlsexe32.g, * ld-powerpc/tlsexe32.r, * ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g, * ld-powerpc/tlsexetoc.r: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog16
-rw-r--r--ld/emultempl/ppc32elf.em20
-rw-r--r--ld/emultempl/ppc64elf.em15
-rw-r--r--ld/testsuite/ChangeLog14
-rw-r--r--ld/testsuite/ld-powerpc/oldtlslib.s29
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp11
-rw-r--r--ld/testsuite/ld-powerpc/tlsexe.d24
-rw-r--r--ld/testsuite/ld-powerpc/tlsexe.g2
-rw-r--r--ld/testsuite/ld-powerpc/tlsexe.r12
-rw-r--r--ld/testsuite/ld-powerpc/tlsexe32.d4
-rw-r--r--ld/testsuite/ld-powerpc/tlsexe32.g2
-rw-r--r--ld/testsuite/ld-powerpc/tlsexe32.r6
-rw-r--r--ld/testsuite/ld-powerpc/tlsexetoc.d28
-rw-r--r--ld/testsuite/ld-powerpc/tlsexetoc.g2
-rw-r--r--ld/testsuite/ld-powerpc/tlsexetoc.r12
-rw-r--r--ld/testsuite/ld-powerpc/tlslib.s11
-rw-r--r--ld/testsuite/ld-powerpc/tlslib32.s4
17 files changed, 168 insertions, 44 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 5226599..9c16d6a 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,19 @@
+2009-09-21 Alan Modra <amodra@bigpond.net.au>
+
+ * emultempl/ppc32elf.em (no_tls_get_addr_opt): New var.
+ (ppc_before_allocation): Pass to ppc_elf_tls_setup.
+ (OPTION_NO_TLS_GET_ADDR_OPT): Define. Redefine other options in
+ terms of previous option.
+ (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
+ --no-tls-get-addr-optimize.
+ (PARSE_AND_LIST_ARGS_CASES): Handle it.
+ * emultempl/ppc64elf.em (no_tls_get_addr_opt): New var.
+ (ppc_before_allocation): Pass to ppc64_elf_tls_setup.
+ (OPTION_NO_TLS_GET_ADDR_OPT): Define.
+ (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add
+ --no-tls-get-addr-optimize.
+ (PARSE_AND_LIST_ARGS_CASES): Handle it.
+
2009-09-18 Nick Clifton <nickc@redhat.com>
* po/es.po: Updated Spanish translation.
diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
index c54f35c..2295ae9 100644
--- a/ld/emultempl/ppc32elf.em
+++ b/ld/emultempl/ppc32elf.em
@@ -33,6 +33,7 @@ fragment <<EOF
/* Whether to run tls optimization. */
static int notlsopt = 0;
+static int no_tls_get_addr_opt = 0;
/* Whether to emit symbols for stubs. */
static int emit_stub_syms = 0;
@@ -103,7 +104,9 @@ ppc_before_allocation (void)
{
if (is_ppc_elf (link_info.output_bfd))
{
- if (ppc_elf_tls_setup (link_info.output_bfd, &link_info) && !notlsopt)
+ if (ppc_elf_tls_setup (link_info.output_bfd, &link_info,
+ no_tls_get_addr_opt)
+ && !notlsopt)
{
if (!ppc_elf_tls_optimize (link_info.output_bfd, &link_info))
{
@@ -174,15 +177,17 @@ fi
#
PARSE_AND_LIST_PROLOGUE='
#define OPTION_NO_TLS_OPT 301
-#define OPTION_NEW_PLT 302
-#define OPTION_OLD_PLT 303
-#define OPTION_OLD_GOT 304
-#define OPTION_STUBSYMS 305
+#define OPTION_NO_TLS_GET_ADDR_OPT (OPTION_NO_TLS_OPT + 1)
+#define OPTION_NEW_PLT (OPTION_NO_TLS_GET_ADDR_OPT + 1)
+#define OPTION_OLD_PLT (OPTION_NEW_PLT + 1)
+#define OPTION_OLD_GOT (OPTION_OLD_PLT + 1)
+#define OPTION_STUBSYMS (OPTION_OLD_GOT + 1)
'
PARSE_AND_LIST_LONGOPTS='
{ "emit-stub-syms", no_argument, NULL, OPTION_STUBSYMS },
{ "no-tls-optimize", no_argument, NULL, OPTION_NO_TLS_OPT },
+ { "no-tls-get-addr-optimize", no_argument, NULL, OPTION_NO_TLS_GET_ADDR_OPT },
{ "secure-plt", no_argument, NULL, OPTION_NEW_PLT },
{ "bss-plt", no_argument, NULL, OPTION_OLD_PLT },
{ "sdata-got", no_argument, NULL, OPTION_OLD_GOT },
@@ -192,6 +197,7 @@ PARSE_AND_LIST_OPTIONS='
fprintf (file, _("\
--emit-stub-syms Label linker stubs with a symbol.\n\
--no-tls-optimize Don'\''t try to optimize TLS accesses.\n\
+ --no-tls-get-addr-optimize Don'\''t use a special __tls_get_addr call.\n\
--secure-plt Use new-style PLT if possible.\n\
--bss-plt Force old-style BSS PLT.\n\
--sdata-got Force GOT location just before .sdata.\n"
@@ -207,6 +213,10 @@ PARSE_AND_LIST_ARGS_CASES='
notlsopt = 1;
break;
+ case OPTION_NO_TLS_GET_ADDR_OPT:
+ no_tls_get_addr_opt = 1;
+ break;
+
case OPTION_NEW_PLT:
plt_style = PLT_NEW;
break;
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index 05afbb1..09f0f17 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -47,6 +47,7 @@ static int dotsyms = 1;
/* Whether to run tls optimization. */
static int no_tls_opt = 0;
+static int no_tls_get_addr_opt = 0;
/* Whether to run opd optimization. */
static int no_opd_opt = 0;
@@ -106,7 +107,8 @@ ppc_before_allocation (void)
non_overlapping_opd))
einfo ("%X%P: can not edit %s %E\n", "opd");
- if (ppc64_elf_tls_setup (link_info.output_bfd, &link_info)
+ if (ppc64_elf_tls_setup (link_info.output_bfd, &link_info,
+ no_tls_get_addr_opt)
&& !no_tls_opt)
{
/* Size the sections. This is premature, but we want to know the
@@ -488,7 +490,8 @@ PARSE_AND_LIST_PROLOGUE='
#define OPTION_DOTSYMS (OPTION_STUBSYMS + 1)
#define OPTION_NO_DOTSYMS (OPTION_DOTSYMS + 1)
#define OPTION_NO_TLS_OPT (OPTION_NO_DOTSYMS + 1)
-#define OPTION_NO_OPD_OPT (OPTION_NO_TLS_OPT + 1)
+#define OPTION_NO_TLS_GET_ADDR_OPT (OPTION_NO_TLS_OPT + 1)
+#define OPTION_NO_OPD_OPT (OPTION_NO_TLS_GET_ADDR_OPT + 1)
#define OPTION_NO_TOC_OPT (OPTION_NO_OPD_OPT + 1)
#define OPTION_NO_MULTI_TOC (OPTION_NO_TOC_OPT + 1)
#define OPTION_NON_OVERLAPPING_OPD (OPTION_NO_MULTI_TOC + 1)
@@ -500,6 +503,7 @@ PARSE_AND_LIST_LONGOPTS='
{ "dotsyms", no_argument, NULL, OPTION_DOTSYMS },
{ "no-dotsyms", no_argument, NULL, OPTION_NO_DOTSYMS },
{ "no-tls-optimize", no_argument, NULL, OPTION_NO_TLS_OPT },
+ { "no-tls-get-addr-optimize", no_argument, NULL, OPTION_NO_TLS_GET_ADDR_OPT },
{ "no-opd-optimize", no_argument, NULL, OPTION_NO_OPD_OPT },
{ "no-toc-optimize", no_argument, NULL, OPTION_NO_TOC_OPT },
{ "no-multi-toc", no_argument, NULL, OPTION_NO_MULTI_TOC },
@@ -533,6 +537,9 @@ PARSE_AND_LIST_OPTIONS='
--no-tls-optimize Don'\''t try to optimize TLS accesses.\n"
));
fprintf (file, _("\
+ --no-tls-get-addr-optimize Don'\''t use a special __tls_get_addr call.\n"
+ ));
+ fprintf (file, _("\
--no-opd-optimize Don'\''t optimize the OPD section.\n"
));
fprintf (file, _("\
@@ -573,6 +580,10 @@ PARSE_AND_LIST_ARGS_CASES='
no_tls_opt = 1;
break;
+ case OPTION_NO_TLS_GET_ADDR_OPT:
+ no_tls_get_addr_opt = 1;
+ break;
+
case OPTION_NO_OPD_OPT:
no_opd_opt = 1;
break;
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 8d1b1ec..3185e3b 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,17 @@
+2009-09-21 Alan Modra <amodra@bigpond.net.au>
+
+ * ld-powerpc/tlslib.s: Delete dot-symbol entry syms. Add
+ __tls_get_addr_opt.
+ * ld-powerpc/tlslib32.s: Add __tls_get_addr_opt.
+ * ld-powerpc/oldtlslib.s: New file, old-abi version of tlslib.s.
+ * ld-powerpc/powerpc.exp: Build old-abi library and use it in
+ two new link tests.
+ * ld-powerpc/tlsexe.d: Update for new __tls_get_addr stub.
+ * ld-powerpc/tlsexe.g, * ld-powerpc/tlsexe.r, *ld-powerpc/tlsexe32.d,
+ * ld-powerpc/tlsexe32.g, * ld-powerpc/tlsexe32.r,
+ * ld-powerpc/tlsexetoc.d, * ld-powerpc/tlsexetoc.g,
+ * ld-powerpc/tlsexetoc.r: Likewise.
+
2009-09-20 Richard Sandiford <rdsandiford@googlemail.com>
* ld-mips-elf/elf-rel-got-n64-linux.d: Expect BALs.
diff --git a/ld/testsuite/ld-powerpc/oldtlslib.s b/ld/testsuite/ld-powerpc/oldtlslib.s
new file mode 100644
index 0000000..5786df1
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/oldtlslib.s
@@ -0,0 +1,29 @@
+ .global __tls_get_addr,__tls_get_addr_opt,gd,ld
+ .global .__tls_get_addr,.__tls_get_addr_opt
+ .type .__tls_get_addr,@function
+ .type .__tls_get_addr_opt,@function
+
+ .section ".opd","aw",@progbits
+__tls_get_addr:
+__tls_get_addr_opt:
+ .align 3
+ .quad .__tls_get_addr
+ .quad .TOC.@tocbase
+ .quad 0
+ .size __tls_get_addr,24
+ .size __tls_get_addr_opt,24
+
+ .section ".tbss","awT",@nobits
+ .align 3
+gd: .space 8
+
+ .section ".tdata","awT",@progbits
+ .align 2
+ld: .long 0xc0ffee
+
+ .text
+.__tls_get_addr:
+.__tls_get_addr_opt:
+ blr
+ .size .__tls_get_addr,. - .__tls_get_addr
+ .size .__tls_get_addr_opt,. - .__tls_get_addr_opt
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 26eaac7..fce9664 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -138,10 +138,16 @@ set ppc64elftests {
"tls"}
{"TLS helper shared library" "-shared -melf64ppc tmpdir/tlslib.o" "" {}
{} "libtlslib.so"}
+ {"TLS helper old shared lib" "-shared -melf64ppc" "-a64" {oldtlslib.s}
+ {} "liboldlib.so"}
{"TLS dynamic exec" "-melf64ppc tmpdir/tls.o tmpdir/libtlslib.so" "" {}
{{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
{objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
"tlsexe"}
+ {"TLS dynamic old" "-melf64ppc tmpdir/tls.o tmpdir/liboldlib.so" "" {}
+ {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d}
+ {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}}
+ "tlsexeold"}
{"TLS shared" "-shared -melf64ppc tmpdir/tls.o" "" {}
{{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d}
{objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}}
@@ -155,6 +161,11 @@ set ppc64elftests {
{{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
{objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
"tlsexetoc"}
+ {"TLSTOC dynamic old" "-melf64ppc tmpdir/tlstoc.o tmpdir/liboldlib.so"
+ "" {}
+ {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d}
+ {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}}
+ "tlsexetocold"}
{"TLSTOC shared" "-shared -melf64ppc tmpdir/tlstoc.o" "" {}
{{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d}
{objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}}
diff --git a/ld/testsuite/ld-powerpc/tlsexe.d b/ld/testsuite/ld-powerpc/tlsexe.d
index 825434e..e7f1e4c 100644
--- a/ld/testsuite/ld-powerpc/tlsexe.d
+++ b/ld/testsuite/ld-powerpc/tlsexe.d
@@ -8,21 +8,34 @@
Disassembly of section \.text:
-.* <_start-0x18>:
+.* <_start-0x4c>:
+.* e9 63 00 00 ld r11,0\(r3\)
+.* e9 83 00 08 ld r12,8\(r3\)
+.* 7c 60 1b 78 mr r0,r3
+.* 2c 2b 00 00 cmpdi r11,0
+.* 7c 6c 6a 14 add r3,r12,r13
+.* 4d 82 00 20 beqlr
+.* 7c 03 03 78 mr r3,r0
+.* 7d 68 02 a6 mflr r11
+.* f9 61 00 20 std r11,32\(r1\)
.* f8 41 00 28 std r2,40\(r1\)
.* e9 62 80 48 ld r11,-32696\(r2\)
.* 7d 69 03 a6 mtctr r11
.* e9 62 80 58 ld r11,-32680\(r2\)
.* e8 42 80 50 ld r2,-32688\(r2\)
-.* 4e 80 04 20 bctr
+.* 4e 80 04 21 bctrl
+.* e9 61 00 20 ld r11,32\(r1\)
+.* e8 41 00 28 ld r2,40\(r1\)
+.* 7d 68 03 a6 mtlr r11
+.* 4e 80 00 20 blr
.* <_start>:
.* e8 62 80 10 ld r3,-32752\(r2\)
.* 60 00 00 00 nop
.* 7c 63 6a 14 add r3,r3,r13
.* 38 62 80 18 addi r3,r2,-32744
-.* 4b ff ff d9 bl .*
-.* e8 41 00 28 ld r2,40\(r1\)
+.* 4b ff ff a5 bl .*
+.* 60 00 00 00 nop
.* 3c 6d 00 00 addis r3,r13,0
.* 60 00 00 00 nop
.* 38 63 90 38 addi r3,r3,-28616
@@ -55,8 +68,9 @@ Disassembly of section \.text:
.* e9 4d 90 2a lwa r10,-28632\(r13\)
.* 3d 2d 00 00 addis r9,r13,0
.* a9 49 90 30 lha r10,-28624\(r9\)
+.* 60 00 00 00 nop
.* 00 00 00 00 .*
-.* 00 01 01 f0 .*
+.* 00 01 02 00 .*
.* 7d 88 02 a6 mflr r12
.* 42 9f 00 05 bcl- 20,4\*cr7\+so,.*
.* 7d 68 02 a6 mflr r11
diff --git a/ld/testsuite/ld-powerpc/tlsexe.g b/ld/testsuite/ld-powerpc/tlsexe.g
index 58280df..c68175f 100644
--- a/ld/testsuite/ld-powerpc/tlsexe.g
+++ b/ld/testsuite/ld-powerpc/tlsexe.g
@@ -7,6 +7,6 @@
.*: +file format elf64-powerpc
Contents of section \.got:
-.* 00000000 100185c8 ffffffff ffff8018 .*
+.* 00000000 10018618 ffffffff ffff8018 .*
.* 00000000 00000000 00000000 00000000 .*
.* 00000000 00000000 00000000 00000000 .*
diff --git a/ld/testsuite/ld-powerpc/tlsexe.r b/ld/testsuite/ld-powerpc/tlsexe.r
index b73aaf1..b4be766 100644
--- a/ld/testsuite/ld-powerpc/tlsexe.r
+++ b/ld/testsuite/ld-powerpc/tlsexe.r
@@ -16,10 +16,10 @@ Section Headers:
+\[[ 0-9]+\] \.dynstr +.*
+\[[ 0-9]+\] \.rela\.dyn +.*
+\[[ 0-9]+\] \.rela\.plt +.*
- +\[[ 0-9]+\] \.text +PROGBITS .* 0+f8 0+ +AX +0 +0 +8
+ +\[[ 0-9]+\] \.text +PROGBITS .* 0+130 0+ +AX +0 +0 +8
+\[[ 0-9]+\] \.tdata +PROGBITS .* 0+38 0+ WAT +0 +0 +8
+\[[ 0-9]+\] \.tbss +NOBITS .* 0+38 0+ WAT +0 +0 +8
- +\[[ 0-9]+\] \.dynamic +DYNAMIC .* 0+150 10 +WA +4 +0 +8
+ +\[[ 0-9]+\] \.dynamic +DYNAMIC .* 0+160 10 +WA +4 +0 +8
+\[[ 0-9]+\] \.branch_lt + PROGBITS .* 0+ 0+ +WA +0 +0 +8
+\[[ 0-9]+\] \.got +PROGBITS .* 0+30 08 +WA +0 +0 +8
+\[[ 0-9]+\] \.plt +.*
@@ -59,16 +59,16 @@ Relocation section '\.rela\.dyn' at offset .* contains 3 entries:
Relocation section '\.rela\.plt' at offset .* contains 1 entries:
+Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
-[0-9a-f ]+R_PPC64_JMP_SLOT +0+ __tls_get_addr \+ 0
+[0-9a-f ]+R_PPC64_JMP_SLOT +0+ __tls_get_addr_opt \+ 0
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
.* NOTYPE +LOCAL +DEFAULT +UND
.* TLS +GLOBAL DEFAULT +UND gd
-.* FUNC +GLOBAL DEFAULT +UND __tls_get_addr
.* TLS +GLOBAL DEFAULT +UND ld
.* TLS +GLOBAL DEFAULT +9 ld2
.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +UND __tls_get_addr_opt
.* NOTYPE +GLOBAL DEFAULT +ABS _edata
.* NOTYPE +GLOBAL DEFAULT +ABS _end
@@ -96,10 +96,9 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* TLS +LOCAL +DEFAULT +8 le4
.* TLS +LOCAL +DEFAULT +8 le5
.* OBJECT +LOCAL +HIDDEN +10 _DYNAMIC
-.* FUNC +LOCAL +DEFAULT +UND \.__tls_get_addr
+.* (FUNC|NOTYPE) +LOCAL +DEFAULT +UND \.__tls_get_addr(|_opt)
.* GLOBAL DEFAULT +UND gd
.* GLOBAL DEFAULT +9 le0
-.* GLOBAL DEFAULT +UND __tls_get_addr
.* GLOBAL DEFAULT +9 ld0
.* GLOBAL DEFAULT +9 le1
.* GLOBAL DEFAULT +UND ld
@@ -107,6 +106,7 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* TLS +GLOBAL DEFAULT +9 ld2
.* TLS +GLOBAL DEFAULT +9 ld1
.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt
.* NOTYPE +GLOBAL DEFAULT +ABS _edata
.* NOTYPE +GLOBAL DEFAULT +ABS _end
.* TLS +GLOBAL DEFAULT +9 gd0
diff --git a/ld/testsuite/ld-powerpc/tlsexe32.d b/ld/testsuite/ld-powerpc/tlsexe32.d
index c69e335..527ded0 100644
--- a/ld/testsuite/ld-powerpc/tlsexe32.d
+++ b/ld/testsuite/ld-powerpc/tlsexe32.d
@@ -12,7 +12,7 @@ Disassembly of section \.text:
.*: 80 7f ff f0 lwz r3,-16\(r31\)
.*: 7c 63 12 14 add r3,r3,r2
.*: 38 7f ff f4 addi r3,r31,-12
-.*: 48 01 01 85 bl .*<__tls_get_addr@plt>
+.*: 48 01 01 85 bl .*<__tls_get_addr_opt@plt>
.*: 3c 62 00 00 addis r3,r2,0
.*: 38 63 90 1c addi r3,r3,-28644
.*: 3c 62 00 00 addis r3,r2,0
@@ -44,4 +44,4 @@ Disassembly of section \.got:
.*: 4e 80 00 21 blrl
.* <_GLOBAL_OFFSET_TABLE_>:
-.*: 01 81 02 b4 00 00 00 00 00 00 00 00 .*
+.*: 01 81 02 b8 00 00 00 00 00 00 00 00 .*
diff --git a/ld/testsuite/ld-powerpc/tlsexe32.g b/ld/testsuite/ld-powerpc/tlsexe32.g
index 14b7f8c..c2023a8 100644
--- a/ld/testsuite/ld-powerpc/tlsexe32.g
+++ b/ld/testsuite/ld-powerpc/tlsexe32.g
@@ -8,4 +8,4 @@
Contents of section \.got:
.* 00000000 00000000 00000000 4e800021 .*
-.* 018102b4 00000000 00000000 .*
+.* 018102b8 00000000 00000000 .*
diff --git a/ld/testsuite/ld-powerpc/tlsexe32.r b/ld/testsuite/ld-powerpc/tlsexe32.r
index 86a0ab8..f2c1a45 100644
--- a/ld/testsuite/ld-powerpc/tlsexe32.r
+++ b/ld/testsuite/ld-powerpc/tlsexe32.r
@@ -57,16 +57,16 @@ Relocation section '\.rela\.dyn' at offset .* contains 2 entries:
Relocation section '\.rela\.plt' at offset .* contains 1 entries:
Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
-[0-9a-f ]+R_PPC_JMP_SLOT[0-9a-f ]+__tls_get_addr \+ 0
+[0-9a-f ]+R_PPC_JMP_SLOT[0-9a-f ]+__tls_get_addr_opt \+ 0
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
.* NOTYPE +LOCAL +DEFAULT +UND
.* TLS +GLOBAL DEFAULT +UND gd
-.* FUNC +GLOBAL DEFAULT +UND __tls_get_addr
.* TLS +GLOBAL DEFAULT +UND ld
.* NOTYPE +GLOBAL DEFAULT +ABS __end
.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +UND __tls_get_addr_opt
.* NOTYPE +GLOBAL DEFAULT +ABS _edata
.* NOTYPE +GLOBAL DEFAULT +ABS _end
@@ -96,7 +96,6 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* OBJECT +LOCAL +HIDDEN +11 _GLOBAL_OFFSET_TABLE_
.* TLS +GLOBAL DEFAULT +UND gd
.* TLS +GLOBAL DEFAULT +9 le0
-.* FUNC +GLOBAL DEFAULT +UND __tls_get_addr
.* TLS +GLOBAL DEFAULT +9 ld0
.* TLS +GLOBAL DEFAULT +9 le1
.* TLS +GLOBAL DEFAULT +UND ld
@@ -105,6 +104,7 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* TLS +GLOBAL DEFAULT +9 ld2
.* TLS +GLOBAL DEFAULT +9 ld1
.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +UND __tls_get_addr_opt
.* NOTYPE +GLOBAL DEFAULT +ABS _edata
.* NOTYPE +GLOBAL DEFAULT +ABS _end
.* TLS +GLOBAL DEFAULT +9 gd0
diff --git a/ld/testsuite/ld-powerpc/tlsexetoc.d b/ld/testsuite/ld-powerpc/tlsexetoc.d
index d6a0388..83b1aca 100644
--- a/ld/testsuite/ld-powerpc/tlsexetoc.d
+++ b/ld/testsuite/ld-powerpc/tlsexetoc.d
@@ -8,21 +8,34 @@
Disassembly of section \.text:
-.* <_start-0x18>:
+.* <_start-0x4c>:
+.* e9 63 00 00 ld r11,0\(r3\)
+.* e9 83 00 08 ld r12,8\(r3\)
+.* 7c 60 1b 78 mr r0,r3
+.* 2c 2b 00 00 cmpdi r11,0
+.* 7c 6c 6a 14 add r3,r12,r13
+.* 4d 82 00 20 beqlr
+.* 7c 03 03 78 mr r3,r0
+.* 7d 68 02 a6 mflr r11
+.* f9 61 00 20 std r11,32\(r1\)
.* f8 41 00 28 std r2,40\(r1\)
.* e9 62 80 70 ld r11,-32656\(r2\)
.* 7d 69 03 a6 mtctr r11
.* e9 62 80 80 ld r11,-32640\(r2\)
.* e8 42 80 78 ld r2,-32648\(r2\)
-.* 4e 80 04 20 bctr
+.* 4e 80 04 21 bctrl
+.* e9 61 00 20 ld r11,32\(r1\)
+.* e8 41 00 28 ld r2,40\(r1\)
+.* 7d 68 03 a6 mtlr r11
+.* 4e 80 00 20 blr
.* <_start>:
.* 38 62 80 08 addi r3,r2,-32760
-.* 4b ff ff e5 bl .*
-.* e8 41 00 28 ld r2,40\(r1\)
+.* 4b ff ff b1 bl .*
+.* 60 00 00 00 nop
.* 38 62 80 18 addi r3,r2,-32744
-.* 4b ff ff d9 bl .*
-.* e8 41 00 28 ld r2,40\(r1\)
+.* 4b ff ff a5 bl .*
+.* 60 00 00 00 nop
.* 3c 6d 00 00 addis r3,r13,0
.* 60 00 00 00 nop
.* 38 63 90 38 addi r3,r3,-28616
@@ -39,8 +52,9 @@ Disassembly of section \.text:
.* 89 4d 90 60 lbz r10,-28576\(r13\)
.* 3d 2d 00 00 addis r9,r13,0
.* 99 49 90 68 stb r10,-28568\(r9\)
+.* 60 00 00 00 nop
.* 00 00 00 00 .*
-.* 00 01 02 18 .*
+.* 00 01 02 28 .*
.* 7d 88 02 a6 mflr r12
.* 42 9f 00 05 bcl- 20,4\*cr7\+so,.*
.* 7d 68 02 a6 mflr r11
diff --git a/ld/testsuite/ld-powerpc/tlsexetoc.g b/ld/testsuite/ld-powerpc/tlsexetoc.g
index df3994c..387e9cd 100644
--- a/ld/testsuite/ld-powerpc/tlsexetoc.g
+++ b/ld/testsuite/ld-powerpc/tlsexetoc.g
@@ -7,7 +7,7 @@
.*: +file format elf64-powerpc
Contents of section \.got:
-.* 00000000 10018568 00000000 00000000 .*
+.* 00000000 100185b0 00000000 00000000 .*
.* 00000000 00000000 00000000 00000000 .*
.* 00000000 00000000 00000000 00000001 .*
.* 00000000 00000000 00000000 00000001 .*
diff --git a/ld/testsuite/ld-powerpc/tlsexetoc.r b/ld/testsuite/ld-powerpc/tlsexetoc.r
index e16bbf4..d1f75df 100644
--- a/ld/testsuite/ld-powerpc/tlsexetoc.r
+++ b/ld/testsuite/ld-powerpc/tlsexetoc.r
@@ -16,10 +16,10 @@ Section Headers:
+\[[ 0-9]+\] \.dynstr +.*
+\[[ 0-9]+\] \.rela\.dyn +.*
+\[[ 0-9]+\] \.rela\.plt +.*
- +\[[ 0-9]+\] \.text +PROGBITS .* 0+b8 0+ +AX +0 +0 +8
+ +\[[ 0-9]+\] \.text +PROGBITS .* 0+f0 0+ +AX +0 +0 +8
+\[[ 0-9]+\] \.tdata +PROGBITS .* 0+38 0+ WAT +0 +0 +8
+\[[ 0-9]+\] \.tbss +NOBITS .* 0+38 0+ WAT +0 +0 +8
- +\[[ 0-9]+\] \.dynamic +DYNAMIC .* 0+150 10 +WA +4 +0 +8
+ +\[[ 0-9]+\] \.dynamic +DYNAMIC .* 0+160 10 +WA +4 +0 +8
+\[[ 0-9]+\] \.branch_lt +PROGBITS .* 0+ 0+ +WA +0 +0 +8
+\[[ 0-9]+\] \.got +PROGBITS .* 0+58 08 +WA +0 +0 +8
+\[[ 0-9]+\] \.plt +.*
@@ -59,15 +59,15 @@ Relocation section '\.rela\.dyn' at offset .* contains 3 entries:
Relocation section '\.rela\.plt' at offset .* contains 1 entries:
+Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
-[0-9a-f ]+R_PPC64_JMP_SLOT +0+ __tls_get_addr \+ 0
+[0-9a-f ]+R_PPC64_JMP_SLOT +0+ __tls_get_addr_opt \+ 0
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
.* NOTYPE +LOCAL +DEFAULT +UND
.* TLS +GLOBAL DEFAULT +UND gd
-.* FUNC +GLOBAL DEFAULT +UND __tls_get_addr
.* TLS +GLOBAL DEFAULT +UND ld
.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +UND __tls_get_addr_opt
.* NOTYPE +GLOBAL DEFAULT +ABS _edata
.* NOTYPE +GLOBAL DEFAULT +ABS _end
@@ -96,10 +96,9 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* TLS +LOCAL +DEFAULT +8 le5
.* NOTYPE +LOCAL +DEFAULT +12 \.Lie0
.* OBJECT +LOCAL +HIDDEN +10 _DYNAMIC
-.* FUNC +LOCAL +DEFAULT +UND \.__tls_get_addr
+.* (FUNC|NOTYPE) +LOCAL +DEFAULT +UND \.__tls_get_addr(|_opt)
.* TLS +GLOBAL DEFAULT +UND gd
.* TLS +GLOBAL DEFAULT +9 le0
-.* FUNC +GLOBAL DEFAULT +UND __tls_get_addr
.* TLS +GLOBAL DEFAULT +9 ld0
.* TLS +GLOBAL DEFAULT +9 le1
.* TLS +GLOBAL DEFAULT +UND ld
@@ -107,6 +106,7 @@ Symbol table '\.symtab' contains [0-9]+ entries:
.* TLS +GLOBAL DEFAULT +9 ld2
.* TLS +GLOBAL DEFAULT +9 ld1
.* NOTYPE +GLOBAL DEFAULT +ABS __bss_start
+.* FUNC +GLOBAL DEFAULT +UND __tls_get_addr_opt
.* NOTYPE +GLOBAL DEFAULT +ABS _edata
.* NOTYPE +GLOBAL DEFAULT +ABS _end
.* TLS +GLOBAL DEFAULT +9 gd0
diff --git a/ld/testsuite/ld-powerpc/tlslib.s b/ld/testsuite/ld-powerpc/tlslib.s
index 08f27a2..59c40d2 100644
--- a/ld/testsuite/ld-powerpc/tlslib.s
+++ b/ld/testsuite/ld-powerpc/tlslib.s
@@ -1,10 +1,12 @@
- .global .__tls_get_addr,__tls_get_addr,gd,ld
- .type .__tls_get_addr,@function
+ .global __tls_get_addr,__tls_get_addr_opt,gd,ld
+ .type __tls_get_addr,@function
+ .type __tls_get_addr_opt,@function
.section ".opd","aw",@progbits
__tls_get_addr:
+__tls_get_addr_opt:
.align 3
- .quad .__tls_get_addr
+ .quad .L.__tls_get_addr
.quad .TOC.@tocbase
.quad 0
@@ -17,5 +19,6 @@ gd: .space 8
ld: .long 0xc0ffee
.text
-.__tls_get_addr:
+.L.__tls_get_addr:
blr
+ .size __tls_get_addr,. - .L.__tls_get_addr
diff --git a/ld/testsuite/ld-powerpc/tlslib32.s b/ld/testsuite/ld-powerpc/tlslib32.s
index 98cd3e9..14dc966 100644
--- a/ld/testsuite/ld-powerpc/tlslib32.s
+++ b/ld/testsuite/ld-powerpc/tlslib32.s
@@ -1,5 +1,6 @@
- .global __tls_get_addr,gd,ld
+ .global __tls_get_addr,__tls_get_addr_opt,gd,ld
.type __tls_get_addr,@function
+ .type __tls_get_addr_opt,@function
.section ".tbss","awT",@nobits
.align 2
@@ -11,4 +12,5 @@ ld: .long 0xc0ffee
.text
__tls_get_addr:
+__tls_get_addr_opt:
blr