aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@sifive.com>2019-08-19 03:21:44 +0000
committerKito Cheng <kito.cheng@sifive.com>2019-08-19 03:21:44 +0000
commit100facd3b5061645692f5db1cc846bb878dc133d (patch)
treeaf44f80923754951c1b569f8d66cda8eaf956d12 /gcc/toplev.c
parent351d6a13b28ff02967e9f11905886059b4e02209 (diff)
PR target/91441 - Turn off -fsanitize=kernel-address if TARGET_ASAN_SHADOW_OFFSET is not implemented.
- -fsanitize=kernel-address will call targetm.asan_shadow_offset () at asan_shadow_offset, so it will crash if TARGET_ASAN_SHADOW_OFFSET is not implemented, that's mean -fsanitize=kernel-address is not supported for target without TARGET_ASAN_SHADOW_OFFSET implementation. gcc/ChangeLog: PR target/91441 * toplev.c (process_options): Check TARGET_ASAN_SHADOW_OFFSET is implemented for -fsanitize=kernel-address, and merge check logic with -fsanitize=address. testsuite/ChangeLog: PR target/91441 * gcc.target/riscv/pr91441.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@274631 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 7e0b9216dea..ddbb8b49436 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1744,7 +1744,7 @@ process_options (void)
/* Address Sanitizer needs porting to each target architecture. */
if ((flag_sanitize & SANITIZE_ADDRESS)
- && !FRAME_GROWS_DOWNWARD)
+ && (!FRAME_GROWS_DOWNWARD || targetm.asan_shadow_offset == NULL))
{
warning_at (UNKNOWN_LOCATION, 0,
"%<-fsanitize=address%> and %<-fsanitize=kernel-address%> "
@@ -1752,14 +1752,6 @@ process_options (void)
flag_sanitize &= ~SANITIZE_ADDRESS;
}
- if ((flag_sanitize & SANITIZE_USER_ADDRESS)
- && targetm.asan_shadow_offset == NULL)
- {
- warning_at (UNKNOWN_LOCATION, 0,
- "%<-fsanitize=address%> not supported for this target");
- flag_sanitize &= ~SANITIZE_ADDRESS;
- }
-
/* Do not use IPA optimizations for register allocation if profiler is active
or patchable function entries are inserted for run-time instrumentation
or port does not emit prologue and epilogue as RTL. */