+2014-10-03 Yury Gribov <y.gribov@samsung.com>
+
+ * asan.c (asan_finish_file): Disable __asan_init calls for KASan;
+ don't emit empty ctors.
+
2014-10-03 Eric Botcazou <ebotcazou@adacore.com>
* convert.c (convert_to_integer): Do not introduce useless conversions
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))
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),
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;
}