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]

Fix PR target/29987


Jakub kindly devised a patch to work around a bug of Sun 'as' pertaining to 
common directives and TLS on the SPARC.  Not really a regression but quite 
safe in my opinion so I think it's appropriate for this late stage 3.

Tested by Rainer Orth and myself on various versions of Solaris with the GNU 
linker and the Sun linker, applied on the mainline.


2008-11-29  Jakub Jelinek  <jakub@redhat.com>

	PR target/29987
	* config/sparc/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): Redefine.


-- 
Eric Botcazou
Index: config/sparc/sol2.h
===================================================================
--- config/sparc/sol2.h	(revision 142273)
+++ config/sparc/sol2.h	(working copy)
@@ -176,3 +176,21 @@ along with GCC; see the file COPYING3.  
       fprintf (FILE, "\n\tnop\n");				\
     }								\
   while (0)
+
+/* Solaris 'as' has a bug: a .common directive in .tbss section
+   behaves as .tls_common rather than normal non-TLS .common.  */
+#undef  ASM_OUTPUT_ALIGNED_COMMON
+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
+  do									\
+    {									\
+      if (TARGET_SUN_TLS						\
+	  && in_section							\
+	  && ((in_section->common.flags & (SECTION_TLS | SECTION_BSS))	\
+	      == (SECTION_TLS | SECTION_BSS)))				\
+	switch_to_section (bss_section);				\
+      fprintf ((FILE), "%s", COMMON_ASM_OP);				\
+      assemble_name ((FILE), (NAME));					\
+      fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",		\
+	       (SIZE), (ALIGN) / BITS_PER_UNIT);			\
+    }									\
+  while (0)

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