From a015f5eccc7cdc779954195e0d65261bf71d2773 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 17 Feb 2003 22:49:24 +0000 Subject: [PATCH] * 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. --- ld/ChangeLog | 9 +++++++- ld/emultempl/ppc64elf.em | 44 ++++++++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 431345fa1ad..13dd4f4f532 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 20fe0a3c8c7..b524e0123f0 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"); -- 2.30.2