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]

[build, libffi] Support Solaris 8/9 x86 with Sun as


I've recently set up test machines (VirtualBox instances, actually) to
test GCC on Solaris 8 and 9/x86.  While testing with Sun as, a couple of
issues came up, some of them affecting bootstrap.  While the lack of rep
<insn>/lock <insn> support is already dealt with (PR target/44074),
there were other issues as well:

* The Solaris 8/x86 as cannot handle sse2 instructions, so I've changed
  the with_arch_32 default to pentiumpro from pentium 4 in that case.

* While the Solaris 9/x86 as supports .hidden, there's a subtle bug
  (unfixed in the latest patch) which breaks many testcases: in

.globl hidden
        .hidden hidden
hidden:
.globl default
        .set    default,hidden

  as marks default as STV_HIDDEN, while both gas and Solaris 10 as
  correctly use STV_DEFAULT.  Since I've found no workaround yet (I'll
  ask the Sun assembler guys if they know any), I'm checking for this
  and disable visibility support if the bug is present.

* Since most of my testing has been on Solaris 11/x86 with the Solaris 8
  and 9 assemblers (since the virtual machines are dog slow) and they
  cannot handle .quad yet, I've added a configure test for .quad support
  instead of hardcoding this in i386/sol2.h.

* I got a syntax error trying to compile soft-fp/addtf3.c:

        "addtf3.s", line 405 : Syntax error

	fdivp

  Instead of the undecorated fdivp, Sun as requires this

  	fdivp  %st,%st(1)

  exactly as emitted by dis.  I've changed
  libgcc/config/i386/32/sfp-machine.h to produce this result.

* The libffi configure test for pc-relative relocs didn't trigger since
  the older assemblers emit a slightly different error message: instead
  of 

        "/tmp/conftest.s", line 1 : Warning: Illegal subtraction - symbols from different sections: "foo", ".DOT-0"

  I only get

        "/tmp/conftest.s", line 1 : Illegal subtraction

  I've augmented the test to also check for Illegal, not only Warning.
  To be honest, I've no idea why the test doesn't simply check the
  compiler exit code, but didn't want to change this at this point.

* Unlike the Solaris 10/11 as, the older ones don't support .ascii, but
  only .string.  I've added a new configure test to check for that and
  use the result in src/x86/sysv.S.

With those changes, I've successfully bootstrapped mainline on
i386-pc-solaris2.11 with either gas 2.19, Solaris 8, 9 or 11 as.

Ok for mainline, 4.5 and 4.4 branches?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

2010-05-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libffi:
	* configure.ac (libffi_cv_as_x86_pcrel): Check for illegal in as
	output, too.
	(libffi_cv_as_ascii_pseudo_op): Check for .ascii.
	(libffi_cv_as_string_pseudo_op): Check for .string.
	* configure: Regenerate.
	* fficonfig.h.in: Regenerate.
	* src/x86/sysv.S (.eh_frame): Use .ascii, .string or error.

	libgcc:
	* config/i386/32/sfp-machine.h (FP_HANDLE_EXCEPTIONS): Support Sun
	assembler syntax.

	gcc:
	* config.gcc (i[34567]86-*-solaris2*): Default with_arch_32 to
	pentiumpro on Solaris 8/x86 with Sun as.
	* configure.ac (gcc_cv_as_hidden): Check for Solaris 9/x86 as
	hidden alias bug.
	(gcc_cv_as_ix86_quad): Check for .quad directive.
	* configure: Regenerate.
	* config.in: Regenerate.
	* config/i386/sol2.h (ASM_QUAD): Change guard to !HAVE_AS_IX86_QUAD.

diff -r 7a2504df0145 gcc/config.gcc
--- a/gcc/config.gcc	Mon May 17 19:02:37 2010 +0200
+++ b/gcc/config.gcc	Mon May 17 19:08:56 2010 +0200
@@ -1225,7 +1225,19 @@
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h i386/sysv4.h sol2.h"
 	# Set default arch_32 to pentium4, tune_32 to generic like the other
 	# i386 targets, although config.guess defaults to i386-pc-solaris2*.
-	with_arch_32=${with_arch_32:-pentium4}
+	case ${target} in
+	*-*-solaris2.8*)
+		if test x$gas = xyes; then
+			with_arch_32=${with_arch_32:-pentium4}
+		else
+			# Solaris 8/x86 as cannot handle sse2.
+			with_arch_32=${with_arch_32:-pentiumpro}
+		fi
+		;;
+	*)
+		with_arch_32=${with_arch_32:-pentium4}
+		;;
+	esac
 	with_tune_32=${with_tune_32:-generic}
 	case ${target} in
 	*-*-solaris2.1[0-9]*)
diff -r 7a2504df0145 gcc/config/i386/sol2.h
--- a/gcc/config/i386/sol2.h	Mon May 17 19:02:37 2010 +0200
+++ b/gcc/config/i386/sol2.h	Mon May 17 19:08:56 2010 +0200
@@ -72,7 +72,7 @@
 #define LOCAL_LABEL_PREFIX "."
 
 /* The 32-bit Solaris assembler does not support .quad.  Do not use it.  */
-#ifndef TARGET_BI_ARCH
+#ifndef HAVE_AS_IX86_QUAD
 #undef ASM_QUAD
 #endif
 
diff -r 7a2504df0145 gcc/configure.ac
--- a/gcc/configure.ac	Mon May 17 19:02:37 2010 +0200
+++ b/gcc/configure.ac	Mon May 17 19:08:56 2010 +0200
@@ -2152,7 +2152,35 @@
 gcc_GAS_CHECK_FEATURE([.hidden], gcc_cv_as_hidden,
  [elf,2,13,0],,
 [	.hidden foobar
-foobar:])
+foobar:],[
+# Solaris 9/x86 as incorrectly emits an alias for a hidden symbol with
+# STV_HIDDEN, so disable .hidden support if so.
+case "${target}" in
+  i?86-*-solaris2*)
+    if test x$gcc_cv_as != x && test x$gcc_cv_objdump != x; then
+      cat > conftest.s <<EOF
+.globl hidden
+        .hidden hidden
+hidden:
+.globl default
+        .set    default,hidden
+EOF
+      if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
+        && $gcc_cv_objdump -t conftest.o 2>/dev/null | \
+        grep '\.hidden default' > /dev/null; then
+        gcc_cv_as_hidden=no
+      else
+        gcc_cv_as_hidden=yes
+      fi
+    else
+      # Assume bug is present if objdump is missing.
+      gcc_cv_as_hidden=no
+    fi
+    ;;
+  *)
+    gcc_cv_as_hidden=yes
+    ;;
+esac])
 
 changequote(,)dnl
 if test $in_tree_ld != yes ; then
@@ -3252,6 +3280,12 @@
       [AC_DEFINE(HAVE_AS_IX86_FFREEP, 1,
         [Define if your assembler supports the ffreep mnemonic.])])
 
+    gcc_GAS_CHECK_FEATURE([.quad directive],
+      gcc_cv_as_ix86_quad,,,
+      [.quad 0],,
+      [AC_DEFINE(HAVE_AS_IX86_QUAD, 1,
+        [Define if your assembler supports the .quad directive.])])
+
     gcc_GAS_CHECK_FEATURE([sahf mnemonic],
       gcc_cv_as_ix86_sahf,,,
       [sahf],,
diff -r 7a2504df0145 libffi/configure.ac
--- a/libffi/configure.ac	Mon May 17 19:02:37 2010 +0200
+++ b/libffi/configure.ac	Mon May 17 19:08:56 2010 +0200
@@ -266,7 +266,7 @@
 	libffi_cv_as_x86_pcrel, [
 	libffi_cv_as_x86_pcrel=yes
 	echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
-	if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
+	if $CC $CFLAGS -c conftest.s 2>&1 | egrep -i 'illegal|warning' > /dev/null; then
 	    libffi_cv_as_x86_pcrel=no
 	fi
 	])
@@ -274,6 +274,32 @@
 	AC_DEFINE(HAVE_AS_X86_PCREL, 1,
 		  [Define if your assembler supports PC relative relocs.])
     fi
+
+    AC_CACHE_CHECK([assembler .ascii pseudo-op support],
+       libffi_cv_as_ascii_pseudo_op, [
+       libffi_cv_as_ascii_pseudo_op=unknown
+       # Check if we have .ascii
+       AC_TRY_COMPILE([asm (".ascii \"string\"");],,
+		       [libffi_cv_as_ascii_pseudo_op=yes],
+		       [libffi_cv_as_ascii_pseudo_op=no])
+    ])
+    if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then
+       AC_DEFINE(HAVE_AS_ASCII_PSEUDO_OP, 1,
+	       [Define if your assembler supports .ascii.])
+    fi
+
+    AC_CACHE_CHECK([assembler .string pseudo-op support],
+       libffi_cv_as_string_pseudo_op, [
+       libffi_cv_as_string_pseudo_op=unknown
+       # Check if we have .string
+       AC_TRY_COMPILE([asm (".string \"string\"");],,
+		       [libffi_cv_as_string_pseudo_op=yes],
+		       [libffi_cv_as_string_pseudo_op=no])
+    ])
+    if test "x$libffi_cv_as_string_pseudo_op" = xyes; then
+       AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1,
+	       [Define if your assembler supports .string.])
+    fi
 fi
 
 case "$target" in
diff -r 7a2504df0145 libffi/src/x86/sysv.S
--- a/libffi/src/x86/sysv.S	Mon May 17 19:02:37 2010 +0200
+++ b/libffi/src/x86/sysv.S	Mon May 17 19:08:56 2010 +0200
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------
-   sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008  Red Hat, Inc.
+   sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008, 2010  Red Hat, Inc.
    
    X86 Foreign Function Interface 
 
@@ -331,11 +331,21 @@
 .LSCIE1:
 	.long	0x0	/* CIE Identifier Tag */
 	.byte	0x1	/* CIE Version */
+#ifdef HAVE_AS_ASCII_PSEUDO_OP
 #ifdef __PIC__
 	.ascii "zR\0"	/* CIE Augmentation */
 #else
 	.ascii "\0"	/* CIE Augmentation */
 #endif
+#elif defined HAVE_AS_STRING_PSEUDO_OP
+#ifdef __PIC__
+	.string "zR"	/* CIE Augmentation */
+#else
+	.string ""	/* CIE Augmentation */
+#endif
+#else
+#error missing .ascii/.string
+#endif
 	.byte	0x1	/* .uleb128 0x1; CIE Code Alignment Factor */
 	.byte	0x7c	/* .sleb128 -4; CIE Data Alignment Factor */
 	.byte	0x8	/* CIE RA Column */
diff -r 7a2504df0145 libgcc/config/i386/32/sfp-machine.h
--- a/libgcc/config/i386/32/sfp-machine.h	Mon May 17 19:02:37 2010 +0200
+++ b/libgcc/config/i386/32/sfp-machine.h	Mon May 17 19:08:56 2010 +0200
@@ -142,7 +142,7 @@
     if (_fex & FP_EX_DIVZERO)						\
       {									\
 	float f = 1.0, g = 0.0;						\
-	__asm__ __volatile__ ("fdivp" : "=t" (f)			\
+	__asm__ __volatile__ ("fdivp {%0, %y2|%y2, %0}" : "=t" (f)	\
 			      	      : "0" (f), "u" (g)		\
 				      : "st(1)");			\
 	__asm__ __volatile__ ("fwait");					\


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