re PR sanitizer/78887 (Failure to build aarch64 allmodconfig Linux kernel 4.9)
authorMaxim Ostapenko <m.ostapenko@samsung.com>
Fri, 13 Jan 2017 10:08:50 +0000 (10:08 +0000)
committerMaxim Ostapenko <chefmax@gcc.gnu.org>
Fri, 13 Jan 2017 10:08:50 +0000 (12:08 +0200)
PR sanitizer/78887
* asan.c (asan_needs_odr_indicator_p): Don't emit ODR indicators
if -fsanitize=kernel-address is present.

From-SVN: r244402

gcc/ChangeLog
gcc/asan.c

index d79749ecefe401562cc104371cdc97b06fc23254..7aebebcbe00bceded68ca29d7ab52d2b747add36 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-13  Maxim Ostapenko  <m.ostapenko@samsung.com>
+
+       PR sanitizer/78887
+       * asan.c (asan_needs_odr_indicator_p): Don't emit ODR indicators
+       if -fsanitize=kernel-address is present.
+
 2017-01-13  Richard Biener  <rguenther@suse.de>
 
        * tree-pretty-print.c (dump_generic_node): Dump INTEGER_CSTs
index bc7ebc8f28a41eb4b746019dd4c2ce0a58b0c352..74500448a1246a59a3ff8029d6441d21b429e18c 100644 (file)
@@ -2360,7 +2360,16 @@ create_odr_indicator (tree decl, tree type)
 static bool
 asan_needs_odr_indicator_p (tree decl)
 {
-  return !DECL_ARTIFICIAL (decl) && !DECL_WEAK (decl) && TREE_PUBLIC (decl);
+  /* Don't emit ODR indicators for kernel because:
+     a) Kernel is written in C thus doesn't need ODR indicators.
+     b) Some kernel code may have assumptions about symbols containing specific
+        patterns in their names.  Since ODR indicators contain original names
+        of symbols they are emitted for, these assumptions would be broken for
+        ODR indicator symbols.  */
+  return (!(flag_sanitize & SANITIZE_KERNEL_ADDRESS)
+         && !DECL_ARTIFICIAL (decl)
+         && !DECL_WEAK (decl)
+         && TREE_PUBLIC (decl));
 }
 
 /* Append description of a single global DECL into vector V.