summaryrefslogtreecommitdiff
path: root/gcc/asan.c
diff options
context:
space:
mode:
authorygribov <ygribov@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-03 14:17:28 +0000
committerygribov <ygribov@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-03 14:17:28 +0000
commit647918a42f4ffe365d3f1fa10d7e27a4312ce582 (patch)
treec5f459b34ea6dc6fe6a3c98986e714d27372b1e4 /gcc/asan.c
parentcf46051daa1c48e222ce01e94ebc93541a9f37ea (diff)
downloadgcc-647918a42f4ffe365d3f1fa10d7e27a4312ce582.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215851 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/asan.c')
-rw-r--r--gcc/asan.c14
1 files changed, 9 insertions, 5 deletions
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;
}