From 888b0b2fa0256db0746fb6f7e642e8e6b8e6d34a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 15 Jul 1996 15:58:00 +0000 Subject: [PATCH] Mon Jul 15 11:49:49 1996 Andreas Schwab * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Round the value of __start_SECNAME to the alignment required by the section to be placed. --- ld/ChangeLog | 6 ++++++ ld/emultempl/elf32.em | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 0010899245..0e2e6ce615 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +Mon Jul 15 11:49:49 1996 Andreas Schwab + + * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Round + the value of __start_SECNAME to the alignment required by the + section to be placed. + Tue Jul 9 12:09:02 1996 Ian Lance Taylor * configure.tgt (mips*el-*-elf*): Use elf32elmip. diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 71e34b5abc..fe0b1b92a1 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -1,9 +1,12 @@ # This shell script emits a C file. -*- C -*- # It does some substitutions. +# This file is now misnamed, because it supports both 32 bit and 64 bit +# ELF emulations. +test -z "${ELFSIZE}" && ELFSIZE=32 cat >e${EMULATION_NAME}.c < ELF support by Ian Lance Taylor @@ -133,6 +136,7 @@ gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) EOF if [ "x${host}" = "x${target}" ] ; then + if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <name)) continue; EOF + fi fi cat >>e${EMULATION_NAME}.c <name); @@ -311,10 +318,12 @@ cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <name)) continue; EOF + fi fi cat >>e${EMULATION_NAME}.c <assign.dst, ".") != 0) { - if (! (bfd_elf32_record_link_assignment + if (! (bfd_elf${ELFSIZE}_record_link_assignment (output_bfd, &link_info, exp->assign.dst, exp->type.node_class == etree_provide ? true : false))) einfo ("%P%F: failed to record assignment to %s: %E\n", @@ -711,6 +720,7 @@ gld${EMULATION_NAME}_find_exp_assignment (exp) static asection *hold_section; static lang_output_section_statement_type *hold_use; static lang_output_section_statement_type *hold_text; +static lang_output_section_statement_type *hold_rodata; static lang_output_section_statement_type *hold_data; static lang_output_section_statement_type *hold_bss; static lang_output_section_statement_type *hold_rel; @@ -769,6 +779,10 @@ gld${EMULATION_NAME}_place_orphan (file, s) else if (strncmp (secname, ".rel", 4) == 0 && hold_rel != NULL) place = hold_rel; + else if ((s->flags & SEC_CODE) == 0 + && (s->flags & SEC_READONLY) != 0 + && hold_rodata != NULL) + place = hold_rodata; else if ((s->flags & SEC_READONLY) != 0 && hold_text != NULL) place = hold_text; @@ -807,7 +821,9 @@ gld${EMULATION_NAME}_place_orphan (file, s) symname = (char *) xmalloc (ps - secname + sizeof "__start_"); sprintf (symname, "__start_%s", secname); lang_add_assignment (exp_assop ('=', symname, - exp_nameop (NAME, "."))); + exp_unop (ALIGN_K, + exp_intop ((bfd_vma) 1 + << s->alignment_power)))); } if (! link_info.relocateable) @@ -862,11 +878,14 @@ gld${EMULATION_NAME}_place_section (s) if (strcmp (os->name, ".text") == 0) hold_text = os; + else if (strcmp (os->name, ".rodata") == 0) + hold_rodata = os; else if (strcmp (os->name, ".data") == 0) hold_data = os; else if (strcmp (os->name, ".bss") == 0) hold_bss = os; else if (hold_rel == NULL + && os->bfd_section != NULL && strncmp (os->name, ".rel", 4) == 0) hold_rel = os; } -- 2.34.1