aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/loongarch
diff options
context:
space:
mode:
authorLulu Cheng <chenglulu@loongson.cn>2022-09-07 11:25:45 +0800
committerLulu Cheng <chenglulu@loongson.cn>2022-09-07 16:53:10 +0800
commit0067ba052b976431c49d6a86f2c9ede9938efcdf (patch)
treea5c1857d623a4a8a823641220ea79e64832b62e6 /gcc/config/loongarch
parente90af965e5c858ba02c0cdfbac35d0a19da1c2f6 (diff)
downloadgcc-0067ba052b976431c49d6a86f2c9ede9938efcdf.zip
gcc-0067ba052b976431c49d6a86f2c9ede9938efcdf.tar.gz
gcc-0067ba052b976431c49d6a86f2c9ede9938efcdf.tar.bz2
LoongArch: Fix pr106828 by define hook TARGET_ASAN_SHADOW_OFFSET in loongarch backend [PR106828].
gcc/ChangeLog: PR target/106828 * config/loongarch/loongarch.cc (loongarch_asan_shadow_offset): New. (TARGET_ASAN_SHADOW_OFFSET): New. gcc/testsuite/ChangeLog: PR target/106828 * g++.target/loongarch/pr106828.C: New test.
Diffstat (limited to 'gcc/config/loongarch')
-rw-r--r--gcc/config/loongarch/loongarch.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index c9187bf..98c0e26 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -6466,6 +6466,16 @@ loongarch_use_anchors_for_symbol_p (const_rtx symbol)
return default_use_anchors_for_symbol_p (symbol);
}
+/* Implement the TARGET_ASAN_SHADOW_OFFSET hook. */
+
+static unsigned HOST_WIDE_INT
+loongarch_asan_shadow_offset (void)
+{
+ /* We only have libsanitizer support for LOONGARCH64 at present.
+ This value is taken from the file libsanitizer/asan/asan_mappint.h. */
+ return TARGET_64BIT ? (HOST_WIDE_INT_1 << 46) : 0;
+}
+
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t"
@@ -6660,6 +6670,9 @@ loongarch_use_anchors_for_symbol_p (const_rtx symbol)
#undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
#define TARGET_USE_ANCHORS_FOR_SYMBOL_P loongarch_use_anchors_for_symbol_p
+#undef TARGET_ASAN_SHADOW_OFFSET
+#define TARGET_ASAN_SHADOW_OFFSET loongarch_asan_shadow_offset
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-loongarch.h"