From: Alan Modra Date: Tue, 15 Jan 2013 06:13:26 +0000 (+0000) Subject: bfd/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e24587436538578f3ee2dc671a8a619dd7a3f0bd;p=binutils-gdb.git bfd/ * elf64-ppc.c (ppc64_elf_size_stubs): Default shared libs to plt-thread-safe. gold/ * powerpc.cc (Target_powerpc::do_relax): Default shared libs to plt-thread-safe. ld/testsuite/ * ld-powerpc/tlsso.d: Adjust for plt-thread-safe stubs. * ld-powerpc/tlsso.g: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlstocso.d: Likewise. * ld-powerpc/tlstocso.g: Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c296b465036..7aeba6fb496 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2013-01-15 Alan Modra + + * elf64-ppc.c (ppc64_elf_size_stubs): Default shared libs to + plt-thread-safe. + 2013-01-14 Alan Modra PR binutils/14813 diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 151c0ceb293..9ce20af227e 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -11334,9 +11334,11 @@ ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size, htab->plt_static_chain = plt_static_chain; htab->plt_stub_align = plt_stub_align; + if (plt_thread_safe == -1 && !info->executable) + plt_thread_safe = 1; if (plt_thread_safe == -1) { - const char *const thread_starter[] = + static const char *const thread_starter[] = { "pthread_create", /* libstdc++ */ diff --git a/gold/ChangeLog b/gold/ChangeLog index cb6ec9e044a..f5969f0371f 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2013-01-15 Alan Modra + + * powerpc.cc (Target_powerpc::do_relax): Default shared libs to + plt-thread-safe. + 2013-01-15 Alan Modra * testsuite/Makefile.am (final_layout_script.lds): Handle .got section. diff --git a/gold/powerpc.cc b/gold/powerpc.cc index 2a2277c6c87..26ae337f427 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -2182,7 +2182,7 @@ Target_powerpc::do_relax(int pass, bool thread_safe = parameters->options().plt_thread_safe(); if (size == 64 && !parameters->options().user_set_plt_thread_safe()) { - const char* const thread_starter[] = + static const char* const thread_starter[] = { "pthread_create", /* libstdc++ */ @@ -2201,14 +2201,21 @@ Target_powerpc::do_relax(int pass, "GOMP_parallel_sections_start", }; - for (unsigned int i = 0; - i < sizeof(thread_starter) / sizeof(thread_starter[0]); - i++) + if (parameters->options().shared()) + thread_safe = true; + else { - Symbol* sym = symtab->lookup(thread_starter[i], NULL); - thread_safe = sym != NULL && sym->in_reg() && sym->in_real_elf(); - if (thread_safe) - break; + for (unsigned int i = 0; + i < sizeof(thread_starter) / sizeof(thread_starter[0]); + i++) + { + Symbol* sym = symtab->lookup(thread_starter[i], NULL); + thread_safe = (sym != NULL + && sym->in_reg() + && sym->in_real_elf()); + if (thread_safe) + break; + } } } this->plt_thread_safe_ = thread_safe; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index d58f4168239..fd14adcd946 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-01-15 Alan Modra + + * ld-powerpc/tlsso.d: Adjust for plt-thread-safe stubs. + * ld-powerpc/tlsso.g: Likewise. + * ld-powerpc/tlsso.r: Likewise. + * ld-powerpc/tlstocso.d: Likewise. + * ld-powerpc/tlstocso.g: Likewise. + 2013-01-15 Alan Modra * ld-plugin/lto-16a.d: Match powerpc64 function symbol type. diff --git a/ld/testsuite/ld-powerpc/tlsso.d b/ld/testsuite/ld-powerpc/tlsso.d index 38c7d95c393..e0bc9a083f8 100644 --- a/ld/testsuite/ld-powerpc/tlsso.d +++ b/ld/testsuite/ld-powerpc/tlsso.d @@ -13,20 +13,22 @@ Disassembly of section \.text: .* (e9 62 80 78|78 80 62 e9) ld r11,-32648\(r2\) .* (7d 69 03 a6|a6 03 69 7d) mtctr r11 .* (e8 42 80 80|80 80 42 e8) ld r2,-32640\(r2\) -.* (4e 80 04 20|20 04 80 4e) bctr +.* (28 22 00 00|00 00 22 28) cmpldi r2,0 +.* (4c e2 04 20|20 04 e2 4c) bnectr\+ +.* (48 00 00 ..|.. 00 00 48) b .* <__glink_PLTresolve\+0x38> .* <_start>: .* (38 62 80 20|20 80 62 38) addi r3,r2,-32736 -.* (4b ff ff e9|e9 ff ff 4b) bl .* +.* (4b ff ff ..|.. ff ff 4b) bl .*plt_call.__tls_get_addr.* .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) .* (38 62 80 50|50 80 62 38) addi r3,r2,-32688 -.* (4b ff ff dd|dd ff ff 4b) bl .* +.* (4b ff ff ..|.. ff ff 4b) bl .*plt_call.__tls_get_addr.* .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) .* (38 62 80 38|38 80 62 38) addi r3,r2,-32712 -.* (4b ff ff d1|d1 ff ff 4b) bl .* +.* (4b ff ff ..|.. ff ff 4b) bl .*plt_call.__tls_get_addr.* .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) .* (38 62 80 50|50 80 62 38) addi r3,r2,-32688 -.* (4b ff ff c5|c5 ff ff 4b) bl .* +.* (4b ff ff ..|.. ff ff 4b) bl .*plt_call.__tls_get_addr.* .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) .* (39 23 80 40|40 80 23 39) addi r9,r3,-32704 .* (3d 23 00 00|00 00 23 3d) addis r9,r3,0 @@ -39,10 +41,10 @@ Disassembly of section \.text: .* (3d 2d 00 00|00 00 2d 3d) addis r9,r13,0 .* (99 49 00 00|00 00 49 99) stb r10,0\(r9\) .* (38 62 80 08|08 80 62 38) addi r3,r2,-32760 -.* (4b ff ff 91|91 ff ff 4b) bl .* +.* (4b ff ff ..|.. ff ff 4b) bl .*plt_call.__tls_get_addr.* .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) .* (38 62 80 50|50 80 62 38) addi r3,r2,-32688 -.* (4b ff ff 85|85 ff ff 4b) bl .* +.* (4b ff ff ..|.. ff ff 4b) bl .*plt_call.__tls_get_addr.* .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) .* (f9 43 80 08|08 80 43 f9) std r10,-32760\(r3\) .* (3d 23 00 00|00 00 23 3d) addis r9,r3,0 diff --git a/ld/testsuite/ld-powerpc/tlsso.g b/ld/testsuite/ld-powerpc/tlsso.g index 6ff983757cb..85368033681 100644 --- a/ld/testsuite/ld-powerpc/tlsso.g +++ b/ld/testsuite/ld-powerpc/tlsso.g @@ -7,7 +7,7 @@ .*: +file format elf64-powerpc Contents of section \.got: -.* (00000000|80870100) (00018780|00000000) 00000000 00000000 .* + 10788 (00000000|88870100) (00018788|00000000) 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* diff --git a/ld/testsuite/ld-powerpc/tlsso.r b/ld/testsuite/ld-powerpc/tlsso.r index 815e3ac66ff..2475fb47f92 100644 --- a/ld/testsuite/ld-powerpc/tlsso.r +++ b/ld/testsuite/ld-powerpc/tlsso.r @@ -48,9 +48,9 @@ Relocation section '\.rela\.dyn' at offset .* contains 16 entries: [0-9a-f ]+R_PPC64_TPREL16 +0+60 le0 \+ 0 [0-9a-f ]+R_PPC64_TPREL16_HA +0+68 le1 \+ 0 [0-9a-f ]+R_PPC64_TPREL16_LO +0+68 le1 \+ 0 -[0-9a-f ]+R_PPC64_TPREL16_DS +0+105f8 \.tdata \+ 28 -[0-9a-f ]+R_PPC64_TPREL16_HA +0+105f8 \.tdata \+ 30 -[0-9a-f ]+R_PPC64_TPREL16_LO +0+105f8 \.tdata \+ 30 +[0-9a-f ]+R_PPC64_TPREL16_DS +[0-9a-f]+ \.tdata \+ 28 +[0-9a-f ]+R_PPC64_TPREL16_HA +[0-9a-f]+ \.tdata \+ 30 +[0-9a-f ]+R_PPC64_TPREL16_LO +[0-9a-f]+ \.tdata \+ 30 [0-9a-f ]+R_PPC64_DTPMOD64 +0 [0-9a-f ]+R_PPC64_DTPREL64 +0 [0-9a-f ]+R_PPC64_DTPREL64 +18 diff --git a/ld/testsuite/ld-powerpc/tlstocso.d b/ld/testsuite/ld-powerpc/tlstocso.d index 32c1682a374..c91c30b9f8c 100644 --- a/ld/testsuite/ld-powerpc/tlstocso.d +++ b/ld/testsuite/ld-powerpc/tlstocso.d @@ -13,20 +13,22 @@ Disassembly of section \.text: .* (e9 62 80 70|70 80 62 e9) ld r11,-32656\(r2\) .* (7d 69 03 a6|a6 03 69 7d) mtctr r11 .* (e8 42 80 78|78 80 42 e8) ld r2,-32648\(r2\) -.* (4e 80 04 20|20 04 80 4e) bctr +.* (28 22 00 00|00 00 22 28) cmpldi r2,0 +.* (4c e2 04 20|20 04 e2 4c) bnectr\+ +.* (48 00 00 ..|.. 00 00 48) b .* <__glink_PLTresolve\+0x38> .* <_start>: .* (38 62 80 08|08 80 62 38) addi r3,r2,-32760 -.* (4b ff ff e9|e9 ff ff 4b) bl .* +.* (4b ff ff ..|.. ff ff 4b) bl .*plt_call.__tls_get_addr.* .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) .* (38 62 80 18|18 80 62 38) addi r3,r2,-32744 -.* (4b ff ff dd|dd ff ff 4b) bl .* +.* (4b ff ff ..|.. ff ff 4b) bl .*plt_call.__tls_get_addr.* .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) .* (38 62 80 28|28 80 62 38) addi r3,r2,-32728 -.* (4b ff ff d1|d1 ff ff 4b) bl .* +.* (4b ff ff ..|.. ff ff 4b) bl .*plt_call.__tls_get_addr.* .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) .* (38 62 80 38|38 80 62 38) addi r3,r2,-32712 -.* (4b ff ff c5|c5 ff ff 4b) bl .* +.* (4b ff ff ..|.. ff ff 4b) bl .*plt_call.__tls_get_addr.* .* (e8 41 00 28|28 00 41 e8) ld r2,40\(r1\) .* (39 23 80 40|40 80 23 39) addi r9,r3,-32704 .* (3d 23 00 00|00 00 23 3d) addis r9,r3,0 diff --git a/ld/testsuite/ld-powerpc/tlstocso.g b/ld/testsuite/ld-powerpc/tlstocso.g index 18fb6acaae8..a22497d9f5a 100644 --- a/ld/testsuite/ld-powerpc/tlstocso.g +++ b/ld/testsuite/ld-powerpc/tlstocso.g @@ -7,7 +7,7 @@ .* Contents of section \.got: -.* 00000000 (000186c0|c0860100) 00000000 00000000 .* + 106c8 00000000 (000186c8|c8860100) 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .* .* 00000000 00000000 00000000 00000000 .*