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 sparc-linux -m32 -mlong-double-128 support (take 2)


On Tue, Mar 23, 2004 at 01:15:21PM -0800, Mark Mitchell wrote:
> >I've commited following patch to HEAD (well, slightly different version,
> >this is 3.4 patch), so that libgcc is built with -mlong-double-128
> >option.  Without that libgcc{.a,_s.so} lacks __fixtfdi, __fixunstfdi
> >and __floatditf functions which code generated with -mlong-double-128
> >might use.
> >Ok for 3.4/3.3?
> >
> > 
> >
> With this change, do we still build routines for non-128-bit long 
> double?  In other words, with this change do we get strictly a superset 
> of the routines we get before?

The change was a strict superset.  Unfortunately, I have only tested it with
a ldbl128 capable glibc and it turns out it doesn't work with non-ldbl128
capable glibc, due to undefined references to _Q_add etc.
http://gcc.gnu.org/ml/gcc/2004-03/msg01630.html and follow-up thread.

But, SPARC Compliance Defintion 2.3 mandates _Q_qtoll, _Q_qtoull, _Q_lltoq,
_Q_ulltoq functions in libc and apparently at least Solaris 2.8 has them,
similarly ldbl128 capable glibc has them as well.
Given that __floatditf, __fixunstfdi and __fixtfdi were the only 3 routines
which are added to libgcc.a/libgcc_s.so when it is built with
-mlong-double-128, I think it is preferrable to use the SCD 2.3 functions
and my previous patch can be backed out, so sparc*-*-linux* GCC will build
with both new and old glibc.

While working on that, I have discovered a typo in sol2.h on both 3.4 branch
and TRUNK (SOLARIS_CONVERSION_LIBFUNCS defined while the rest of
config/sparc always works with SUN_CONVERSION_LIBFUNCS).

Here is the patch I'd like to commit to trunk/3.4 (and similar change to
3.3, altough there is different libfunc registry), though I have no way
to test this on Solaris.  Kaveh/Eric or anybody else with Solaris,
could you please give this patch a shot?  Thanks.

2004-03-31  Jakub Jelinek  <jakub@redhat.com>

	* config/sparc/sparc.h (DITF_CONVERSION_LIBFUNCS): Define to 0.
	* config/sparc/linux.h (DITF_CONVERSION_LIBFUNCS): Redefine to 1.
	* config/sparc/linux64.h (DITF_CONVERSION_LIBFUNCS): Redefine to 1.
	* config/sparc/sol2.h (DITF_CONVERSION_LIBFUNCS): Redefine to 1.
	(SOLARIS_CONVERSION_LIBFUNCS): Rename to SUN_CONVERSION_LIBFUNCS.
	* config/sparc/sparc.c (sparc_init_libfuncs): Initialize optabs
	with _Q_qtoll, _Q_qtoull and _Q_lltoq if DITF_CONVERSION_LIBFUNCS.
	* config.gcc (sparc-*-linux*): Revert 2004-03-23 change.
	* config/sparc/t-linux64 (TARGET_LIBGCC2_CFLAGS): Likewise.
	* config/sparc/t-linux: Removed.

--- gcc/config.gcc.jj	2004-03-23 14:41:23.000000000 +0100
+++ gcc/config.gcc	2004-03-31 14:18:05.210420270 +0200
@@ -1813,7 +1813,7 @@ sparc-*-elf*)
 	;;
 sparc-*-linux*)		# SPARC's running GNU/Linux, libc6
 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/linux.h"
-	tmake_file="${tmake_file} sparc/t-linux sparc/t-crtfm"
+	tmake_file="${tmake_file} sparc/t-crtfm"
 	;;
 sparc-*-rtems*)
 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h sparc/sol2.h sparc/elf.h sparc/rtemself.h rtems.h"
--- gcc/config/sparc/sparc.h.jj	2004-03-09 16:09:08.000000000 +0100
+++ gcc/config/sparc/sparc.h	2004-03-31 15:13:52.997453246 +0200
@@ -2260,13 +2260,14 @@ do {                                    
 /* Assume by default that the _Qp_* 64-bit libcalls are implemented such
    that the inputs are fully consumed before the output memory is clobbered.  */
 
-#define TARGET_BUGGY_QP_LIB	0
+#define TARGET_BUGGY_QP_LIB	0
 
 /* Assume by default that we do not have the Solaris-specific conversion
    routines nor 64-bit integer multiply and divide routines.  */
 
-#define SUN_CONVERSION_LIBFUNCS 0
-#define SUN_INTEGER_MULTIPLY_64 0
+#define SUN_CONVERSION_LIBFUNCS 	0
+#define DITF_CONVERSION_LIBFUNCS	0
+#define SUN_INTEGER_MULTIPLY_64 	0
 
 /* Compute extra cost of moving data between one register class
    and another.  */
--- gcc/config/sparc/t-linux.jj	2004-03-23 14:40:39.000000000 +0100
+++ gcc/config/sparc/t-linux	2004-03-31 14:17:33.774054076 +0200
@@ -1,2 +0,0 @@
-# Compile libgcc2.a with pic and IEEE quad long double.
-TARGET_LIBGCC2_CFLAGS = -fPIC -mlong-double-128
--- gcc/config/sparc/linux64.h.jj	2004-02-23 00:16:42.000000000 +0100
+++ gcc/config/sparc/linux64.h	2004-03-31 15:14:39.517116317 +0200
@@ -305,6 +305,9 @@ do {									\
 
 /* #define DWARF_OFFSET_SIZE PTR_SIZE */
 
+#undef DITF_CONVERSION_LIBFUNCS
+#define DITF_CONVERSION_LIBFUNCS 1
+
 #if defined(HAVE_LD_EH_FRAME_HDR)
 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
 #endif
--- gcc/config/sparc/sol2.h.jj	2004-02-19 00:04:04.000000000 +0100
+++ gcc/config/sparc/sol2.h	2004-03-31 15:12:58.737177394 +0200
@@ -145,8 +145,11 @@ Boston, MA 02111-1307, USA.  */
 #undef TARGET_BUGGY_QP_LIB
 #define TARGET_BUGGY_QP_LIB	1
 
-#undef SOLARIS_CONVERSION_LIBFUNCS
-#define SOLARIS_CONVERSION_LIBFUNCS 1
+#undef SUN_CONVERSION_LIBFUNCS
+#define SUN_CONVERSION_LIBFUNCS 1
+
+#undef DITF_CONVERSION_LIBFUNCS
+#define DITF_CONVERSION_LIBFUNCS 1
 
 #undef SUN_INTEGER_MULTIPLY_64
 #define SUN_INTEGER_MULTIPLY_64 1
--- gcc/config/sparc/linux.h.jj	2004-02-23 00:16:42.000000000 +0100
+++ gcc/config/sparc/linux.h	2004-03-31 15:14:24.254851513 +0200
@@ -227,6 +227,9 @@ do {									\
 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
 #endif
 
+#undef DITF_CONVERSION_LIBFUNCS
+#define DITF_CONVERSION_LIBFUNCS 1
+
 #if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR)
 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
 #endif
--- gcc/config/sparc/sparc.c.jj	2004-03-09 16:09:08.000000000 +0100
+++ gcc/config/sparc/sparc.c	2004-03-31 15:15:47.876865360 +0200
@@ -8084,6 +8084,13 @@ sparc_init_libfuncs (void)
       set_conv_libfunc (ufix_optab,   SImode, TFmode, "_Q_qtou");
       set_conv_libfunc (sfloat_optab, TFmode, SImode, "_Q_itoq");
 
+      if (DITF_CONVERSION_LIBFUNCS)
+	{
+	  set_conv_libfunc (sfix_optab,   DImode, TFmode, "_Q_qtoll");
+	  set_conv_libfunc (ufix_optab,   DImode, TFmode, "_Q_qtoull");
+	  set_conv_libfunc (sfloat_optab, TFmode, DImode, "_Q_lltoq");
+	}
+
       if (SUN_CONVERSION_LIBFUNCS)
 	{
 	  set_conv_libfunc (sfix_optab, DImode, SFmode, "__ftoll");
--- gcc/config/sparc/t-linux64.jj	2004-03-23 14:40:51.000000000 +0100
+++ gcc/config/sparc/t-linux64	2004-03-31 14:17:28.918924178 +0200
@@ -17,7 +17,3 @@ SHLIB_MAPFILES = $(srcdir)/libgcc-std.ve
 CRTSTUFF_T_CFLAGS = `if test x$$($(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) \
 				 -print-multi-os-directory) \
 			= x../lib64; then echo -mcmodel=medany; fi`
-
-# Compile libgcc2.a with pic and for -m32 also IEEE quad long double.
-# -m64 implies -mlong-double-128, so this is no change for 64-bit.
-TARGET_LIBGCC2_CFLAGS = -fPIC -mlong-double-128

	Jakub


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