diff options
author | Fangrui Song <i@maskray.me> | 2020-12-31 13:59:45 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2020-12-31 13:59:45 -0800 |
commit | d1fd72343c6ff58a3b66bc0df56fed9ac21e4056 (patch) | |
tree | 1c6f42eeb37d5aac8f00f8cf15b1c6c348a7b4bd /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 219d00e0d90941d3e54fc711ea1e7b5e4b5b4335 (diff) | |
download | llvm-d1fd72343c6ff58a3b66bc0df56fed9ac21e4056.zip llvm-d1fd72343c6ff58a3b66bc0df56fed9ac21e4056.tar.gz llvm-d1fd72343c6ff58a3b66bc0df56fed9ac21e4056.tar.bz2 |
Refactor how -fno-semantic-interposition sets dso_local on default visibility external linkage definitions
The idea is that the CC1 default for ELF should set dso_local on default
visibility external linkage definitions in the default -mrelocation-model pic
mode (-fpic/-fPIC) to match COFF/Mach-O and make output IR similar.
The refactoring is made available by 2820a2ca3a0e69c3f301845420e0067ffff2251b.
Currently only x86 supports local aliases. We move the decision to the driver.
There are three CC1 states:
* -fsemantic-interposition: make some linkages interposable and make default visibility external linkage definitions dso_preemptable.
* (default): selected if the target supports .Lfoo$local: make default visibility external linkage definitions dso_local
* -fhalf-no-semantic-interposition: if neither option is set or the target does not support .Lfoo$local: like -fno-semantic-interposition but local aliases are not used. So references can be interposed if not optimized out.
Add -fhalf-no-semantic-interposition to a few tests using the half-based semantic interposition behavior.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 06d8d2e..1d16312 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -3197,9 +3197,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, } Opts.SemanticInterposition = Args.hasArg(OPT_fsemantic_interposition); - // An explicit -fno-semantic-interposition infers dso_local. - Opts.ExplicitNoSemanticInterposition = - Args.hasArg(OPT_fno_semantic_interposition); + Opts.HalfNoSemanticInterposition = + Args.hasArg(OPT_fhalf_no_semantic_interposition); // -mrtd option if (Arg *A = Args.getLastArg(OPT_mrtd)) { |