OSDN Git Service

PR middle-end/52894
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Apr 2012 22:11:38 +0000 (22:11 +0000)
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Apr 2012 22:11:38 +0000 (22:11 +0000)
* varasm.c (process_pending_assemble_externals): Set
pending_assemble_externals_processed true.
(assemble_external): Call assemble_external_real if the pending
assemble externals have been processed.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@186296 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/varasm.c

index 9200f1f..a8d3d59 100644 (file)
@@ -1,3 +1,11 @@
+2012-04-10  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       PR middle-end/52894
+       * varasm.c (process_pending_assemble_externals): Set
+       pending_assemble_externals_processed true.
+       (assemble_external): Call assemble_external_real if the pending
+       assemble externals have been processed.
+
 2012-04-09  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR target/52717
 2012-04-09  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR target/52717
index 1e58bd4..0e6f327 100644 (file)
@@ -2108,6 +2108,11 @@ static GTY(()) tree pending_assemble_externals;
    the entire pending_assemble_externals list.  See assemble_external().  */
 static struct pointer_set_t *pending_assemble_externals_set;
 
    the entire pending_assemble_externals list.  See assemble_external().  */
 static struct pointer_set_t *pending_assemble_externals_set;
 
+/* Some targets delay some output to final using TARGET_ASM_FILE_END.
+   As a result, assemble_external can be called after the list of externals
+   is processed and the pointer set destroyed.  */
+static bool pending_assemble_externals_processed;
+
 #ifdef ASM_OUTPUT_EXTERNAL
 /* True if DECL is a function decl for which no out-of-line copy exists.
    It is assumed that DECL's assembler name has been set.  */
 #ifdef ASM_OUTPUT_EXTERNAL
 /* True if DECL is a function decl for which no out-of-line copy exists.
    It is assumed that DECL's assembler name has been set.  */
@@ -2160,6 +2165,7 @@ process_pending_assemble_externals (void)
     assemble_external_real (TREE_VALUE (list));
 
   pending_assemble_externals = 0;
     assemble_external_real (TREE_VALUE (list));
 
   pending_assemble_externals = 0;
+  pending_assemble_externals_processed = true;
   pointer_set_destroy (pending_assemble_externals_set);
 #endif
 }
   pointer_set_destroy (pending_assemble_externals_set);
 #endif
 }
@@ -2201,6 +2207,12 @@ assemble_external (tree decl ATTRIBUTE_UNUSED)
     weak_decls = tree_cons (NULL, decl, weak_decls);
 
 #ifdef ASM_OUTPUT_EXTERNAL
     weak_decls = tree_cons (NULL, decl, weak_decls);
 
 #ifdef ASM_OUTPUT_EXTERNAL
+  if (pending_assemble_externals_processed)
+    {
+      assemble_external_real (decl);
+      return;
+    }
+
   if (! pointer_set_insert (pending_assemble_externals_set, decl))
     pending_assemble_externals = tree_cons (NULL, decl,
                                            pending_assemble_externals);
   if (! pointer_set_insert (pending_assemble_externals_set, decl))
     pending_assemble_externals = tree_cons (NULL, decl,
                                            pending_assemble_externals);