summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/targhooks.c7
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/m68k/20100512-1.c16
4 files changed, 32 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b9b67952f1d..b63cde5115b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-12 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * targhooks.c (default_stack_protect_guard): Avoid sharing RTL
+ for __stack_chk_guard.
+
2010-05-11 Jakub Jelinek <jakub@redhat.com>
* c-opts.c (c_common_parse_file): If start_end_main_source_file,
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 8df0de421f8..2c0a65dc926 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -499,6 +499,8 @@ default_stack_protect_guard (void)
if (t == NULL)
{
+ rtx x;
+
t = build_decl (UNKNOWN_LOCATION,
VAR_DECL, get_identifier ("__stack_chk_guard"),
ptr_type_node);
@@ -510,6 +512,11 @@ default_stack_protect_guard (void)
DECL_ARTIFICIAL (t) = 1;
DECL_IGNORED_P (t) = 1;
+ /* Do not share RTL as the declaration is visible outside of
+ current function. */
+ x = DECL_RTL (t);
+ RTX_FLAG (x, used) = 1;
+
stack_chk_guard_decl = t;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a1275c845c7..4daeaa6b6b7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2010-05-12 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * gcc.target/m68k/20100512-1.c: New.
+
2010-05-12 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/lto8.adb: New test.
diff --git a/gcc/testsuite/gcc.target/m68k/20100512-1.c b/gcc/testsuite/gcc.target/m68k/20100512-1.c
new file mode 100644
index 00000000000..d07bb519abc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/m68k/20100512-1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fstack-protector" } */
+/* { dg-require-effective-target fstack_protector } */
+/* There should be 2 references to __stack_chk_guard in every function. */
+/* { dg-final { scan-assembler-times "__stack_chk_guard" 4 } } */
+
+#include <stdlib.h>
+#include <string.h>
+void doTest1(void) {
+ volatile char foo[10];
+ memset((void *)foo, 1, 100);
+}
+void doTest2(void) {
+ volatile char foo[10];
+ memset((void *)foo, 1, 100);
+}