[llvm-branch-commits] [compiler-rt] 1bc85cb - [Sanitizer][RISCV] Fix redefinition of REG_SP
Luís Marques via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Nov 24 16:09:08 PST 2020
Author: Luís Marques
Date: 2020-11-25T00:04:47Z
New Revision: 1bc85cbbb80397cbc165500cc336fe8325bed07d
URL: https://github.com/llvm/llvm-project/commit/1bc85cbbb80397cbc165500cc336fe8325bed07d
DIFF: https://github.com/llvm/llvm-project/commit/1bc85cbbb80397cbc165500cc336fe8325bed07d.diff
LOG: [Sanitizer][RISCV] Fix redefinition of REG_SP
The include header sys/ucontext.h already defines REG_SP as 2, causing
redefinition warnings during compilation. This patch fixes that issue.
(We also can't just use the numerical definition provided by the header,
as REG_SP is used in this file this refers to a struct field.)
Differential Revision: https://reviews.llvm.org/D90934
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
index 0f1cadfeae39..2ecf87b096a1 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
@@ -513,6 +513,8 @@ static constexpr uptr kExtraRegs[] = {0};
#elif SANITIZER_RISCV64
typedef struct user_regs_struct regs_struct;
+// sys/ucontext.h already defines REG_SP as 2. Undefine it first.
+#undef REG_SP
#define REG_SP sp
static constexpr uptr kExtraRegs[] = {0};
#define ARCH_IOVEC_FOR_GETREGSET
More information about the llvm-branch-commits
mailing list