/* ELF emulation code for targets using elf.em.
- Copyright (C) 1991-2020 Free Software Foundation, Inc.
+ Copyright (C) 1991-2021 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
&& (elf_section_data (os->bfd_section)->this_hdr.sh_info
== elf_section_data (s)->this_hdr.sh_info))
{
- lang_add_section (&os->children, s, NULL, os);
+ lang_add_section (&os->children, s, NULL, NULL, os);
return os;
}
|| !elfoutput
|| elf_orphan_compatible (s, os->bfd_section)))))
{
- lang_add_section (&os->children, s, NULL, os);
+ lang_add_section (&os->children, s, NULL, NULL, os);
return os;
}
unused one and use that. */
if (match_by_name)
{
- lang_add_section (&match_by_name->children, s, NULL, match_by_name);
+ lang_add_section (&match_by_name->children, s, NULL, NULL, match_by_name);
return match_by_name;
}
&& hold[orphan_text].os != NULL)
{
os = hold[orphan_text].os;
- lang_add_section (&os->children, s, NULL, os);
+ lang_add_section (&os->children, s, NULL, NULL, os);
return os;
}
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;
}
}
}