On Thu, Oct 01, 2020 at 09:09:07PM +0930, Alan Modra via Binutils wrote: > On Thu, Oct 01, 2020 at 11:50:33AM +0100, Jozef Lawrynowicz wrote: > > --- a/bfd/elflink.c > > +++ b/bfd/elflink.c > > @@ -14102,7 +14102,8 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info) > > || (elf_section_data (o)->this_hdr.sh_type > > == SHT_FINI_ARRAY))) > > || (elf_section_data (o)->this_hdr.sh_type == SHT_NOTE > > - && elf_next_in_group (o) == NULL ))) > > + && elf_next_in_group (o) == NULL) > > + || (elf_section_flags (o) & SHF_GNU_RETAIN))) > > Flag bits in SHF_MASKOS depend on OS, so this needs a test of OSABI. > That can be done by checking elf_tdata (sub)->has_gnu_osabi for the > appropriate bit. > Fixed the two OSABI issues in the attached patch. I also added handling of numeric flag values in the SHF_MASKOS range for the .section directive for some OSABIs. There are new GAS tests to test this behavior for targets that either do or do not support the GNU OSABI. > > { > > if (!_bfd_elf_gc_mark (info, o, gc_mark_hook)) > > return FALSE; > > diff --git a/binutils/NEWS b/binutils/NEWS > > index c0dc73d7d8..6c7d3f3953 100644 > > --- a/binutils/NEWS > > +++ b/binutils/NEWS > > @@ -4,6 +4,10 @@ > > symbol names. In addition the --demangle=