[PATCH] D107861: [MC] Change ELFOSABI_NONE to ELFOSABI_GNU for STB_GNU_UNIQUE

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 26 16:29:44 PDT 2021


jrtc27 added a comment.

FWIW my proposed behaviour seems to be what binutils is doing for both STB_GNU_UNIQUE and SHF_GNU_RETAIN:

    if (elf_tdata (abfd)->has_gnu_osabi != 0)
      {
        if (i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_NONE)
  	i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_GNU;
        else if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_GNU
  	       && i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_FREEBSD)
  	{
  	  if (elf_tdata (abfd)->has_gnu_osabi & elf_gnu_osabi_mbind)
  	    _bfd_error_handler (_("GNU_MBIND section is supported only by GNU "
  				  "and FreeBSD targets"));
  	  if (elf_tdata (abfd)->has_gnu_osabi & elf_gnu_osabi_ifunc)
  	    _bfd_error_handler (_("symbol type STT_GNU_IFUNC is supported "
  				  "only by GNU and FreeBSD targets"));
  	  if (elf_tdata (abfd)->has_gnu_osabi & elf_gnu_osabi_unique)
  	    _bfd_error_handler (_("symbol binding STB_GNU_UNIQUE is supported "
  				  "only by GNU and FreeBSD targets"));
  	  if (elf_tdata (abfd)->has_gnu_osabi & elf_gnu_osabi_retain)
  	    _bfd_error_handler (_("GNU_RETAIN section is supported "
  				  "only by GNU and FreeBSD targets"));
  	  bfd_set_error (bfd_error_sorry);
  	  return false;
  	}
      }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107861/new/

https://reviews.llvm.org/D107861



More information about the llvm-commits mailing list