diff options
author | Alan Modra <amodra@gmail.com> | 2005-03-29 11:07:38 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2005-03-29 11:07:38 +0000 |
commit | deb04cdb5ef9b4efa0e57b0e9d02c7800f2ee29a (patch) | |
tree | c0b3613b34aed916e0df25dd90dfe428cf369116 /ld/emultempl/ppc64elf.em | |
parent | 7e7353ed547e66c371ac3ea4bc2570707f3dbae1 (diff) | |
download | gdb-deb04cdb5ef9b4efa0e57b0e9d02c7800f2ee29a.zip gdb-deb04cdb5ef9b4efa0e57b0e9d02c7800f2ee29a.tar.gz gdb-deb04cdb5ef9b4efa0e57b0e9d02c7800f2ee29a.tar.bz2 |
* emultempl/elf32.em (gld${EMULATION_NAME}_layout_sections_again):
New function, extracted from static void gld${EMULATION_NAME}_finish.
(gld${EMULATION_NAME}_strip_empty_sections): Likewise.
(gld${EMULATION_NAME}_provide_init_fini_syms): Likewise.
* emultempl/ppc64elf.em: Revert last change.
(ppc_layout_sections_again): Use
gld${EMULATION_NAME}_layout_sections_again.
(ppc_finish): Don't call gld${EMULATION_NAME}_finish. Instead call
gld${EMULATION_NAME}_strip_empty_sections and
gld${EMULATION_NAME}_provide_init_fini_syms.
* emultempl/hppaelf.em: Similarly.
Diffstat (limited to 'ld/emultempl/ppc64elf.em')
-rw-r--r-- | ld/emultempl/ppc64elf.em | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index a334c9f..d468e8c 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -32,6 +32,9 @@ cat >>e${EMULATION_NAME}.c <<EOF static lang_input_statement_type *stub_file; static int stub_added = 0; +/* Whether we need to call ppc_layout_sections_again. */ +static int need_laying_out = 0; + /* Maximum size of a group of input sections that can be handled by one stub section. A value of +/-1 indicates the bfd back-end should use a suitable default size. */ @@ -255,17 +258,9 @@ ppc_layout_sections_again (void) /* If we have changed sizes of the stub sections, then we need to recalculate all the section offsets. This may mean we need to add even more stubs. */ - lang_reset_memory_regions (); - - /* Resize the sections. */ - lang_size_sections (stat_ptr->head, abs_output_section, - &stat_ptr->head, 0, 0, NULL, TRUE); - - /* Recalculate TOC base. */ - ldemul_after_allocation (); + need_laying_out = 0; - /* Do the assignments again. */ - lang_do_assignments (stat_ptr->head, abs_output_section, NULL, 0); + gld${EMULATION_NAME}_layout_sections_again (); } @@ -316,6 +311,13 @@ ppc_finish (void) descriptor in the .opd section. */ entry_section = ".opd"; + /* bfd_elf_discard_info just plays with debugging sections, + ie. doesn't affect any code, so we can delay resizing the + sections. It's likely we'll resize everything in the process of + adding stubs. */ + if (bfd_elf_discard_info (output_bfd, &link_info)) + need_laying_out = 1; + /* If generating a relocatable output file, then we don't have any stubs. */ if (stub_file != NULL && !link_info.relocatable) @@ -344,6 +346,9 @@ ppc_finish (void) } } + if (need_laying_out) + ppc_layout_sections_again (); + if (link_info.relocatable) { asection *toc = bfd_get_section_by_name (output_bfd, ".toc"); @@ -374,7 +379,8 @@ ppc_finish (void) } ppc64_elf_restore_symbols (&link_info); - gld${EMULATION_NAME}_finish (); + gld${EMULATION_NAME}_strip_empty_sections (); + gld${EMULATION_NAME}_provide_init_fini_syms (); } |