This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix visibility-16.c, weak-1.c and weak-16.c on arm*-*-* (PR target/37170)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 3 Nov 2008 14:12:34 +0100
- Subject: [PATCH] Fix visibility-16.c, weak-1.c and weak-16.c on arm*-*-* (PR target/37170)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
It seems REOPENing of PR37170 for arm is very similar to
http://gcc.gnu.org/ml/gcc-patches/2008-10/msg01299.html
I've fixed recently on s390. Arm similarly to s390 uses
assemble_integer to emit constant pool entries, and assemble_integer
doesn't go through output_operand's marking of referenced SYMBOL_REFs
using assemble_external. As more than one target needs this, I've
exported a new function from final.c instead of letting arm define
its own duplicate of the marking function.
Can anyone please test this on arm? I've tested by hand that the
3 tests are now fixed.
2008-11-03 Jakub Jelinek <jakub@redhat.com>
PR target/37170
* final.c (mark_symbol_refs_as_used): New function.
* output.h (mark_symbol_refs_as_used): New prototype.
* config/s390/s390.c (s390_mark_symbol_ref_as_used): Removed.
(s390_output_pool_entry): Use mark_symbol_refs_as_used.
* config/arm/arm.md (consttable_4): Likewise.
--- gcc/final.c.jj 2008-09-30 16:57:11.000000000 +0200
+++ gcc/final.c 2008-11-03 13:49:12.000000000 +0100
@@ -3349,8 +3349,9 @@ output_asm_label (rtx x)
assemble_name (asm_out_file, buf);
}
-/* Helper rtx-iteration-function for output_operand. Marks
- SYMBOL_REFs as referenced through use of assemble_external. */
+/* Helper rtx-iteration-function for mark_symbol_refs_as_used and
+ output_operand. Marks SYMBOL_REFs as referenced through use of
+ assemble_external. */
static int
mark_symbol_ref_as_used (rtx *xp, void *dummy ATTRIBUTE_UNUSED)
@@ -3374,6 +3375,14 @@ mark_symbol_ref_as_used (rtx *xp, void *
return 0;
}
+/* Marks SYMBOL_REFs in x as referenced through use of assemble_external. */
+
+void
+mark_symbol_refs_as_used (rtx x)
+{
+ for_each_rtx (&x, mark_symbol_ref_as_used, NULL);
+}
+
/* Print operand X using machine-dependent assembler syntax.
The macro PRINT_OPERAND is defined just to control this function.
CODE is a non-digit that preceded the operand-number in the % spec,
--- gcc/output.h.jj 2008-09-30 16:57:11.000000000 +0200
+++ gcc/output.h 2008-11-03 13:50:46.000000000 +0100
@@ -1,7 +1,7 @@
/* Declarations for insn-output.c. These functions are defined in recog.c,
final.c, and varasm.c.
Copyright (C) 1987, 1991, 1994, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of GCC.
@@ -97,6 +97,9 @@ extern int label_to_alignment (rtx);
/* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol. */
extern void output_asm_label (rtx);
+/* Marks SYMBOL_REFs in x as referenced through use of assemble_external. */
+extern void mark_symbol_refs_as_used (rtx);
+
/* Print a memory reference operand for address X
using machine-dependent assembler syntax. */
extern void output_address (rtx);
--- gcc/config/s390/s390.c.jj 2008-10-30 11:50:59.000000000 +0100
+++ gcc/config/s390/s390.c 2008-11-03 13:52:21.000000000 +0100
@@ -6664,25 +6664,6 @@ s390_chunkify_cancel (struct constant_po
}
}
-/* Helper rtx-iteration-function for s390_output_pool_entry. Marks
- SYMBOL_REFs as referenced through use of assemble_external. */
-
-static int
-s390_mark_symbol_ref_as_used (rtx *x, void *dummy ATTRIBUTE_UNUSED)
-{
- /* If we have a used symbol, we may have to emit assembly
- annotations corresponding to whether the symbol is external, weak
- or has non-default visibility. */
- if (GET_CODE (*x) == SYMBOL_REF)
- {
- tree t = SYMBOL_REF_DECL (*x);
- if (t)
- assemble_external (t);
- return -1;
- }
- return 0;
-}
-
/* Output the constant pool entry EXP in mode MODE with alignment ALIGN. */
void
@@ -6702,7 +6683,7 @@ s390_output_pool_entry (rtx exp, enum ma
case MODE_INT:
assemble_integer (exp, GET_MODE_SIZE (mode), align, 1);
- for_each_rtx (&exp, s390_mark_symbol_ref_as_used, NULL);
+ mark_symbol_refs_as_used (exp);
break;
default:
--- gcc/config/arm/arm.md.jj 2008-09-30 16:57:08.000000000 +0200
+++ gcc/config/arm/arm.md 2008-11-03 13:54:22.000000000 +0100
@@ -10835,6 +10835,7 @@
}
default:
assemble_integer (operands[0], 4, BITS_PER_WORD, 1);
+ mark_symbol_refs_as_used (operands[0]);
break;
}
return \"\";
Jakub