diff options
author | Zhaoshi Zheng <zhaoshiz@quicinc.com> | 2020-03-26 22:09:31 -0700 |
---|---|---|
committer | Zhaoshi Zheng <zhaoshiz@quicinc.com> | 2020-09-17 16:02:35 -0700 |
commit | 1c466477ad468d8a18c43b738df7b7fc6213e9a8 (patch) | |
tree | 3e000675309d0c205ac0f5e48be0b69c90aede3f /clang/lib/Driver/ToolChain.cpp | |
parent | b04c181ed776c344e6f5e2653a22bc6e5746834a (diff) | |
download | llvm-1c466477ad468d8a18c43b738df7b7fc6213e9a8.zip llvm-1c466477ad468d8a18c43b738df7b7fc6213e9a8.tar.gz llvm-1c466477ad468d8a18c43b738df7b7fc6213e9a8.tar.bz2 |
[RISCV] Support Shadow Call Stack
Currenlty assume x18 is used as pointer to shadow call stack. User shall pass
flags:
"-fsanitize=shadow-call-stack -ffixed-x18"
Runtime supported is needed to setup x18.
If SCS is desired, all parts of the program should be built with -ffixed-x18 to
maintain inter-operatability.
There's no particuluar reason that we must use x18 as SCS pointer. Any register
may be used, as long as it does not have designated purpose already, like RA or
passing call arguments.
Differential Revision: https://reviews.llvm.org/D84414
Diffstat (limited to 'clang/lib/Driver/ToolChain.cpp')
-rw-r--r-- | clang/lib/Driver/ToolChain.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index f04b10e..a6c8368 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -1029,7 +1029,8 @@ SanitizerMask ToolChain::getSupportedSanitizers() const { getTriple().getArch() == llvm::Triple::arm || getTriple().isWasm() || getTriple().isAArch64()) Res |= SanitizerKind::CFIICall; - if (getTriple().getArch() == llvm::Triple::x86_64 || getTriple().isAArch64()) + if (getTriple().getArch() == llvm::Triple::x86_64 || + getTriple().isAArch64() || getTriple().isRISCV()) Res |= SanitizerKind::ShadowCallStack; if (getTriple().isAArch64()) Res |= SanitizerKind::MemTag; |