]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR bootstrap/34003 (gcc trunk unable to bootstrap itself; Unsatisfied symbols...
authorJakub Jelinek <jakub@redhat.com>
Tue, 18 Dec 2007 05:05:43 +0000 (06:05 +0100)
committerJohn David Anglin <danglin@gcc.gnu.org>
Tue, 18 Dec 2007 05:05:43 +0000 (05:05 +0000)
PR bootstrap/34003
* c-decl.c (merge_decls): Copy RTL from olddecl to newdecl.
* config/pa/pa.c (pa_encode_section_info): If !first, preserve
SYMBOL_FLAG_REFERENCED flag.
* gcc.dg/pr34003-1.c: New test.
* gcc.dg/pr34003-2.c: New.

From-SVN: r131032

gcc/ChangeLog
gcc/c-decl.c
gcc/config/pa/pa.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr34003-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr34003-2.c [new file with mode: 0644]

index bdcb44bc2b1d8b4a6c8c913447d32273ece1ec47..3ed2a6f9efd788e6024b6b1e00e37b95f5ed2bb7 100644 (file)
@@ -1,3 +1,10 @@
+2007-12-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR bootstrap/34003
+       * c-decl.c (merge_decls): Copy RTL from olddecl to newdecl.
+       * config/pa/pa.c (pa_encode_section_info): If !first, preserve
+       SYMBOL_FLAG_REFERENCED flag.
+
 2007-12-13  Torbjorn Granlund  <tege@swox.com>
 
        * config/i386/i386.c (ix86_rtx_costs) [MULT]: Check op0 for
index 95ff9e115e4de49d8f72a504989e16492e23dd69..7cd79206dad0b2dd5f26d97fced288c1d61fdc3e 100644 (file)
@@ -1660,6 +1660,9 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
          }
     }
 
+  /* Keep the old rtl since we can safely use it.  */
+  if (HAS_RTL_P (olddecl))
+    COPY_DECL_RTL (olddecl, newdecl);
 
   /* Merge the type qualifiers.  */
   if (TREE_READONLY (newdecl))
index 368dcca767a2ef15edd4c88b552e6194a68d3637..20fde92e24f1d477b2ccd2f396c7938fb8553727 100644 (file)
@@ -7779,6 +7779,12 @@ hppa_encode_label (rtx sym)
 static void
 pa_encode_section_info (tree decl, rtx rtl, int first)
 {
+  int old_referenced = 0;
+
+  if (!first && MEM_P (rtl) && GET_CODE (XEXP (rtl, 0)) == SYMBOL_REF)
+    old_referenced
+      = SYMBOL_REF_FLAGS (XEXP (rtl, 0)) & SYMBOL_FLAG_REFERENCED;
+
   default_encode_section_info (decl, rtl, first);
 
   if (first && TEXT_SPACE_P (decl))
@@ -7787,6 +7793,8 @@ pa_encode_section_info (tree decl, rtx rtl, int first)
       if (TREE_CODE (decl) == FUNCTION_DECL)
        hppa_encode_label (XEXP (rtl, 0));
     }
+  else if (old_referenced)
+    SYMBOL_REF_FLAGS (XEXP (rtl, 0)) |= old_referenced;
 }
 
 /* This is sort of inverse to pa_encode_section_info.  */
index f8a31aae8a933e6412051d864852d5b42f380399..01034d03288fcfc916dfd1ef35b5a0386aae8d41 100644 (file)
@@ -1,3 +1,9 @@
+2007-12-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR bootstrap/34003
+       * gcc.dg/pr34003-1.c: New test.
+       * gcc.dg/pr34003-2.c: New.
+
 2007-12-10  Simon Martin  <simartin@users.sourceforge.net>
 
        PR c++/34059
diff --git a/gcc/testsuite/gcc.dg/pr34003-1.c b/gcc/testsuite/gcc.dg/pr34003-1.c
new file mode 100644 (file)
index 0000000..ff97fe6
--- /dev/null
@@ -0,0 +1,8 @@
+/* PR bootstrap/34003 */
+/* { dg-do link } */
+/* { dg-options "-O0" } */
+/* { dg-additional-sources "pr34003-2.c" } */
+
+extern void foo (void);
+int bar (void) { foo (); return 1; }
+extern void foo (void);
diff --git a/gcc/testsuite/gcc.dg/pr34003-2.c b/gcc/testsuite/gcc.dg/pr34003-2.c
new file mode 100644 (file)
index 0000000..a533056
--- /dev/null
@@ -0,0 +1,20 @@
+/* PR bootstrap/34003 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+extern void abort (void);
+
+int seen = 0;
+
+void foo (void)
+{
+  ++seen;
+}
+
+int main (void)
+{
+  extern int bar (void);
+  if (bar () != 1 || seen != 1)
+    abort ();
+  return 0;
+}