Looks good to me
On Fri, Oct 3, 2014 at 5:07 PM, Yury Gribov <y.gri...@samsung.com> wrote: > Hi all, > > This patch disables generation of asan_init calls for KASan as discussed in > https://lkml.org/lkml/2014/9/26/711 > > Bootstrapped and regtested no x64. Ok to commit? > > -Y > > commit 91c015e54687666f4abf6745f33c2eee8e569d17 > Author: Yury Gribov <y.gri...@samsung.com> > Date: Fri Oct 3 11:53:38 2014 +0400 > > 2014-10-03 Yury Gribov <y.gri...@samsung.com> > > gcc/ > * asan.c (asan_finish_file): Disable __asan_init calls for KASan; > don't emit empty ctors. > > diff --git a/gcc/asan.c b/gcc/asan.c > index f520eab..247661a 100644 > --- a/gcc/asan.c > +++ b/gcc/asan.c > @@ -2400,8 +2400,11 @@ asan_finish_file (void) > nor after .LASAN* array. */ > flag_sanitize &= ~SANITIZE_ADDRESS; > > - tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT); > - append_to_statement_list (build_call_expr (fn, 0), > &asan_ctor_statements); > + if (flag_sanitize & SANITIZE_USER_ADDRESS) > + { > + tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT); > + append_to_statement_list (build_call_expr (fn, 0), > &asan_ctor_statements); > + } > FOR_EACH_DEFINED_VARIABLE (vnode) > if (TREE_ASM_WRITTEN (vnode->decl) > && asan_protect_global (vnode->decl)) > @@ -2438,7 +2441,7 @@ asan_finish_file (void) > DECL_INITIAL (var) = ctor; > varpool_node::finalize_decl (var); > > - fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS); > + tree fn = builtin_decl_implicit (BUILT_IN_ASAN_REGISTER_GLOBALS); > tree gcount_tree = build_int_cst (pointer_sized_int_node, gcount); > append_to_statement_list (build_call_expr (fn, 2, > build_fold_addr_expr (var), > @@ -2453,8 +2456,9 @@ asan_finish_file (void) > cgraph_build_static_cdtor ('D', dtor_statements, > MAX_RESERVED_INIT_PRIORITY - 1); > } > - cgraph_build_static_cdtor ('I', asan_ctor_statements, > - MAX_RESERVED_INIT_PRIORITY - 1); > + if (asan_ctor_statements) > + cgraph_build_static_cdtor ('I', asan_ctor_statements, > + MAX_RESERVED_INIT_PRIORITY - 1); > flag_sanitize |= SANITIZE_ADDRESS; > } > >