aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2008-09-22 01:54:03 +0000
committerHans-Peter Nilsson <hp@gcc.gnu.org>2008-09-22 01:54:03 +0000
commitc70d0414afa803f535420815116971725933234c (patch)
treedacbdaca2921aa2efeafb9bf75733643142af3ea /gcc/varasm.c
parentdf969fc7a3004d812d22a9855283e2f7cf7cf96a (diff)
downloadgcc-c70d0414afa803f535420815116971725933234c.zip
gcc-c70d0414afa803f535420815116971725933234c.tar.gz
gcc-c70d0414afa803f535420815116971725933234c.tar.bz2
re PR target/37170 (gcc.dg/weak/weak-1.c)
PR middle-end/37170 PR middle-end/37280 * final.c (mark_symbol_ref_as_used): New helper function. (output_operand): Instead of just looking inside MEMs for SYMBOL_REFs, use new helper function and for_each_rtx. * varasm.c (assemble_external): Move #ifndef ASM_OUTPUT_EXTERNAL to after weak-handling. Don't mark decls with TREE_STATIC as weak. Make head comment more general. * config/darwin.c (machopic_output_indirection): Handle weak references here, like in assemble_external. From-SVN: r140539
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index b3f9990..4fe3c96 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2290,9 +2290,10 @@ process_pending_assemble_externals (void)
to be emitted. */
static GTY(()) tree weak_decls;
-/* Output something to declare an external symbol to the assembler.
- (Most assemblers don't need this, so we normally output nothing.)
- Do nothing if DECL is not external. */
+/* Output something to declare an external symbol to the assembler,
+ and qualifiers such as weakness. (Most assemblers don't need
+ extern declaration, so we normally output nothing.) Do nothing if
+ DECL is not external. */
void
assemble_external (tree decl ATTRIBUTE_UNUSED)
@@ -2303,15 +2304,22 @@ assemble_external (tree decl ATTRIBUTE_UNUSED)
open. If it's not, we should not be calling this function. */
gcc_assert (asm_out_file);
-#ifdef ASM_OUTPUT_EXTERNAL
if (!DECL_P (decl) || !DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl))
return;
- if (SUPPORTS_WEAK && DECL_WEAK (decl))
+ /* We want to output annotation for weak and external symbols at
+ very last to check if they are references or not. */
+
+ if (SUPPORTS_WEAK && DECL_WEAK (decl)
+ /* TREE_STATIC is a weird and abused creature which is not
+ generally the right test for whether an entity has been
+ locally emitted, inlined or otherwise not-really-extern, but
+ for declarations that can be weak, it happens to be
+ match. */
+ && !TREE_STATIC (decl))
weak_decls = tree_cons (NULL, decl, weak_decls);
- /* We want to output external symbols at very last to check if they
- are references or not. */
+#ifdef ASM_OUTPUT_EXTERNAL
pending_assemble_externals = tree_cons (0, decl,
pending_assemble_externals);
#endif