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

Peter Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 5 05:27:19 PDT 2021


peter.smith added a comment.

I've no comments on the code in D101872 <https://reviews.llvm.org/D101872> , and D10873 <https://reviews.llvm.org/D10873> they look reasonable to me. I guess it is down to whether this is the right thing to do or not.

Just to check my understanding:

- Clang defaults to -fno-semantic-interposition (GCC I believe has the opposite default fsemantic-interposition)
- With this change code in the same translation unit that defines the global will use a local alias for the global rather than accessing via the GOT, but the global will still be defined with default visibility.
- Symbol interposing is still permitted at link time so the global can be interposed, but as the code is using a local alias it will still use the original value.
- Without this chang clang would use fhalf-no-semantic-interposition which I believe permits some assumptions about symbol interpositioning such as resolving some short range assembly pc-relative references to a local alias. These would be out of range if the symbol were interposed anyway.

If I've got this right, particularly the default  then this makes me nervous about the default behaviour as it could silently break some existing code. If a user had to opt in explicitly with -fno-semantic-interposition then fair enough.

Can you let me know, if I'm being overly cautious here? For example are programs that would be affected by this already broken by the half-no-semantic-interpositioning anyway? Is symbol interpositioning so rare that the X86 version of this didn't break anything? Have I got the default of -fno-semantic-interpositioning wrong?


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