PATCH: Support Sun assembler for 64-bit Solaris/x86

Rainer Orth ro@techfak.uni-bielefeld.de
Mon Dec 8 18:22:00 GMT 2008


Prompted by a recent attempt to build gcc with Sun as on Solaris 10/x86, I
reported the problem that Sun as doesn't support the SYMBOL-. syntax used
by gas to Sun.  Cf. the thread at

	http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00908.html

for all the gory details.  After doing so, I was told that Sun as uses a
different syntax instead, namely

	SYMBOL@rel
resp.
	SYMBOL@rel64

The first variant dates back to at least 2001 (the earliest Solaris/x86
assembler I could easily test) and could already be put to good use to fix
PR libffi/26048,

	http://gcc.gnu.org/ml/gcc-patches/2008-12/msg00481.html

and the second was added for amd64 support.

The following patch uses this to emit the proper syntax in the only place
the SYMBOL-. syntax was used before.

It allowed me to bootstrap with Sun as on Solaris 10/x86 (both 32 and 64
bit) for the first time (together with the latest fix for the libffi PR
above).  Testsuite results are a little worse than with gas, but nothing
fundamental (a large part of the failures is due to the use of .stab*,
which seems to be a gas addition):

	http://gcc.gnu.org/ml/gcc-testresults/2008-12/msg00792.html

The sse4.1 tests e.g. fail with a runtime linker error:

ld.so.1: sse4_1-blendpd.exe: fatal: hardware capability unsupported: 0x800000  [ 0x800000 ]

The assembler marks an object file containing sse4.1 instructions as
requiring the corresponding hardware, but ld.so complains that the cpu
doesn't contain that support and refuses to load the binary.  This can be
worked around (and safely so since the code in question contains a runtime
test), though.  A similar problem occured in the OpenSolaris OS/Net
consolidation, and I'll dig up the solution there.

The gcc.target/x86_64/abi tests fail do to syntax errors in
gcc.target/x86_64/abi/asm-support.S:

Assembler: snapshot.S
        "asm-support.s", line 29 : Illegal multiplication

So it seems we're in pretty good shape overall.

Ok for mainline?

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University


Mon Dec  8 18:23:49 2008  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* config/i386/sol2-10.h [!HAVE_AS_IX86_DIFF_SECT_DELTA]
	(ASM_OUTPUT_DWARF_PCREL): Define.

Index: gcc/config/i386/sol2-10.h
===================================================================
--- gcc/config/i386/sol2-10.h	(revision 142371)
+++ gcc/config/i386/sol2-10.h	(working copy)
@@ -1,5 +1,5 @@
 /* Solaris 10 configuration.
-   Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
    Contributed by CodeSourcery, LLC.
 
 This file is part of GCC.
@@ -39,6 +39,15 @@ along with GCC; see the file COPYING3.  
 #ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
 #undef JUMP_TABLES_IN_TEXT_SECTION
 #define JUMP_TABLES_IN_TEXT_SECTION 1
+
+/* The native Solaris assembler cannot handle the SYMBOL-. syntax, but
+   requires SYMBOL@rel/@rel64 instead.  */
+#define ASM_OUTPUT_DWARF_PCREL(FILE, SIZE, LABEL)	\
+  do {							\
+    fputs (integer_asm_op (SIZE, FALSE), FILE);		\
+    assemble_name (FILE, LABEL);			\
+    fputs (SIZE == 8 ? "@rel64" : "@rel", FILE);	\
+  } while (0)
 #endif
 
 #undef NO_PROFILE_COUNTERS



More information about the Gcc-patches mailing list