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]

Re: PATCH: Enable softfp support on Solaris 2/x86 (PR target/39048)


Uros Bizjak <ubizjak@gmail.com> writes:

> Please use version with alternatives, like:
>
> Index: sfp-machine.h
> ===================================================================
> --- sfp-machine.h    (revision 157017)
> +++ sfp-machine.h    (working copy)
> @@ -136,7 +136,7 @@
>      if (_fex & FP_EX_INVALID)                        \
>        {                                    \
>      float f = 0.0;                            \
> -    __asm__ __volatile__ ("fdiv %0" : "+t" (f));            \
> +    __asm__ __volatile__ ("fdiv {%y0, %0|%0, %y0}" : "+t" (f));    \
>      __asm__ __volatile__ ("fwait");                    \
>        }                                    \
>      if (_fex & FP_EX_DIVZERO)                        \

Worked like a charm, thanks.

> The patch is OK for mainline, but please let Joseph also approve symbol
> versioning (I'm not that familiar with versioning stuff).

I had been developing the patch without network access, so I missed a
couple of important issues.  The following patch incorporates my
findings:

* To completely enable 128-bit soft-float, I also had to properly define
  LIBGCC2_HAS_TF_MODE, LIBGCC2_TF_CEXT, and TF_SIZE in
  config/i386/sol2.h.

* To get correct versioning for libgcc_s.so, I needed a new Solaris
  2-specific version map which adds all the new functions to a GCC_4.5.0
  version to match where they were introduced.  While creating that
  file, I noticed that __unordtf2 is missing from libgcc-std.ver.  I
  suppose this is an oversight; probably it should be added under the
  GCC_4.5.0 version, too.

This patch passed testing on i386-pc-solaris2.11 with both Sun as and
gas, and fixed the testsuite failures recorded in the PR.

Ok for mainline now?

	Rainer

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


 2010-02-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
	gcc:
	PR target/39048
	* config.gcc (i[34567]86-*-solaris2*): Add i386/t-fprules-softfp
	and soft-fp/t-softfp to tmake_file.
	* config/i386/sol2.h (LIBGCC2_HAS_TF_MODE): Redefine.
	(LIBGCC2_TF_CEXT): Define.
	(TF_SIZE): Define.

2010-02-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
	    Uros Bizjak <ubizjak@gmail.com>

	libgcc:
	PR target/39048
	* config.host (i[34567]86-*-solaris2): Handle 32-bit Solaris 2/x86
	like other remaining 32-bit x86 OSes.
	* config/i386/32/sfp-machine.h (FP_HANDLE_EXCEPTIONS): Support Sun
	assembler syntax.
	* config/i386/libgcc-sol2.ver: New file.
	* config/i386/t-sol2 (SHLIB_MAPFILES): Add it.

diff -r 535485321291 -r 1960a60f3409 gcc/config.gcc
--- a/gcc/config.gcc	Mon Mar 15 20:19:30 2010 +0100
+++ b/gcc/config.gcc	Mon Mar 15 20:19:31 2010 +0100
@@ -3402,6 +3402,9 @@
 	i[34567]86-*-linux* | x86_64-*-linux* | i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu)
 		tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp i386/t-linux"
 		;;
+	i[34567]86-*-solaris2*)
+		tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp"
+		;;
 	i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*)
 		tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp"
 		;;
diff -r 535485321291 -r 1960a60f3409 gcc/config/i386/sol2.h
--- a/gcc/config/i386/sol2.h	Mon Mar 15 20:19:30 2010 +0100
+++ b/gcc/config/i386/sol2.h	Mon Mar 15 20:19:31 2010 +0100
@@ -128,4 +128,10 @@
 #define USE_HIDDEN_LINKONCE 0
 #endif
 
+/* Put all *tf routines in libgcc.  */
+#undef LIBGCC2_HAS_TF_MODE
+#define LIBGCC2_HAS_TF_MODE 1
+#define LIBGCC2_TF_CEXT q
+#define TF_SIZE 113
+
 #define MD_UNWIND_SUPPORT "config/i386/sol2-unwind.h"
diff -r 535485321291 -r 1960a60f3409 libgcc/config.host
--- a/libgcc/config.host	Mon Mar 15 20:19:30 2010 +0100
+++ b/libgcc/config.host	Mon Mar 15 20:19:31 2010 +0100
@@ -600,6 +600,7 @@
 i[34567]86-*-darwin* | x86_64-*-darwin* | \
   i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
   i[34567]86-*-linux* | x86_64-*-linux* | \
+  i[34567]86-*-solaris2* | \
   i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*)
 	if test "${host_address}" = 32; then
 		tmake_file="${tmake_file} t-softfp i386/${host_address}/t-fprules-softfp"
diff -r 535485321291 -r 1960a60f3409 libgcc/config/i386/32/sfp-machine.h
--- a/libgcc/config/i386/32/sfp-machine.h	Mon Mar 15 20:19:30 2010 +0100
+++ b/libgcc/config/i386/32/sfp-machine.h	Mon Mar 15 20:19:31 2010 +0100
@@ -136,7 +136,7 @@
     if (_fex & FP_EX_INVALID)						\
       {									\
 	float f = 0.0;							\
-	__asm__ __volatile__ ("fdiv %0" : "+t" (f));			\
+	__asm__ __volatile__ ("fdiv {%y0, %0|%0, %y0}" : "+t" (f));	\
 	__asm__ __volatile__ ("fwait");					\
       }									\
     if (_fex & FP_EX_DIVZERO)						\
diff -r 535485321291 -r 1960a60f3409 libgcc/config/i386/libgcc-sol2.ver
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgcc/config/i386/libgcc-sol2.ver	Mon Mar 15 20:19:31 2010 +0100
@@ -0,0 +1,95 @@
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# 128 bit long double support was introduced with GCC 4.5.0 for Solaris 2.
+# These lines make the symbols to get a @@GCC_4.5.0.
+
+%exclude {
+  __addtf3
+  __divtc3
+  __divtf3
+  __eqtf2
+  __extenddftf2
+  __extendsftf2
+  __extendxftf2
+  __fixtfdi
+  __fixtfsi
+  __fixtfti
+  __fixunstfdi
+  __fixunstfsi
+  __fixunstfti
+  __floatditf
+  __floatsitf
+  __floattitf
+  __floatunditf
+  __floatunsitf
+  __floatuntitf
+  __getf2
+  __gttf2
+  __letf2
+  __lttf2
+  __multc3
+  __multf3
+  __negtf2
+  __netf2
+  __powitf2
+  __subtf3
+  __trunctfdf2
+  __trunctfsf2
+  __trunctfxf2
+# Strictly speaking, this isn't necessary since this is currently missing
+# from libgcc-std.ver, but this may be an omission.
+  __unordtf2
+}
+
+%inherit GCC_4.5.0 GCC_4.3.0
+GCC_4.5.0 {
+  __addtf3
+  __divtc3
+  __divtf3
+  __eqtf2
+  __extenddftf2
+  __extendsftf2
+  __extendxftf2
+  __fixtfdi
+  __fixtfsi
+  __fixtfti
+  __fixunstfdi
+  __fixunstfsi
+  __fixunstfti
+  __floatditf
+  __floatsitf
+  __floattitf
+  __floatunditf
+  __floatunsitf
+  __floatuntitf
+  __getf2
+  __gttf2
+  __letf2
+  __lttf2
+  __multc3
+  __multf3
+  __negtf2
+  __netf2
+  __powitf2
+  __subtf3
+  __trunctfdf2
+  __trunctfsf2
+  __trunctfxf2
+  __unordtf2
+}
diff -r 535485321291 -r 1960a60f3409 libgcc/config/i386/t-sol2
--- a/libgcc/config/i386/t-sol2	Mon Mar 15 20:19:30 2010 +0100
+++ b/libgcc/config/i386/t-sol2	Mon Mar 15 20:19:31 2010 +0100
@@ -32,3 +32,6 @@
 
 CRTSTUFF_T_CFLAGS = -fPIC -O2
 TARGET_LIBGCC2_CFLAGS = -fPIC
+
+# Add support for the introduction of 128-bit long double.
+SHLIB_MAPFILES += $(srcdir)/config/i386/libgcc-sol2.ver


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