This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix gcc.dg/weak/weak-1.c on SPARC


This is again PR target/37170 but this time on the SPARC.  On this platform, 
symbols generally don't go from output_asm_insn through output_operand but 
directly through output_address or output_addr_const so

2008-07-22  Rafael �vila de Espíndola  <espindola@google.com>

	* c-typeck.c (build_external_ref): Don't call assemble_external.
	* final.c (output_operand): Call assemble_external.

and

2008-09-22  Hans-Peter Nilsson  <hp@axis.com>

	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.


are ineffective.


Symbols therefore need to be "marked" in output_addr_const for the SPARC but 
it turns out that they are already for another purpose there:

    case SYMBOL_REF:
      if (SYMBOL_REF_DECL (x))
	mark_decl_referenced (SYMBOL_REF_DECL (x));
#ifdef ASM_OUTPUT_SYMBOL_REF
      ASM_OUTPUT_SYMBOL_REF (file, x);
#else
      assemble_name (file, XSTR (x, 0));
#endif
      break;

so I'm wondering whether output_operand was the right place to mark them.

Tested on sparc-sun-solaris2.10, OK for mainline?


2008-11-23 ?Eric Botcazou ?<ebotcazou@adacore.com>

	* final.c (output_addr_const) <SYMBOL_REF>: Call assemble_external
	on the associated SYMBOL_REF_DECL node, if any.


-- 
Eric Botcazou
Index: final.c
===================================================================
--- final.c	(revision 142117)
+++ final.c	(working copy)
@@ -3440,7 +3440,10 @@ output_addr_const (FILE *file, rtx x)
 
     case SYMBOL_REF:
       if (SYMBOL_REF_DECL (x))
-	mark_decl_referenced (SYMBOL_REF_DECL (x));
+	{
+	  mark_decl_referenced (SYMBOL_REF_DECL (x));
+	  assemble_external (SYMBOL_REF_DECL (x));
+	}
 #ifdef ASM_OUTPUT_SYMBOL_REF
       ASM_OUTPUT_SYMBOL_REF (file, x);
 #else

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]