[RISC-V] Add support for AddressSanitizer on RISC-V GCC
Joshua
cooper.joshua@linux.alibaba.com
Wed Aug 19 08:02:09 GMT 2020
From: cooper.joshua <cooper.joshua@linux.alibaba.com>
gcc/
* config/riscv/riscv.c (asan_shadow_offset): Implement the offset of asan shadow memory for risc-v.
(asan_shadow_offset): new macro definition.
---
gcc/config/riscv/riscv.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index 63b0c38..b85b459 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -5292,6 +5292,14 @@ riscv_gpr_save_operation_p (rtx op)
return true;
}
+/* Implement TARGET_ASAN_SHADOW_OFFSET. */
+
+static unsigned HOST_WIDE_INT
+riscv_asan_shadow_offset (void)
+{
+ return HOST_WIDE_INT_1U << 36;
+}
+
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t"
@@ -5475,6 +5483,9 @@ riscv_gpr_save_operation_p (rtx op)
#undef TARGET_NEW_ADDRESS_PROFITABLE_P
#define TARGET_NEW_ADDRESS_PROFITABLE_P riscv_new_address_profitable_p
+#undef TARGET_ASAN_SHADOW_OFFSET
+#define TARGET_ASAN_SHADOW_OFFSET riscv_asan_shadow_offset
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-riscv.h"
--
2.7.4
More information about the Gcc-patches
mailing list