Commit Graph

4 Commits

Author SHA1 Message Date
Fangrui Song 9d55e4ee13 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.)
2020-05-25 20:48:18 -07:00
Fangrui Song 3ecba396e9 [Driver][test] Change %itanium_abi_triple to generic ELF
x86_64-windows and darwin default to PIC. They don't use PIE.
2020-02-02 21:46:48 -08:00
Fangrui Song 7eeb901528 [Driver] Fix fsemantic-interposition.c for Windows and Darwin 2020-02-02 20:55:24 -08:00
Fangrui Song aed488e3a4 [Driver] Move -fsemantic-interposition decision from cc1 to driver
And add test/Driver/fsemantic-interposition.c
2020-02-02 20:45:29 -08:00