diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-01-07 18:46:30 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-01-07 18:46:30 +0100 |
commit | 656e6f3761bb4bfe3efe8279710f5f4b980604fa (patch) | |
tree | c16c78fba132676d9465ffce223c5996274fa41b /gcc/asan.c | |
parent | b352afbab2dcdf3b48b08e377f48d17109297c46 (diff) | |
download | gcc-656e6f3761bb4bfe3efe8279710f5f4b980604fa.zip gcc-656e6f3761bb4bfe3efe8279710f5f4b980604fa.tar.gz gcc-656e6f3761bb4bfe3efe8279710f5f4b980604fa.tar.bz2 |
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
Diffstat (limited to 'gcc/asan.c')
-rw-r--r-- | gcc/asan.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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 <kcc@google.com> 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); |