aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl/elf32.em
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-02-29 11:04:22 -0800
committerH.J. Lu <hjl.tools@gmail.com>2016-03-01 05:38:46 -0800
commit077fcd6a3b5729044acce83f77ebedd3adbadab0 (patch)
tree917f0b4c8a9801f6a1c28e648f2a1a5ec142a2e8 /ld/emultempl/elf32.em
parent4a9321595003d86dd4794d0edab071f91989808e (diff)
downloadgdb-077fcd6a3b5729044acce83f77ebedd3adbadab0.zip
gdb-077fcd6a3b5729044acce83f77ebedd3adbadab0.tar.gz
gdb-077fcd6a3b5729044acce83f77ebedd3adbadab0.tar.bz2
Speedup ELF orphan placement for relocatable link
Since there is no need to place output sections in specific order for relocatable link, we can skip merging flags of other input sections. PR ld/19739 * ld/emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't merge flags of other input sections for relocatable link.
Diffstat (limited to 'ld/emultempl/elf32.em')
-rw-r--r--ld/emultempl/elf32.em33
1 files changed, 20 insertions, 13 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index f3ec875..3e9f684 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1946,25 +1946,32 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
return os;
}
+ flags = s->flags;
+ if (!bfd_link_relocatable (&link_info))
+ {
+ nexts = s;
+ while ((nexts = bfd_get_next_section_by_name (nexts->owner, nexts))
+ != NULL)
+ if (nexts->output_section == NULL
+ && (nexts->flags & SEC_EXCLUDE) == 0
+ && ((nexts->flags ^ flags) & (SEC_LOAD | SEC_ALLOC)) == 0
+ && (nexts->owner->flags & DYNAMIC) == 0
+ && nexts->owner->usrdata != NULL
+ && !(((lang_input_statement_type *) nexts->owner->usrdata)
+ ->flags.just_syms)
+ && _bfd_elf_match_sections_by_type (nexts->owner, nexts,
+ s->owner, s))
+ flags = (((flags ^ SEC_READONLY)
+ | (nexts->flags ^ SEC_READONLY))
+ ^ SEC_READONLY);
+ }
+
/* Decide which segment the section should go in based on the
section name and section flags. We put loadable .note sections
right after the .interp section, so that the PT_NOTE segment is
stored right after the program headers where the OS can read it
in the first page. */
- flags = s->flags;
- nexts = s;
- while ((nexts = bfd_get_next_section_by_name (nexts->owner, nexts)) != NULL)
- if (nexts->output_section == NULL
- && (nexts->flags & SEC_EXCLUDE) == 0
- && ((nexts->flags ^ flags) & (SEC_LOAD | SEC_ALLOC)) == 0
- && (nexts->owner->flags & DYNAMIC) == 0
- && nexts->owner->usrdata != NULL
- && !(((lang_input_statement_type *) nexts->owner->usrdata)
- ->flags.just_syms)
- && _bfd_elf_match_sections_by_type (nexts->owner, nexts, s->owner, s))
- flags = (((flags ^ SEC_READONLY) | (nexts->flags ^ SEC_READONLY))
- ^ SEC_READONLY);
place = NULL;
if ((flags & (SEC_ALLOC | SEC_DEBUGGING)) == 0)
place = &hold[orphan_nonalloc];