diff options
author | Alan Modra <amodra@gmail.com> | 2006-06-20 02:22:16 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2006-06-20 02:22:16 +0000 |
commit | 8ded5a0fc3e3c191ff427e0b3c8d2b89f28be9af (patch) | |
tree | 7aba558d83e353399a3de406fb2dfc760b41495b /ld/emultempl/elf-generic.em | |
parent | *** empty log message *** (diff) | |
download | binutils-gdb-8ded5a0fc3e3c191ff427e0b3c8d2b89f28be9af.tar.gz binutils-gdb-8ded5a0fc3e3c191ff427e0b3c8d2b89f28be9af.tar.bz2 binutils-gdb-8ded5a0fc3e3c191ff427e0b3c8d2b89f28be9af.zip |
bfd/
* elf-bfd.h: Formatting.
(_bfd_elf_map_sections_to_segments): Declare.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame_hdr): Don't
clear program_header_size.
* elf.c (get_program_header_size): Move. Don't use or set saved
program_header_size here.
(elf_modify_segment_map): New function. Split out from..
(assign_file_positions_for_load_sections): ..here. Assert
header size is correct. Remove dead code.
(_bfd_elf_map_sections_to_segments): Rename from
map_sections_to_segments. Make global. Use get_program_header_size
when we need estimate of header size. Call elf_modify_segment_map.
Set program_header_size.
(print_segment_map): Delete.
(_bfd_elf_sizeof_headers): If segment_map available, get the
actual size.
* elf32-arm.c (elf32_arm_symbian_modify_segment_map): Make safe
for calling more than once.
* elf32-bfin.c (elf32_bfinfdpic_modify_segment_map): Likewise.
* elf32-frv.c (elf32_frvfdpic_modify_segment_map): Likewise.
* elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Likewise.
* elf32-i370.c (elf_backend_add_symbol_hook): Delete.
(elf_backend_additional_program_headers): Delete.
(elf_backend_modify_segment_map): Delete.
* elf64-hppa.c (elf64_hppa_modify_segment_map): Convert to ISO C.
* elfxx-ia64.c (elfNN_ia64_modify_segment_map): Likewise.
* doc/bfdint.texi: Delete SIZEOF_HEADERS difficulties.
ld/
* Makefile.am (ELF_DEPS): Define. Use in emul file deps. Fix
many ELF emul file deps that incorrectly said they needed elf32.em
instead of generic.em. Add genelf.em as required.
* Makefile.in: Regenerate.
* ldlang.c (lang_process): Call ldemul_finish before
lang_check_section_addresses.
* emulparams/arcelf.sh: Generic elf target needs genelf.
* emulparams/d30v_e.sh: Likewise.
* emulparams/d30v_o.sh: Likewise.
* emulparams/d30velf.sh: Likewise.
* emulparams/elf32_dlx.sh: Likewise.
* emulparams/elf32_i860.sh: Likewise.
* emulparams/elf32fr30.sh: Likewise.
* emulparams/elf32frv.sh: Likewise.
* emulparams/elf32iq10.sh: Likewise.
* emulparams/elf32iq2000.sh: Likewise.
* emulparams/elf32mt.sh: Likewise.
* emulparams/mn10200.sh: Likewise.
* emulparams/or32.sh: Likewise.
* emulparams/or32elf.sh: Likewise.
* emulparams/pjelf.sh: Likewise.
* emulparams/msp430all.sh: Likewise. Extract common entries.
* emulparams/pjlelf.sh: Include pjelf.sh.
* emulparams/elf32frvfd.sh (EXTRA_EM_FILE): Unset.
* emulparams/mn10300.sh (EXTRA_EM_FILE): Unset.
* emultempl/elf-generic.em: New file.
* emultempl/genelf.em: New file.
* emultempl/elf32.em: Include elf-generic.em.
(gld${EMULATION_NAME}_layout_sections_again): Delete.
(gld${EMULATION_NAME}_finish): Call gld${EMULATION_NAME}_map_segments.
* emultempl/hppaelf.em (hppaelf_layout_sections_again): Likewise.
(gld${EMULATION_NAME}_finish): Rename from hppaelf_finish. Call
gld${EMULATION_NAME}_map_segments.
(LDEMUL_FINISH): Update.
* emultempl/mmo.em: Correct comment. Include elf-bfd.h and
source elf-generic.em.
(mmo_finish): Call gld${EMULATION_NAME}_map_segments.
* emultempl/ppc64elf.em (ppc_layout_sections_again): Likewise.
(gld${EMULATION_NAME}_finish): Rename from ppc_finish. Call
gld${EMULATION_NAME}_map_segments.
(LDEMUL_FINISH): Update.
ld/testsuite/
* ld-elf/eh1.d: Update for fewer program headers.
* ld-elf/eh2.d: Likewise.
* ld-elf/eh3.d: Likewise.
Diffstat (limited to 'ld/emultempl/elf-generic.em')
-rw-r--r-- | ld/emultempl/elf-generic.em | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/ld/emultempl/elf-generic.em b/ld/emultempl/elf-generic.em new file mode 100644 index 00000000000..a573a4414da --- /dev/null +++ b/ld/emultempl/elf-generic.em @@ -0,0 +1,60 @@ +# This shell script emits a C file. -*- C -*- +# Copyright 2006 Free Software Foundation, Inc. +# +# This file is part of GLD, the Gnu Linker. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. +# + +# This file is sourced from elf32.em and from ELF targets that use +# generic.em. +# +cat >>e${EMULATION_NAME}.c <<EOF + +static void +gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout) +{ + while (1) + { + if (output_bfd->xvec->flavour == bfd_target_elf_flavour) + { + bfd_size_type phdr_size; + + phdr_size = elf_tdata (output_bfd)->program_header_size; + if (!_bfd_elf_map_sections_to_segments (output_bfd, &link_info)) + einfo ("%F%P: map sections to segments failed: %E\n"); + + if (phdr_size != elf_tdata (output_bfd)->program_header_size) + need_layout = TRUE; + } + + if (!need_layout) + break; + + lang_reset_memory_regions (); + + /* Resize the sections. */ + lang_size_sections (NULL, TRUE); + + /* Redo special stuff. */ + ldemul_after_allocation (); + + /* Do the assignments again. */ + lang_do_assignments (); + + need_layout = FALSE; + } +} +EOF |