diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/ldelf.c | 21 |
2 files changed, 20 insertions, 7 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index df20606..9dfff4a 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2021-01-28 Alan Modra <amodra@gmail.com> + + PR 27259 + * ldelf.c (ldelf_before_place_orphans): Use linker_mark to + prevent endless looping of linked-to sections. + 2021-01-26 H.J. Lu <hongjiu.lu@intel.com> * testsuite/ld-x86-64/bnd-plt-1.d: Fix a typo. @@ -2188,14 +2188,21 @@ ldelf_before_place_orphans (void) been discarded. */ asection *linked_to_sec; for (linked_to_sec = elf_linked_to_section (isec); - linked_to_sec != NULL; + linked_to_sec != NULL && !linked_to_sec->linker_mark; linked_to_sec = elf_linked_to_section (linked_to_sec)) - if (discarded_section (linked_to_sec)) - { - isec->output_section = bfd_abs_section_ptr; - isec->flags |= SEC_EXCLUDE; - break; - } + { + if (discarded_section (linked_to_sec)) + { + isec->output_section = bfd_abs_section_ptr; + isec->flags |= SEC_EXCLUDE; + break; + } + linked_to_sec->linker_mark = 1; + } + for (linked_to_sec = elf_linked_to_section (isec); + linked_to_sec != NULL && linked_to_sec->linker_mark; + linked_to_sec = elf_linked_to_section (linked_to_sec)) + linked_to_sec->linker_mark = 0; } } } |