diff options
author | Xiang1 Zhang <xiang1.zhang@intel.com> | 2020-10-22 09:46:42 +0800 |
---|---|---|
committer | Xiang1 Zhang <xiang1.zhang@intel.com> | 2020-10-22 10:08:14 +0800 |
commit | 7c3fea7721e421de235917d9454d448f976500fc (patch) | |
tree | 7a0295552af02255aa73b6c4be8c1bec2efe9a4f /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 007ffdc18c503094e705ffcdd3ad51b829b77348 (diff) | |
download | llvm-7c3fea7721e421de235917d9454d448f976500fc.zip llvm-7c3fea7721e421de235917d9454d448f976500fc.tar.gz llvm-7c3fea7721e421de235917d9454d448f976500fc.tar.bz2 |
[X86] Support customizing stack protector guard
Reviewed By: nickdesaulniers, MaskRay
Differential Revision: https://reviews.llvm.org/D88631
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index f61a393..ff0df26 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1254,6 +1254,21 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, } Opts.SSPBufferSize = getLastArgIntValue(Args, OPT_stack_protector_buffer_size, 8, Diags); + + Opts.StackProtectorGuard = + std::string(Args.getLastArgValue(OPT_mstack_protector_guard_EQ)); + + if (Arg *A = Args.getLastArg(OPT_mstack_protector_guard_offset_EQ)) { + StringRef Val = A->getValue(); + unsigned Offset = Opts.StackProtectorGuardOffset; + Val.getAsInteger(10, Offset); + Opts.StackProtectorGuardOffset = Offset; + } + + Opts.StackProtectorGuardReg = + std::string(Args.getLastArgValue(OPT_mstack_protector_guard_reg_EQ, + "none")); + Opts.StackRealignment = Args.hasArg(OPT_mstackrealign); if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) { StringRef Val = A->getValue(); |