aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index bca852d..daeb6e2 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2088,6 +2088,11 @@ contains_pointers_p (tree type)
it all the way to final. See PR 17982 for further discussion. */
static GTY(()) tree pending_assemble_externals;
+/* 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
/* Avoid O(external_decls**2) lookups in the pending_assemble_externals
TREE_LIST in assemble_external. */
@@ -2144,6 +2149,7 @@ process_pending_assemble_externals (void)
assemble_external_real (TREE_VALUE (list));
pending_assemble_externals = 0;
+ pending_assemble_externals_processed = true;
pointer_set_destroy (pending_assemble_externals_set);
#endif
}
@@ -2196,6 +2202,12 @@ assemble_external (tree decl ATTRIBUTE_UNUSED)
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);