HomePhabricator

Make explicit -fno-semantic-interposition (in -fpic mode) infer dso_local

Authored by MaskRay on May 25 2020, 3:05 PM.

Description

Make explicit -fno-semantic-interposition (in -fpic mode) infer dso_local

-fno-semantic-interposition is currently the CC1 default. (The opposite
disables some interprocedural optimizations.) However, it does not infer
dso_local: on most targets accesses to ExternalLinkage functions/variables
defined in the current module still need PLT/GOT.

This patch makes explicit -fno-semantic-interposition infer dso_local,
so that PLT/GOT can be eliminated if targets implement local aliases
for AsmPrinter::getSymbolPreferLocal (currently only x86).

Currently we check whether the module flag "SemanticInterposition" is 0.
If yes, infer dso_local. In the future, we can infer dso_local unless
"SemanticInterposition" is 1: frontends other than clang will also
benefit from the optimization if they don't bother setting the flag.
(There will be risks if they do want ELF interposition: they need to set
"SemanticInterposition" to 1.)

Details

Committed
MaskRayMay 25 2020, 8:48 PM
Parents
rG793cc518b942: [PowerPC] Prevent legalization loop from promoting SELECT_CC from v4i32 to v4i32
Branches
Unknown
Tags
Unknown