diff options
-rw-r--r-- | bfd/ChangeLog | 9 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 172 | ||||
-rw-r--r-- | bfd/elf64-ppc.h | 2 | ||||
-rw-r--r-- | ld/ChangeLog | 5 | ||||
-rw-r--r-- | ld/emultempl/ppc64elf.em | 3 | ||||
-rw-r--r-- | ld/testsuite/ChangeLog | 19 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsexe.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsexe.r | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsexetoc.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsexetoc.r | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsso.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsso.r | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlstocso.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlstocso.r | 2 |
14 files changed, 124 insertions, 102 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 22cf440..c8d5619 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2013-04-22 Alan Modra <amodra@gmail.com> + + * elf64-ppc.c (ppc64_elf_check_relocs): Don't call + create_linkage_sections here.. + (ppc64_elf_init_stub_bfd): ..do so here. Return status. + (create_linkage_sections): Move earlier in file. + (ppc64_elf_setup_section_lists): Remove now useless htab->brlt test. + * elf64-ppc.h (ppc64_elf_init_stub_bfd): Update proto. + 2013-04-19 Nick Clifton <nickc@redhat.com> PR binutils/15356 diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index e14bfb0..cb33821 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -4061,9 +4061,86 @@ ppc64_elf_link_hash_table_free (struct bfd_link_hash_table *hash) _bfd_elf_link_hash_table_free (hash); } +/* Create sections for linker generated code. */ + +static bfd_boolean +create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) +{ + struct ppc_link_hash_table *htab; + flagword flags; + + htab = ppc_hash_table (info); + + /* Create .sfpr for code to save and restore fp regs. */ + flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY + | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); + htab->sfpr = bfd_make_section_anyway_with_flags (dynobj, ".sfpr", + flags); + if (htab->sfpr == NULL + || ! bfd_set_section_alignment (dynobj, htab->sfpr, 2)) + return FALSE; + + /* Create .glink for lazy dynamic linking support. */ + htab->glink = bfd_make_section_anyway_with_flags (dynobj, ".glink", + flags); + if (htab->glink == NULL + || ! bfd_set_section_alignment (dynobj, htab->glink, 3)) + return FALSE; + + if (!info->no_ld_generated_unwind_info) + { + flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + htab->glink_eh_frame = bfd_make_section_anyway_with_flags (dynobj, + ".eh_frame", + flags); + if (htab->glink_eh_frame == NULL + || !bfd_set_section_alignment (dynobj, htab->glink_eh_frame, 2)) + return FALSE; + } + + flags = SEC_ALLOC | SEC_LINKER_CREATED; + htab->iplt = bfd_make_section_anyway_with_flags (dynobj, ".iplt", flags); + if (htab->iplt == NULL + || ! bfd_set_section_alignment (dynobj, htab->iplt, 3)) + return FALSE; + + flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY + | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); + htab->reliplt = bfd_make_section_anyway_with_flags (dynobj, + ".rela.iplt", + flags); + if (htab->reliplt == NULL + || ! bfd_set_section_alignment (dynobj, htab->reliplt, 3)) + return FALSE; + + /* Create branch lookup table for plt_branch stubs. */ + flags = (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); + htab->brlt = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt", + flags); + if (htab->brlt == NULL + || ! bfd_set_section_alignment (dynobj, htab->brlt, 3)) + return FALSE; + + if (!info->shared) + return TRUE; + + flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY + | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); + htab->relbrlt = bfd_make_section_anyway_with_flags (dynobj, + ".rela.branch_lt", + flags); + if (htab->relbrlt == NULL + || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3)) + return FALSE; + + return TRUE; +} + /* Satisfy the ELF linker by filling in some fields in our fake bfd. */ -void +bfd_boolean ppc64_elf_init_stub_bfd (bfd *abfd, struct bfd_link_info *info) { struct ppc_link_hash_table *htab; @@ -4075,9 +4152,14 @@ ppc64_elf_init_stub_bfd (bfd *abfd, struct bfd_link_info *info) the start of the output TOC section. */ htab = ppc_hash_table (info); if (htab == NULL) - return; + return FALSE; htab->stub_bfd = abfd; htab->elf.dynobj = abfd; + + if (info->relocatable) + return TRUE; + + return create_linkage_sections (htab->elf.dynobj, info); } /* Build a name for an entry in the stub hash table. */ @@ -4227,85 +4309,6 @@ ppc_add_stub (const char *stub_name, return stub_entry; } -/* Create sections for linker generated code. */ - -static bfd_boolean -create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) -{ - struct ppc_link_hash_table *htab; - flagword flags; - - htab = ppc_hash_table (info); - if (htab == NULL) - return FALSE; - - /* Create .sfpr for code to save and restore fp regs. */ - flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY - | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->sfpr = bfd_make_section_anyway_with_flags (dynobj, ".sfpr", - flags); - if (htab->sfpr == NULL - || ! bfd_set_section_alignment (dynobj, htab->sfpr, 2)) - return FALSE; - - /* Create .glink for lazy dynamic linking support. */ - htab->glink = bfd_make_section_anyway_with_flags (dynobj, ".glink", - flags); - if (htab->glink == NULL - || ! bfd_set_section_alignment (dynobj, htab->glink, 3)) - return FALSE; - - if (!info->no_ld_generated_unwind_info) - { - flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->glink_eh_frame = bfd_make_section_anyway_with_flags (dynobj, - ".eh_frame", - flags); - if (htab->glink_eh_frame == NULL - || !bfd_set_section_alignment (dynobj, htab->glink_eh_frame, 2)) - return FALSE; - } - - flags = SEC_ALLOC | SEC_LINKER_CREATED; - htab->iplt = bfd_make_section_anyway_with_flags (dynobj, ".iplt", flags); - if (htab->iplt == NULL - || ! bfd_set_section_alignment (dynobj, htab->iplt, 3)) - return FALSE; - - flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY - | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->reliplt = bfd_make_section_anyway_with_flags (dynobj, - ".rela.iplt", - flags); - if (htab->reliplt == NULL - || ! bfd_set_section_alignment (dynobj, htab->reliplt, 3)) - return FALSE; - - /* Create branch lookup table for plt_branch stubs. */ - flags = (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->brlt = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt", - flags); - if (htab->brlt == NULL - || ! bfd_set_section_alignment (dynobj, htab->brlt, 3)) - return FALSE; - - if (!info->shared) - return TRUE; - - flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY - | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->relbrlt = bfd_make_section_anyway_with_flags (dynobj, - ".rela.branch_lt", - flags); - if (htab->relbrlt == NULL - || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3)) - return FALSE; - - return TRUE; -} - /* Create .got and .rela.got sections in ABFD, and .got in dynobj if not already done. */ @@ -4983,10 +4986,6 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, ppc64_elf_section_data (sec)->sec_type = sec_opd; } - if (htab->sfpr == NULL - && !create_linkage_sections (htab->elf.dynobj, info)) - return FALSE; - rel_end = relocs + sec->reloc_count; for (rel = relocs; rel < rel_end; rel++) { @@ -10547,9 +10546,6 @@ ppc64_elf_setup_section_lists htab->add_stub_section = add_stub_section; htab->layout_sections_again = layout_sections_again; - if (htab->brlt == NULL) - return 0; - /* Find the top input section id. */ for (input_bfd = info->input_bfds, top_id = 3; input_bfd != NULL; diff --git a/bfd/elf64-ppc.h b/bfd/elf64-ppc.h index 2728b27..89495bc 100644 --- a/bfd/elf64-ppc.h +++ b/bfd/elf64-ppc.h @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -void ppc64_elf_init_stub_bfd +bfd_boolean ppc64_elf_init_stub_bfd (bfd *, struct bfd_link_info *); bfd_boolean ppc64_elf_edit_opd (struct bfd_link_info *, bfd_boolean); diff --git a/ld/ChangeLog b/ld/ChangeLog index a1841f2..d9ebc3d 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2013-04-22 Alan Modra <amodra@gmail.com> + + * emultempl/ppc64elf.em (ppc_create_output_section_statements): + Check return from ppc64_elf_init_stub_bfd. + 2013-04-15 Nick Clifton <nickc@redhat.com> * Makefile.am (ELF_DEPS): Add a dependency upon diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index d578f7f..43f9b61 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -107,7 +107,8 @@ ppc_create_output_section_statements (void) stub_file->the_bfd->flags |= BFD_LINKER_CREATED; ldlang_add_file (stub_file); - ppc64_elf_init_stub_bfd (stub_file->the_bfd, &link_info); + if (!ppc64_elf_init_stub_bfd (stub_file->the_bfd, &link_info)) + einfo ("%F%P: can not init BFD: %E\n"); } /* Move the input section statement at *U which happens to be on LIST diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index cc2c022..7ed0242 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2013-04-22 Alan Modra <amodra@gmail.com> + + * ld-powerpc/tlsexe.d: Adjust for section id changes. + * ld-powerpc/tlsexe.r: Likewise. + * ld-powerpc/tlsexetoc.d: Likewise. + * ld-powerpc/tlsexetoc.r: Likewise. + * ld-powerpc/tlsso.d: Likewise. + * ld-powerpc/tlsso.r: Likewise. + * ld-powerpc/tlstocso.d: Likewise. + * ld-powerpc/tlstocso.r: Likewise. + 2013-04-15 H.J. Lu <hongjiu.lu@intel.com> PR ld/15371 @@ -88,7 +99,7 @@ 2013-03-20 Will Newton <will.newton@linaro.org> - * ld-elfvers/vers.exp (objdump_symstuff): Sort objdump output + * ld-elfvers/vers.exp (objdump_symstuff): Sort objdump output based on the symbol name rather than address. * ld-elfvers/vers1.sym: Reorder contents to match changes to vers.exp. * ld-elfvers/vers15.sym: Likewise. @@ -122,7 +133,7 @@ 2013-03-08 Venkataramanan Kumar <venkataramanan.kumar@linaro.org> - * lib/ld-lib.exp (check_gc_sections_available): Remove aarch64 + * lib/ld-lib.exp (check_gc_sections_available): Remove aarch64 from list of targets that don't support gc-section. 2013-03-05 Alan Modra <amodra@gmail.com> @@ -191,9 +202,9 @@ 2013-02-18 Maciej W. Rozycki <macro@codesourcery.com> - * ld-mips-elf/jalx-2.ld: Include .rel.plt in output, give .plt a + * ld-mips-elf/jalx-2.ld: Include .rel.plt in output, give .plt a mapping. - * ld-mips-elf/jalx-2.dd: Adjust disassembly accordingly. + * ld-mips-elf/jalx-2.dd: Adjust disassembly accordingly. 2013-02-18 Alan Modra <amodra@gmail.com> diff --git a/ld/testsuite/ld-powerpc/tlsexe.d b/ld/testsuite/ld-powerpc/tlsexe.d index 8390551..ebbf2f0 100644 --- a/ld/testsuite/ld-powerpc/tlsexe.d +++ b/ld/testsuite/ld-powerpc/tlsexe.d @@ -8,7 +8,7 @@ Disassembly of section \.text: -.* <00000010\.plt_call\.__tls_get_addr(|_opt)>: +.* <.*plt_call\.__tls_get_addr(|_opt)>: .* (e9 63 00 00|00 00 63 e9) ld r11,0\(r3\) .* (e9 83 00 08|08 00 83 e9) ld r12,8\(r3\) .* (7c 60 1b 78|78 1b 60 7c) mr r0,r3 diff --git a/ld/testsuite/ld-powerpc/tlsexe.r b/ld/testsuite/ld-powerpc/tlsexe.r index 8d6ff30..788e6ac 100644 --- a/ld/testsuite/ld-powerpc/tlsexe.r +++ b/ld/testsuite/ld-powerpc/tlsexe.r @@ -96,9 +96,9 @@ Symbol table '\.symtab' contains [0-9]+ entries: .* TLS +LOCAL +DEFAULT +8 le5 .* (FUNC|NOTYPE) +LOCAL +DEFAULT +UND \.__tls_get_addr(|_opt) .* FILE +LOCAL +DEFAULT +ABS .* -.* NOTYPE +LOCAL +DEFAULT +7 00000010\.plt_call\.__tls_get_addr(|_opt) .* OBJECT +LOCAL +DEFAULT +10 _DYNAMIC .* NOTYPE +LOCAL +DEFAULT +7 __glink_PLTresolve +.* NOTYPE +LOCAL +DEFAULT +7 .*\.plt_call\.__tls_get_addr(|_opt) .* GLOBAL +DEFAULT +UND gd .* GLOBAL +DEFAULT +9 le0 .* GLOBAL +DEFAULT +9 ld0 diff --git a/ld/testsuite/ld-powerpc/tlsexetoc.d b/ld/testsuite/ld-powerpc/tlsexetoc.d index fc20992..635b0eb 100644 --- a/ld/testsuite/ld-powerpc/tlsexetoc.d +++ b/ld/testsuite/ld-powerpc/tlsexetoc.d @@ -8,7 +8,7 @@ Disassembly of section \.text: -.* <00000010\.plt_call\.__tls_get_addr(|_opt)>: +.* <.*plt_call\.__tls_get_addr(|_opt)>: .* (e9 63 00 00|00 00 63 e9) ld r11,0\(r3\) .* (e9 83 00 08|08 00 83 e9) ld r12,8\(r3\) .* (7c 60 1b 78|78 1b 60 7c) mr r0,r3 diff --git a/ld/testsuite/ld-powerpc/tlsexetoc.r b/ld/testsuite/ld-powerpc/tlsexetoc.r index 71d6c9e..8905d3f 100644 --- a/ld/testsuite/ld-powerpc/tlsexetoc.r +++ b/ld/testsuite/ld-powerpc/tlsexetoc.r @@ -96,9 +96,9 @@ Symbol table '\.symtab' contains [0-9]+ entries: .* NOTYPE +LOCAL +DEFAULT +11 \.Lie0 .* (FUNC|NOTYPE) +LOCAL +DEFAULT +UND \.__tls_get_addr(|_opt) .* FILE +LOCAL +DEFAULT +ABS .* -.* NOTYPE +LOCAL +DEFAULT +7 00000010\.plt_call\.__tls_get_addr(|_opt) .* OBJECT +LOCAL +DEFAULT +10 _DYNAMIC .* NOTYPE +LOCAL +DEFAULT +7 __glink_PLTresolve +.* NOTYPE +LOCAL +DEFAULT +7 .*\.plt_call\.__tls_get_addr(|_opt) .* TLS +GLOBAL +DEFAULT +UND gd .* TLS +GLOBAL +DEFAULT +9 le0 .* TLS +GLOBAL +DEFAULT +9 ld0 diff --git a/ld/testsuite/ld-powerpc/tlsso.d b/ld/testsuite/ld-powerpc/tlsso.d index 00b00a0..be8eae0 100644 --- a/ld/testsuite/ld-powerpc/tlsso.d +++ b/ld/testsuite/ld-powerpc/tlsso.d @@ -8,7 +8,7 @@ Disassembly of section \.text: -.* <00000010\.plt_call\.__tls_get_addr(|_opt)>: +.* <.*plt_call\.__tls_get_addr(|_opt)>: .* (f8 41 00 28|28 00 41 f8) std r2,40\(r1\) .* (e9 62 80 78|78 80 62 e9) ld r11,-32648\(r2\) .* (7d 69 03 a6|a6 03 69 7d) mtctr r11 diff --git a/ld/testsuite/ld-powerpc/tlsso.r b/ld/testsuite/ld-powerpc/tlsso.r index fab50e0..bc0c2ca 100644 --- a/ld/testsuite/ld-powerpc/tlsso.r +++ b/ld/testsuite/ld-powerpc/tlsso.r @@ -111,7 +111,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: .* NOTYPE +LOCAL +DEFAULT +UND \.__tls_get_addr .* FILE +LOCAL +DEFAULT +ABS .* .* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC -.* NOTYPE +LOCAL +DEFAULT +6 00000010\.plt_call\.__tls_get_addr +.* NOTYPE +LOCAL +DEFAULT +6 .*\.plt_call\.__tls_get_addr .* NOTYPE +LOCAL +DEFAULT +6 __glink_PLTresolve .* TLS +GLOBAL +DEFAULT +UND gd .* TLS +GLOBAL +DEFAULT +8 le0 diff --git a/ld/testsuite/ld-powerpc/tlstocso.d b/ld/testsuite/ld-powerpc/tlstocso.d index a0cd08f..b48597a 100644 --- a/ld/testsuite/ld-powerpc/tlstocso.d +++ b/ld/testsuite/ld-powerpc/tlstocso.d @@ -8,7 +8,7 @@ Disassembly of section \.text: -.* <00000010\.plt_call\.__tls_get_addr(|_opt)>: +.* <.*plt_call\.__tls_get_addr(|_opt)>: .* (f8 41 00 28|28 00 41 f8) std r2,40\(r1\) .* (e9 62 80 70|70 80 62 e9) ld r11,-32656\(r2\) .* (7d 69 03 a6|a6 03 69 7d) mtctr r11 diff --git a/ld/testsuite/ld-powerpc/tlstocso.r b/ld/testsuite/ld-powerpc/tlstocso.r index 1ec8b63..76943e7 100644 --- a/ld/testsuite/ld-powerpc/tlstocso.r +++ b/ld/testsuite/ld-powerpc/tlstocso.r @@ -107,7 +107,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: .* NOTYPE +LOCAL +DEFAULT +UND \.__tls_get_addr .* FILE +LOCAL +DEFAULT +ABS .* .* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC -.* NOTYPE +LOCAL +DEFAULT +6 00000010\.plt_call\.__tls_get_addr +.* NOTYPE +LOCAL +DEFAULT +6 .*\.plt_call\.__tls_get_addr .* NOTYPE +LOCAL +DEFAULT +6 __glink_PLTresolve .* TLS +GLOBAL +DEFAULT +UND gd .* TLS +GLOBAL +DEFAULT +8 le0 |