On Fri, Oct 02, 2020 at 05:41:13AM -0700, H.J. Lu via Binutils wrote: > On Fri, Oct 2, 2020 at 5:33 AM H.J. Lu wrote: > > > > On Fri, Oct 2, 2020 at 5:30 AM Jozef Lawrynowicz > > wrote: > > > > > > 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. > > > > > > > Please rebase since this part has been changed on master branch. > > > > + || (elf_tdata (sub)->has_gnu_osabi & elf_gnu_osabi_retain > + && elf_section_flags (o) & SHF_GNU_RETAIN))) > > Also please add () for elf_tdata (sub)->has_gnu_osabi & elf_gnu_osabi_retain > and elf_section_flags (o) & SHF_GNU_RETAIN. Fixed in the attached patch. Thanks, Jozef > > -- > H.J.