On 11/12/18 1:07 PM, Jakub Jelinek wrote: > On Mon, Nov 12, 2018 at 01:03:41PM +0100, Martin Liška wrote: >> The patch reject usage of the mentioned options. >> >> Ready for trunk? >> Thanks, >> Martin >> >> gcc/ChangeLog: >> >> 2018-11-12 Martin Liska <mli...@suse.cz> >> >> PR sanitizer/87930 >> * config/i386/i386.c (ix86_option_override_internal): Error >> about usage -mabi=ms and -fsanitize={,kernel-}address. > > Please add testcases for this.
Done in attached patch. Can this be changed through attribute too? No. I'm going to install the patch. Thanks, Martin > If so, a test for that should be there too. > >> --- 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. */ >> > > > Jakub >
>From 7720cb384b33835a29beaaddb4a940a5eeadb13f Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Mon, 12 Nov 2018 12:55:33 +0100 Subject: [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930). gcc/ChangeLog: 2018-11-12 Martin Liska <mli...@suse.cz> PR sanitizer/87930 * config/i386/i386.c (ix86_option_override_internal): Error about usage -mabi=ms and -fsanitize={,kernel-}address. gcc/testsuite/ChangeLog: 2018-11-13 Martin Liska <mli...@suse.cz> PR sanitizer/87930 * gcc.target/i386/pr87930.c: New test. --- gcc/config/i386/i386.c | 5 +++++ gcc/testsuite/gcc.target/i386/pr87930.c | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr87930.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/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.19.1