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