aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl/ppc64elf.em
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2015-04-24 19:19:37 +0930
committerAlan Modra <amodra@gmail.com>2015-04-25 09:15:49 +0930
commit44bd1acd55dcc15322a5c2d33442cd219ca320c7 (patch)
tree09789b42b162b47302650ca9e2cc50ef23ffafa4 /ld/emultempl/ppc64elf.em
parentb53b1bedbd90044714fc456843cadccce0f208f3 (diff)
downloadgdb-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 'ld/emultempl/ppc64elf.em')
-rw-r--r--ld/emultempl/ppc64elf.em17
1 files changed, 10 insertions, 7 deletions
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index fd9a3ce..2d26a95 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -546,13 +546,16 @@ gld${EMULATION_NAME}_after_allocation (void)
else if (ret > 0)
need_laying_out = 1;
- if (need_laying_out != -1)
- {
- gld${EMULATION_NAME}_map_segments (need_laying_out);
-
- if (!link_info.relocatable)
- ppc64_elf_set_toc (&link_info, link_info.output_bfd);
- }
+ /* Call map_segments regardless of the state of need_laying_out.
+ need_laying_out set to -1 means we have just laid everything out,
+ but ppc64_elf_size_stubs strips .branch_lt and .eh_frame if
+ unneeded, after ppc_layout_sections_again. Another call removes
+ these sections from the segment map. Their presence is
+ innocuous except for confusing ELF_SECTION_IN_SEGMENT. */
+ gld${EMULATION_NAME}_map_segments (need_laying_out > 0);
+
+ if (need_laying_out != -1 && !link_info.relocatable)
+ ppc64_elf_set_toc (&link_info, link_info.output_bfd);
}