From 656e6f3761bb4bfe3efe8279710f5f4b980604fa Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 7 Jan 2013 18:46:30 +0100 Subject: varasm.c (output_constant_def_contents): For asan_protect_global protected strings... * varasm.c (output_constant_def_contents): For asan_protect_global protected strings, adjust DECL_ALIGN if needed, before testing for anchored symbols. (place_block_symbol): Adjust size for asan protected STRING_CSTs if TREE_CONSTANT_POOL_ADDRESS_P. Increase alignment for asan protected normal decls. (output_object_block): For asan protected decls, emit asan padding after their contents. * asan.c (asan_protect_global): Don't check TREE_ASM_WRITTEN here. (asan_finish_file): Test it here instead. From-SVN: r194984 --- gcc/asan.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gcc/asan.c') diff --git a/gcc/asan.c b/gcc/asan.c index 40af45d..9d33876 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -1,5 +1,5 @@ /* AddressSanitizer, a fast memory error detector. - Copyright (C) 2012 Free Software Foundation, Inc. + Copyright (C) 2012, 2013 Free Software Foundation, Inc. Contributed by Kostya Serebryany This file is part of GCC. @@ -463,7 +463,6 @@ asan_protect_global (tree decl) || DECL_THREAD_LOCAL_P (decl) /* Externs will be protected elsewhere. */ || DECL_EXTERNAL (decl) - || !TREE_ASM_WRITTEN (decl) || !DECL_RTL_SET_P (decl) /* Comdat vars pose an ABI problem, we can't know if the var that is selected by the linker will have @@ -1699,7 +1698,8 @@ asan_finish_file (void) 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 (asan_protect_global (vnode->symbol.decl)) + if (TREE_ASM_WRITTEN (vnode->symbol.decl) + && asan_protect_global (vnode->symbol.decl)) ++gcount; htab_t const_desc_htab = constant_pool_htab (); htab_traverse (const_desc_htab, count_string_csts, &gcount); @@ -1721,7 +1721,8 @@ asan_finish_file (void) DECL_IGNORED_P (var) = 1; vec_alloc (v, gcount); FOR_EACH_DEFINED_VARIABLE (vnode) - if (asan_protect_global (vnode->symbol.decl)) + if (TREE_ASM_WRITTEN (vnode->symbol.decl) + && asan_protect_global (vnode->symbol.decl)) asan_add_global (vnode->symbol.decl, TREE_TYPE (type), v); struct asan_add_string_csts_data aascd; aascd.type = TREE_TYPE (type); -- cgit v1.1