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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 10 12:03:58 PDT 2021


MaskRay added a comment.

In D107747#2936744 <https://reviews.llvm.org/D107747#2936744>, @ro wrote:

> 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.

There are quite a few OS ABIs which have adopted IFUNC.
Currently I am unsure whether the ELFOSABI_GNU marker can make them unhappy.

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

MC supports `@gnu_unique_object`. I can change it to use ELFOSABI_GNU.

Clang doesn't emit it anyway. (An example complaint: https://news.ycombinator.com/item?id=21555752)


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