Hi,
as mentioned in PR, Linux kernel 4.9 fails to build with ASan due to
wrong handling of emitted ODR indicator symbols. Although this might be
a kernel bug (relying on specific pattern in symbol name sounds
questionable), kernel doesn't need ODR indicators at all thus we can
just disable them if -fsanitize=kernel-address is present.
Tested on x86_64-unknown-linux-gnu, OK for trunk?
-Maxim
gcc/ChangeLog:
2017-01-13 Maxim Ostapenko <m.ostape...@samsung.com>
PR sanitizer/78887
* asan.c (asan_needs_odr_indicator_p): Don't emit ODR indicators
if -fsanitize=kernel-address is present.
diff --git a/gcc/asan.c b/gcc/asan.c
index bc7ebc8..157d468 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2360,7 +2360,8 @@ 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);
+ 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.