Message ID | 2117376.AL8OH6CNAI@polaris |
---|---|
State | New |
Headers | show |
On 10/17/2014 11:27 AM, Eric Botcazou wrote: >> The patch was slightly updated to take care of missing UBSan work >> (SANITIZE_FLOAT_DIVIDE, SANITIZE_FLOAT_CAST, SANITIZE_BOUNDS). > > --- a/gcc/opts.c > +++ b/gcc/opts.c > @@ -868,6 +868,20 @@ finish_options (struct gcc_options *opts, struct > gcc_options *opts_set, > /* The -gsplit-dwarf option requires -gpubnames. */ > if (opts->x_dwarf_split_debug_info) > opts->x_debug_generate_pub_sections = 1; > + > + /* Userspace and kernel ASan conflict with each other and with TSan. */ > + > + if ((flag_sanitize & SANITIZE_USER_ADDRESS) > + && (flag_sanitize & SANITIZE_KERNEL_ADDRESS)) > + error_at (loc, > + "-fsanitize=address is incompatible with " > + "-fsanitize=kernel-address"); > + > + if ((flag_sanitize & SANITIZE_ADDRESS) > + && (flag_sanitize & SANITIZE_THREAD)) > + error_at (loc, > + "-fsanitize=address and -fsanitize=kernel-address " > + "are incompatible with -fsanitize=thread"); > } > > Why aren't you using opts->x_ here, like all the code just above? Well, that's a backport of ancient patch from trunk so all credits go there. And flag_sanitize is indeed handled differently from other compiler flags. -Y
> Well, that's a backport of ancient patch from trunk so all credits go > there. And flag_sanitize is indeed handled differently from other > compiler flags. Really curious to know why...
On 10/17/2014 11:43 AM, Eric Botcazou wrote: >> Well, that's a backport of ancient patch from trunk so all credits go >> there. And flag_sanitize is indeed handled differently from other >> compiler flags. > > Really curious to know why... I bet this was a typo but let's wait for Jakub's comments. -Y
On Fri, Oct 17, 2014 at 12:44:26PM +0400, Yury Gribov wrote: > On 10/17/2014 11:43 AM, Eric Botcazou wrote: > >>Well, that's a backport of ancient patch from trunk so all credits go > >>there. And flag_sanitize is indeed handled differently from other > >>compiler flags. > > > >Really curious to know why... > > I bet this was a typo but let's wait for Jakub's comments. The obvious change to replace the direct flag with opts->x_ preapproved. Jakub
--- a/gcc/opts.c +++ b/gcc/opts.c @@ -868,6 +868,20 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, /* The -gsplit-dwarf option requires -gpubnames. */ if (opts->x_dwarf_split_debug_info) opts->x_debug_generate_pub_sections = 1; + + /* Userspace and kernel ASan conflict with each other and with TSan. */ + + if ((flag_sanitize & SANITIZE_USER_ADDRESS) + && (flag_sanitize & SANITIZE_KERNEL_ADDRESS)) + error_at (loc, + "-fsanitize=address is incompatible with " + "-fsanitize=kernel-address"); + + if ((flag_sanitize & SANITIZE_ADDRESS) + && (flag_sanitize & SANITIZE_THREAD)) + error_at (loc, + "-fsanitize=address and -fsanitize=kernel-address " + "are incompatible with -fsanitize=thread"); }