summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-11 12:06:07 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-11 12:06:07 +0000
commit1ba1559decff5860155cb2cef7c712069f6b90e2 (patch)
tree491a5fed91156bbc060b9acbd315e3c8d7a79b70
parent95af3f4e2fca8def8ed973357a9c0d75b4caed94 (diff)
downloadppe42-gcc-1ba1559decff5860155cb2cef7c712069f6b90e2.tar.gz
ppe42-gcc-1ba1559decff5860155cb2cef7c712069f6b90e2.zip
* varasm.c (get_variable_section): Don't return lcomm_section
for asan_protect_global decls. * asan.c (asan_protect_global): Only avoid public common variables. Don't call get_variable_section here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194393 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/asan.c7
-rw-r--r--gcc/varasm.c3
3 files changed, 8 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 282e55f9c4a..4766eb2aba9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2012-12-11 Jakub Jelinek <jakub@redhat.com>
+ * varasm.c (get_variable_section): Don't return lcomm_section
+ for asan_protect_global decls.
+ * asan.c (asan_protect_global): Only avoid public common variables.
+ Don't call get_variable_section here.
+
PR middle-end/43631
PR bootstrap/55615
* var-tracking.c (emit_note_insn_var_location): If insn is followed
diff --git a/gcc/asan.c b/gcc/asan.c
index 87d08d54901..45b0dbd2392 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -447,7 +447,6 @@ bool
asan_protect_global (tree decl)
{
rtx rtl, symbol;
- section *sect;
if (TREE_CODE (decl) == STRING_CST)
{
@@ -471,7 +470,7 @@ asan_protect_global (tree decl)
padding or not. */
|| DECL_ONE_ONLY (decl)
/* Similarly for common vars. People can use -fno-common. */
- || DECL_COMMON (decl)
+ || (DECL_COMMON (decl) && TREE_PUBLIC (decl))
/* Don't protect if using user section, often vars placed
into user section from multiple TUs are then assumed
to be an array of such vars, putting padding in there
@@ -493,10 +492,6 @@ asan_protect_global (tree decl)
|| TREE_CONSTANT_POOL_ADDRESS_P (symbol))
return false;
- sect = get_variable_section (decl, false);
- if (sect->common.flags & SECTION_COMMON)
- return false;
-
if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl)))
return false;
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 3c420c013d8..b6170e6d8d2 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1034,7 +1034,8 @@ get_variable_section (tree decl, bool prefer_noswitch_p)
&& !(prefer_noswitch_p && targetm.have_switchable_bss_sections)
&& bss_initializer_p (decl))
{
- if (!TREE_PUBLIC (decl))
+ if (!TREE_PUBLIC (decl)
+ && !(flag_asan && asan_protect_global (decl)))
return lcomm_section;
if (bss_noswitch_section)
return bss_noswitch_section;
OpenPOWER on IntegriCloud