[PATCH] D107747: [ELF] Don't emit SHF_GNU_RETAIN on Solaris

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 10 05:35:54 PDT 2021


ro added a comment.

In D107747#2934904 <https://reviews.llvm.org/D107747#2934904>, @MaskRay wrote:

> In D107747#2934864 <https://reviews.llvm.org/D107747#2934864>, @tmatheson wrote:
>
>> According to D95749 <https://reviews.llvm.org/D95749>, the rationale for allowing `ELFOSABI_NONE` with `SHF_GNU_RETAIN` is to keep consistent behaviour with `STT_GNU_IFUNC` and `STB_GNU_UNIQUE`, which are permitted under `ELFOSABI_NONE`. @MaskRay Should we perhaps revisit that decision?
>>
>> More details at https://sourceware.org/bugzilla/show_bug.cgi?id=27282
>
> The Solaris Linkers and Loader guide doesn't say the section type value 10 is used.
> We can mark STT_GNU_IFUNC as ELFOSABI_GNU, it just feels to me not very necessary. (It can be used by multiple other OSABI values. All these OSABI need to something similar to D107748 <https://reviews.llvm.org/D107748> even if NONE works)

Solaris `<sys/elf.h>` has

  /*
   * GNU/Linux specific symbol type not used by Solaris
   */
  #define	STT_GNU_IFUNC	10

so in this particular case, it's aware about the possible conflict with different OS ABIs.

> I think STB_GNU_UNIQUE is a mistake.
> Clang doesn't emit it.
> So marking it as ELFOSABI_GNU isn't too necessary.

Same here:

  /*
   * GNU/Linux specific binding not used by Solaris
   */
  #define	STB_GNU_UNIQUE	10

However, as at least the `SHF_GNU_RETAIN` vs. `SHF_SUNW_ABSENT` case shows, the possibility of conflict in the OS-specific ranges
is quite real, so ignoring it is dangerous.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107747



More information about the llvm-commits mailing list