diff options
author | diggerlin <digger.llvm@gmail.com> | 2020-10-08 09:34:58 -0400 |
---|---|---|
committer | diggerlin <digger.llvm@gmail.com> | 2020-10-08 09:34:58 -0400 |
commit | 92bca1284308452b8eb549e9382873645320cf19 (patch) | |
tree | 30137b51cd843e4be9961331a9d520025a38b66b /llvm/lib/CodeGen/CommandFlags.cpp | |
parent | a0a6fd435c6066d40d9c20835f1e52aad1e8cc65 (diff) | |
download | llvm-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 'llvm/lib/CodeGen/CommandFlags.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CommandFlags.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp index 0a7c7a9..078fee6 100644 --- a/llvm/lib/CodeGen/CommandFlags.cpp +++ b/llvm/lib/CodeGen/CommandFlags.cpp @@ -74,6 +74,7 @@ CGOPT(bool, UseCtors) CGOPT(bool, RelaxELFRelocations) CGOPT_EXP(bool, DataSections) CGOPT_EXP(bool, FunctionSections) +CGOPT(bool, IgnoreXCOFFVisibility) CGOPT(std::string, BBSections) CGOPT(unsigned, TLSSize) CGOPT(bool, EmulatedTLS) @@ -333,6 +334,13 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() { cl::init(false)); CGBINDOPT(FunctionSections); + static cl::opt<bool> IgnoreXCOFFVisibility( + "ignore-xcoff-visibility", + cl::desc("Not emit the visibility attribute for asm in AIX OS or give " + "all symbols 'unspecified' visibility in XCOFF object file"), + cl::init(false)); + CGBINDOPT(IgnoreXCOFFVisibility); + static cl::opt<std::string> BBSections( "basic-block-sections", cl::desc("Emit basic blocks into separate sections"), @@ -479,6 +487,7 @@ TargetOptions codegen::InitTargetOptionsFromCodeGenFlags() { Options.RelaxELFRelocations = getRelaxELFRelocations(); Options.DataSections = getDataSections(); Options.FunctionSections = getFunctionSections(); + Options.IgnoreXCOFFVisibility = getIgnoreXCOFFVisibility(); Options.BBSections = getBBSectionsMode(Options); Options.UniqueSectionNames = getUniqueSectionNames(); Options.UniqueBasicBlockSectionNames = getUniqueBasicBlockSectionNames(); |