From: Alan Modra Date: Mon, 17 Feb 2003 22:49:24 +0000 (+0000) Subject: * emultempl/ppc64elf.em (ppc_create_output_section_statements): Check X-Git-Tag: binutils-2_14-branchpoint~823 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a015f5eccc7cdc779954195e0d65261bf71d2773;p=external%2Fbinutils.git * emultempl/ppc64elf.em (ppc_create_output_section_statements): Check hash creator. (ppc_before_allocation): Don't do optimizations if wrong hash table. (gld${EMULATION_NAME}_finish): Ditto. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 431345f..13dd4f4 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2003-02-18 Alan Modra + + * emultempl/ppc64elf.em (ppc_create_output_section_statements): Check + hash creator. + (ppc_before_allocation): Don't do optimizations if wrong hash table. + (gld${EMULATION_NAME}_finish): Ditto. + 2003-02-17 Nick Clifton * ldmain.c (main) Default allow_shlib_undefined to true. @@ -217,7 +224,7 @@ * scripttempl/elf32msp430_3.sc: New file. Linker script for msp430. 2002-12-30 Ralf Habacker - Charles Wilson + Charles Wilson * ld/config.in (HAVE_REALPATH): New entry. (HAVE_SYS_STAT_H, HAVE_SYS_TYPES_H): Removed: obsolete. diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index 20fe0a3..b524e01 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -67,6 +67,13 @@ static struct bfd_elf_version_expr *gld${EMULATION_NAME}_new_vers_pattern static void ppc_create_output_section_statements () { + extern const bfd_target bfd_elf64_powerpc_vec; + extern const bfd_target bfd_elf64_powerpcle_vec; + + if (link_info.hash->creator != &bfd_elf64_powerpc_vec + && link_info.hash->creator != &bfd_elf64_powerpcle_vec) + return; + stub_file = lang_add_input_file ("linker stubs", lang_input_file_is_fake_enum, NULL); @@ -98,26 +105,29 @@ ppc_after_open () static void ppc_before_allocation () { - if (!ppc64_elf_edit_opd (output_bfd, &link_info)) - { - einfo ("%X%P: can not edit opd %E\n"); - return; - } - - if (ppc64_elf_tls_setup (output_bfd, &link_info) && !notlsopt) + if (stub_file != NULL) { - /* Size the sections. This is premature, but we want to know the - TLS segment layout so that certain optimizations can be done. */ - lang_size_sections (stat_ptr->head, abs_output_section, - &stat_ptr->head, 0, (bfd_vma) 0, NULL); - - if (!ppc64_elf_tls_optimize (output_bfd, &link_info)) + if (!ppc64_elf_edit_opd (output_bfd, &link_info)) { - einfo ("%X%P: TLS problem %E\n"); + einfo ("%X%P: can not edit opd %E\n"); return; } - lang_reset_memory_regions (); + if (ppc64_elf_tls_setup (output_bfd, &link_info) && !notlsopt) + { + /* Size the sections. This is premature, but we want to know the + TLS segment layout so that certain optimizations can be done. */ + lang_size_sections (stat_ptr->head, abs_output_section, + &stat_ptr->head, 0, (bfd_vma) 0, NULL); + + if (!ppc64_elf_tls_optimize (output_bfd, &link_info)) + { + einfo ("%X%P: TLS problem %E\n"); + return; + } + + lang_reset_memory_regions (); + } } gld${EMULATION_NAME}_before_allocation (); @@ -318,7 +328,7 @@ gld${EMULATION_NAME}_finish () /* If generating a relocatable output file, then we don't have any stubs. */ - if (!link_info.relocateable) + if (stub_file != NULL && !link_info.relocateable) { int ret = ppc64_elf_setup_section_lists (output_bfd, &link_info); if (ret != 0) @@ -348,7 +358,7 @@ gld${EMULATION_NAME}_finish () if (need_laying_out) ppc_layout_sections_again (); - if (stub_file->the_bfd->sections != NULL) + if (stub_file != NULL && stub_file->the_bfd->sections != NULL) { if (!ppc64_elf_build_stubs (&link_info)) einfo ("%X%P: can not build stubs: %E\n");