diff options
author | Alan Modra <amodra@gmail.com> | 2015-04-24 19:19:37 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2015-04-25 09:15:49 +0930 |
commit | 44bd1acd55dcc15322a5c2d33442cd219ca320c7 (patch) | |
tree | 09789b42b162b47302650ca9e2cc50ef23ffafa4 /include/elf | |
parent | b53b1bedbd90044714fc456843cadccce0f208f3 (diff) | |
download | gdb-44bd1acd55dcc15322a5c2d33442cd219ca320c7.zip gdb-44bd1acd55dcc15322a5c2d33442cd219ca320c7.tar.gz gdb-44bd1acd55dcc15322a5c2d33442cd219ca320c7.tar.bz2 |
Non-alloc sections don't belong in PT_LOAD segments
Taking them out showed a bug in the powerpc64 backend with .branch_lt
being removed from output_bfd but not from previously set up segment
section maps. Removing the bfd sections meant their sh_flags (and
practically everything else) remaining zero, ie. not SHF_ALLOC,
triggering complaints about "`.branch_lt' can't be allocated in
segment".
include/elf/
* internal.h (ELF_SECTION_IN_SEGMENT_1): Ensure PT_LOAD and
similar segments only contain alloc sections.
ld/
* emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation):
Call gld${EMULATION_NAME}_map_segments regardless of need_laying_out.
ld/testsuite/
* ld-powerpc/tocnovar.d: Revert last change.
Diffstat (limited to 'include/elf')
-rw-r--r-- | include/elf/ChangeLog | 5 | ||||
-rw-r--r-- | include/elf/internal.h | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index 2f2fc80..e4e094b 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,8 @@ +2015-04-24 Alan Modra <amodra@gmail.com> + + * internal.h (ELF_SECTION_IN_SEGMENT_1): Ensure PT_LOAD and + similar segments only contain alloc sections. + 2015-04-24 H.J. Lu <hongjiu.lu@intel.com> PR binutils/18316 diff --git a/include/elf/internal.h b/include/elf/internal.h index b2492f5..b49dd61 100644 --- a/include/elf/internal.h +++ b/include/elf/internal.h @@ -325,6 +325,13 @@ struct elf_segment_map || (((sec_hdr)->sh_flags & SHF_TLS) == 0 \ && (segment)->p_type != PT_TLS \ && (segment)->p_type != PT_PHDR)) \ + /* PT_LOAD and similar segments only have SHF_ALLOC sections. */ \ + && !(((sec_hdr)->sh_flags & SHF_ALLOC) == 0 \ + && ((segment)->p_type == PT_LOAD \ + || (segment)->p_type == PT_DYNAMIC \ + || (segment)->p_type == PT_GNU_EH_FRAME \ + || (segment)->p_type == PT_GNU_RELRO \ + || (segment)->p_type == PT_GNU_STACK)) \ /* Any section besides one of type SHT_NOBITS must have file \ offsets within the segment. */ \ && ((sec_hdr)->sh_type == SHT_NOBITS \ |