Commit 21fe7edc by Rafael Avila de Espindola Committed by Rafael Espindola

varasm.c (weak_decls): Move earlier in the file.

2008-08-19  Rafael Espindola  <espindola@google.com>

      * varasm.c (weak_decls): Move earlier in the file.
      (assemble_external): Add weak decls to the weak_decls list.
      (declare_weak): Don't add decls to the weak_decls list.

From-SVN: r139233
parent b8aaf506
2008-08-19 Rafael Espindola <espindola@google.com>
* varasm.c (weak_decls): Move earlier in the file.
(assemble_external): Add weak decls to the weak_decls list.
(declare_weak): Don't add decls to the weak_decls list.
2008-08-19 H.J. Lu <hongjiu.lu@intel.com> 2008-08-19 H.J. Lu <hongjiu.lu@intel.com>
PR target/37157 PR target/37157
......
...@@ -2286,6 +2286,10 @@ process_pending_assemble_externals (void) ...@@ -2286,6 +2286,10 @@ process_pending_assemble_externals (void)
#endif #endif
} }
/* This TREE_LIST contains any weak symbol declarations waiting
to be emitted. */
static GTY(()) tree weak_decls;
/* Output something to declare an external symbol to the assembler. /* Output something to declare an external symbol to the assembler.
(Most assemblers don't need this, so we normally output nothing.) (Most assemblers don't need this, so we normally output nothing.)
Do nothing if DECL is not external. */ Do nothing if DECL is not external. */
...@@ -2303,6 +2307,9 @@ assemble_external (tree decl ATTRIBUTE_UNUSED) ...@@ -2303,6 +2307,9 @@ assemble_external (tree decl ATTRIBUTE_UNUSED)
if (!DECL_P (decl) || !DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl)) if (!DECL_P (decl) || !DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl))
return; return;
if (SUPPORTS_WEAK && DECL_WEAK (decl))
weak_decls = tree_cons (NULL, decl, weak_decls);
/* We want to output external symbols at very last to check if they /* We want to output external symbols at very last to check if they
are references or not. */ are references or not. */
pending_assemble_externals = tree_cons (0, decl, pending_assemble_externals = tree_cons (0, decl,
...@@ -4846,10 +4853,6 @@ output_constructor (tree exp, unsigned HOST_WIDE_INT size, ...@@ -4846,10 +4853,6 @@ output_constructor (tree exp, unsigned HOST_WIDE_INT size,
assemble_zeros (size - total_bytes); assemble_zeros (size - total_bytes);
} }
/* This TREE_LIST contains any weak symbol declarations waiting
to be emitted. */
static GTY(()) tree weak_decls;
/* Mark DECL as weak. */ /* Mark DECL as weak. */
static void static void
...@@ -4942,12 +4945,7 @@ declare_weak (tree decl) ...@@ -4942,12 +4945,7 @@ declare_weak (tree decl)
error ("weak declaration of %q+D must be public", decl); error ("weak declaration of %q+D must be public", decl);
else if (TREE_CODE (decl) == FUNCTION_DECL && TREE_ASM_WRITTEN (decl)) else if (TREE_CODE (decl) == FUNCTION_DECL && TREE_ASM_WRITTEN (decl))
error ("weak declaration of %q+D must precede definition", decl); error ("weak declaration of %q+D must precede definition", decl);
else if (SUPPORTS_WEAK) else if (!SUPPORTS_WEAK)
{
if (! DECL_WEAK (decl))
weak_decls = tree_cons (NULL, decl, weak_decls);
}
else
warning (0, "weak declaration of %q+D not supported", decl); warning (0, "weak declaration of %q+D not supported", decl);
mark_weak (decl); mark_weak (decl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment