From: Yury Gribov Date: Fri, 3 Oct 2014 14:17:28 +0000 (+0000) Subject: asan.c (asan_finish_file): Disable __asan_init calls for KASan; don't emit empty... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c6d129b0eaf2fb46b289b774057f5f04f23057f0;p=gcc.git asan.c (asan_finish_file): Disable __asan_init calls for KASan; don't emit empty ctors. 2014-10-03 Yury Gribov * asan.c (asan_finish_file): Disable __asan_init calls for KASan; don't emit empty ctors. From-SVN: r215851 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 56add5bffc1..3ed527741e5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-10-03 Yury Gribov + + * asan.c (asan_finish_file): Disable __asan_init calls for KASan; + don't emit empty ctors. + 2014-10-03 Eric Botcazou * convert.c (convert_to_integer): Do not introduce useless conversions diff --git a/gcc/asan.c b/gcc/asan.c index f520eab4c54..247661a528d 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; }