[PATCH] D101873: [clang] Support clang -fpic -fno-semantic-interposition for AArch64

Peter Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 6 06:47:57 PDT 2021


peter.smith added a comment.

In D101873#2741299 <https://reviews.llvm.org/D101873#2741299>, @MaskRay wrote:

> https://gist.github.com/MaskRay/2d4dfcfc897341163f734afb59f689c6 has more information about -fno-semantic-interposition.
>
>> Can Clang default to -fno-semantic-interposition?
>
> I think we can probably make non-x86 default to -fno-semantic-interposition (dso_local inference, given D72197 <https://reviews.llvm.org/D72197>. x86 may find default -fno-semantic-interposition too aggressive.

Thanks for the link, and the explanation that -fno-semantic-interposition is not the default.

I'm not (yet) convinced that we could make -fno-semantic-interposition the default, primarily due to data and not functions, I agree that interpositioning functions is rarely used. For data the classic example for symbol-interposition was errno, a shared library can't know if any other library or executable will define it so it must define, but it must use only one value for the definition. I'm not sure if that still holds in today's environment with shared C libraries used by practically everything but I think the principle still applies.

Looking at the gist I've got one concern for AArch64 and Arm. The ABI relies on thunks which are only defined for symbols of type STT_FUNC. Changing branches to STT_FUNC to STT_SECTION will break long range thunks on AArch64 and interworking for Arm (there is a possibility that the bottom bit for STT_FUNC may get used in the future for AArch64 as well). This is solvable by keeping the local label and setting STT_FUNC on it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101873



More information about the cfe-commits mailing list