[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 11:59:26 PDT 2021


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

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

> In D107747#2934856 <https://reviews.llvm.org/D107747#2934856>, @MaskRay wrote:
>
>> 
>
>
>
>> Instrumentation based PGO has names variables referenced by `llvm.used`. Without a `SHF_GNU_RETAIN` counterpart indirect call profiling cannot work.
>
> But isn't this the same with pre-binutils 2.36 GNU `ld` and still there are no precautions about this case?

The issue can be mitigated by a hack in GNU ld and gold: 
https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order#reflection
(In the Solaris Linkers and Libraries guide, such `__start_` and `__stop_` symbols are called encapsulation symbols.)


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