diff options
| author | Sam Elliott <selliott@lowrisc.org> | 2019-10-23 14:10:43 +0100 |
|---|---|---|
| committer | Sam Elliott <selliott@lowrisc.org> | 2019-10-23 14:12:52 +0100 |
| commit | 977205b595cd65fbeb4a045daf34990d8e8a5efd (patch) | |
| tree | 41a4d3e87960001b9f9800b77108de8f11982291 /compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp | |
| parent | 7bc7fe6b789d25d48d6dc71d533a411e9e981237 (diff) | |
| download | bcm5719-llvm-977205b595cd65fbeb4a045daf34990d8e8a5efd.tar.gz bcm5719-llvm-977205b595cd65fbeb4a045daf34990d8e8a5efd.zip | |
[Sanitizers] Add support for RISC-V 64-bit
Summary:
This has been tested with gcc trunk on openSUSE Tumbleweed on the HiFive Unleashed.
Patch by Andreas Schwab (schwab)
Reviewers: luismarques
Reviewed By: luismarques
Subscribers: mhorne, emaste, luismarques, asb, mgorny, fedor.sergeev, simoncook, kito-cheng, shiva0217, rogfer01, rkruppe, lenary, s.egerton, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D66870
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp index 0b53da6c349..3807a79b1cd 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp @@ -407,7 +407,10 @@ uptr internal_unlink(const char *path) { } uptr internal_rename(const char *oldpath, const char *newpath) { -#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS || SANITIZER_OPENBSD +#if defined(__riscv) + return internal_syscall(SYSCALL(renameat2), AT_FDCWD, (uptr)oldpath, AT_FDCWD, + (uptr)newpath, 0); +#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS || SANITIZER_OPENBSD return internal_syscall(SYSCALL(renameat), AT_FDCWD, (uptr)oldpath, AT_FDCWD, (uptr)newpath); #else @@ -1972,6 +1975,11 @@ static void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) { # endif *bp = ucontext->uc_mcontext.gregs[11]; *sp = ucontext->uc_mcontext.gregs[15]; +#elif defined(__riscv) + ucontext_t *ucontext = (ucontext_t*)context; + *pc = ucontext->uc_mcontext.__gregs[REG_PC]; + *bp = ucontext->uc_mcontext.__gregs[REG_S0]; + *sp = ucontext->uc_mcontext.__gregs[REG_SP]; #else # error "Unsupported arch" #endif |

