aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authordiggerlin <digger.llvm@gmail.com>2020-10-08 09:34:58 -0400
committerdiggerlin <digger.llvm@gmail.com>2020-10-08 09:34:58 -0400
commit92bca1284308452b8eb549e9382873645320cf19 (patch)
tree30137b51cd843e4be9961331a9d520025a38b66b /clang/lib/Frontend/CompilerInvocation.cpp
parenta0a6fd435c6066d40d9c20835f1e52aad1e8cc65 (diff)
downloadllvm-92bca1284308452b8eb549e9382873645320cf19.zip
llvm-92bca1284308452b8eb549e9382873645320cf19.tar.gz
llvm-92bca1284308452b8eb549e9382873645320cf19.tar.bz2
[AIX] add new option -mignore-xcoff-visibility
SUMMARY: In IBM compiler xlclang , there is an option -fnovisibility which suppresses visibility. For more details see: https://www.ibm.com/support/knowledgecenter/SSGH3R_16.1.0/com.ibm.xlcpp161.aix.doc/compiler_ref/opt_visibility.html. We need to add the option -mignore-xcoff-visibility for compatibility with the IBM AIX OS (as the option is enabled by default in AIX). With this option llvm does not emit any visibility attribute to ASM or XCOFF object file. The option only work on the AIX OS, for other non-AIX OS using the option will report an unsupported options error. In AIX OS: 1.1 the option -mignore-xcoff-visibility is enabled by default , if there is not -fvisibility=* and -mignore-xcoff-visibility explicitly in the clang command . 1.2 if there is -fvisibility=* explicitly but not -mignore-xcoff-visibility explicitly in the clang command. it will generate visibility attributes. 1.3 if there are both -fvisibility=* and -mignore-xcoff-visibility explicitly in the clang command. The option "-mignore-xcoff-visibility" wins , it do not emit the visibility attribute. The option -mignore-xcoff-visibility has no effect on visibility attribute when compile with -emit-llvm option to generated LLVM IR. Reviewer: daltenty,Jason Liu Differential Revision: https://reviews.llvm.org/D87451
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index a1ad86e..1df92b0 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1360,6 +1360,10 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
}
}
+ if (T.isOSAIX() && (Args.hasArg(OPT_mignore_xcoff_visibility) ||
+ !Args.hasArg(OPT_fvisibility)))
+ Opts.IgnoreXCOFFVisibility = 1;
+
Opts.DependentLibraries = Args.getAllArgValues(OPT_dependent_lib);
Opts.LinkerOptions = Args.getAllArgValues(OPT_linker_option);
bool NeedLocTracking = false;