From e4db210dd8683bf7b2a8ea828d6ea0b18967630a Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 13 Nov 2018 16:03:58 +0100 Subject: [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930). 2018-11-13 Martin Liska PR sanitizer/87930 * config/i386/i386.c (ix86_option_override_internal): Error about usage -mabi=ms and -fsanitize={,kernel-}address. 2018-11-13 Martin Liska PR sanitizer/87930 * gcc.target/i386/pr87930.c: New test. From-SVN: r266073 --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/i386.c | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr87930.c | 6 ++++++ 4 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr87930.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9201af4945f..fc809d395c6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-13 Martin Liska + + PR sanitizer/87930 + * config/i386/i386.c (ix86_option_override_internal): Error + about usage -mabi=ms and -fsanitize={,kernel-}address. + 2018-11-13 Andre Vieira * config/aarch64/aarch64.c diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 711bec0cc9d..b3e0807b894 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -3546,6 +3546,11 @@ ix86_option_override_internal (bool main_args_p, error ("-mabi=ms not supported with X32 ABI"); gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI); + if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS) && opts->x_ix86_abi == MS_ABI) + error ("%<-mabi=ms%> not supported with %<-fsanitize=address%>"); + if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS) && opts->x_ix86_abi == MS_ABI) + error ("%<-mabi=ms%> not supported with %<-fsanitize=kernel-address%>"); + /* For targets using ms ABI enable ms-extensions, if not explicit turned off. For non-ms ABI we turn off this option. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bc4530845fc..70d9e76834d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-11-13 Martin Liska + + PR sanitizer/87930 + * gcc.target/i386/pr87930.c: New test. + 2018-11-13 Richard Biener PR tree-optimization/87962 diff --git a/gcc/testsuite/gcc.target/i386/pr87930.c b/gcc/testsuite/gcc.target/i386/pr87930.c new file mode 100644 index 00000000000..e9cf29c221a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr87930.c @@ -0,0 +1,6 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-fsanitize=address -mabi=ms" } */ + +int i; + +/* { dg-error ".-mabi=ms. not supported with .-fsanitize=address." "" { target *-*-* } 0 } */ -- 2.30.2