diff options
author | Nick Desaulniers <ndesaulniers@google.com> | 2021-05-21 15:53:21 -0700 |
---|---|---|
committer | Nick Desaulniers <ndesaulniers@google.com> | 2021-05-21 15:53:30 -0700 |
commit | 033138ea452f5f493fb5095e5963419905ad12e1 (patch) | |
tree | cc4bb3cf5aa64b9a508d8e879f217d079a429185 /llvm/lib/CodeGen/CommandFlags.cpp | |
parent | ab3cd2601bac99b26952c6f1015387d60800d2e2 (diff) | |
download | llvm-033138ea452f5f493fb5095e5963419905ad12e1.zip llvm-033138ea452f5f493fb5095e5963419905ad12e1.tar.gz llvm-033138ea452f5f493fb5095e5963419905ad12e1.tar.bz2 |
[IR] make stack-protector-guard-* flags into module attrs
D88631 added initial support for:
- -mstack-protector-guard=
- -mstack-protector-guard-reg=
- -mstack-protector-guard-offset=
flags, and D100919 extended these to AArch64. Unfortunately, these flags
aren't retained for LTO. Make them module attributes rather than
TargetOptions.
Link: https://github.com/ClangBuiltLinux/linux/issues/1378
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D102742
Diffstat (limited to 'llvm/lib/CodeGen/CommandFlags.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CommandFlags.cpp | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp index 593a330..a7f6ca4 100644 --- a/llvm/lib/CodeGen/CommandFlags.cpp +++ b/llvm/lib/CodeGen/CommandFlags.cpp @@ -79,9 +79,6 @@ CGOPT_EXP(bool, FunctionSections) CGOPT(bool, IgnoreXCOFFVisibility) CGOPT(bool, XCOFFTracebackTable) CGOPT(std::string, BBSections) -CGOPT(std::string, StackProtectorGuard) -CGOPT(int, StackProtectorGuardOffset) -CGOPT(std::string, StackProtectorGuardReg) CGOPT(unsigned, TLSSize) CGOPT(bool, EmulatedTLS) CGOPT(bool, UniqueSectionNames) @@ -366,21 +363,6 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() { cl::init("none")); CGBINDOPT(BBSections); - static cl::opt<std::string> StackProtectorGuard( - "stack-protector-guard", cl::desc("Stack protector guard mode"), - cl::init("none")); - CGBINDOPT(StackProtectorGuard); - - static cl::opt<std::string> StackProtectorGuardReg( - "stack-protector-guard-reg", cl::desc("Stack protector guard register"), - cl::init("none")); - CGBINDOPT(StackProtectorGuardReg); - - static cl::opt<int> StackProtectorGuardOffset( - "stack-protector-guard-offset", cl::desc("Stack protector guard offset"), - cl::init(INT_MAX)); - CGBINDOPT(StackProtectorGuardOffset); - static cl::opt<unsigned> TLSSize( "tls-size", cl::desc("Bit size of immediate TLS offsets"), cl::init(0)); CGBINDOPT(TLSSize); @@ -502,26 +484,6 @@ codegen::getBBSectionsMode(llvm::TargetOptions &Options) { } } -llvm::StackProtectorGuards -codegen::getStackProtectorGuardMode(llvm::TargetOptions &Options) { - if (getStackProtectorGuard() == "tls") - return StackProtectorGuards::TLS; - if (getStackProtectorGuard() == "global") - return StackProtectorGuards::Global; - if (getStackProtectorGuard() == "sysreg") - return StackProtectorGuards::SysReg; - if (getStackProtectorGuard() != "none") { - ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr = - MemoryBuffer::getFile(getStackProtectorGuard()); - if (!MBOrErr) - errs() << "error illegal stack protector guard mode: " - << MBOrErr.getError().message() << "\n"; - else - Options.BBSectionsFuncListBuf = std::move(*MBOrErr); - } - return StackProtectorGuards::None; -} - // Common utility function tightly tied to the options listed here. Initializes // a TargetOptions object with CodeGen flags and returns it. TargetOptions @@ -558,9 +520,6 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) { Options.BBSections = getBBSectionsMode(Options); Options.UniqueSectionNames = getUniqueSectionNames(); Options.UniqueBasicBlockSectionNames = getUniqueBasicBlockSectionNames(); - Options.StackProtectorGuard = getStackProtectorGuardMode(Options); - Options.StackProtectorGuardOffset = getStackProtectorGuardOffset(); - Options.StackProtectorGuardReg = getStackProtectorGuardReg(); Options.TLSSize = getTLSSize(); Options.EmulatedTLS = getEmulatedTLS(); Options.ExplicitEmulatedTLS = EmulatedTLSView->getNumOccurrences() > 0; |