From 936384714fa8b0f7ca8cc3b5637394461bc998c8 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 29 Oct 2015 16:16:22 +1030 Subject: Re: Orphan output section with multiple input sections The last patch missed handling the case where the ideal place to put an orphan was after a non-existent output section statement, as can happen when not using the builtin linker scripts. This patch uses the updated flags for that case too, and extends the support to mmo and pe. PR ld/19162 * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Pass updated flags to lang_output_section_find_by_flags. * emultempl/mmo.em (mmo_place_orphan): Merge flags for any other input sections that might match a new output section to decide placement. * emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise. * ldlang.c (lang_output_section_find_by_flags): Add sec_flags param. * ldlang.h (lang_output_section_find_by_flags): Update prototype. --- ld/emultempl/elf32.em | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ld/emultempl/elf32.em') diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 629c414..0405d4f 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -2003,8 +2003,9 @@ gld${EMULATION_NAME}_place_orphan (asection *s, } after = place->os; if (after == NULL) - after = lang_output_section_find_by_flags - (s, &place->os, _bfd_elf_match_sections_by_type); + after + = lang_output_section_find_by_flags (s, flags, &place->os, + _bfd_elf_match_sections_by_type); if (after == NULL) /* *ABS* is always the first output section statement. */ after = &lang_output_section_statement.head->output_section_statement; -- cgit v1.1