[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#178645: sparc gcc-compat



On Sat, Feb 08, 2003 at 10:32:43PM +0900, GOTO Masanori wrote:
[..snip..]
> Thanks!  I added it in debian-glibc cvs.  I hope next release does not
> cause symbol resolutions on sparc32 :)
Unfortunately the patch contains a glitch in __muldi3 which causes an
endless loop in the testsuite. Fixed version attached. It passes make
check again now.

> 
> BTW, could you have any plan to submit these patches into upstream?
We should first check if everything works out right. If so, I'll submit
them upstream. I'd prefer to have the libgcc-compat.c rewritten in
assembler for mips and sparc so we can replace the funtion calls by a
simple jump but I think it's more important to move glibc into testing
first.
Regards,
 -- Guido
#! /bin/sh -e

# DP: Description: libgcc-compat symbols for sparc32
# DP: Author: Guido Guenther <agx@sigxcpu.org>
# DP: Upstream status: Not submitted
# DP: Date: 2002-02-07

if [ $# -ne 2 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch -d "$2" -f --no-backup-if-mismatch -p0 < $0;;
    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p0 < $0;;
    *)
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
	exit 1
esac
exit 0

--- /dev/null	Sat Mar 16 18:32:44 2002
+++ sysdeps/sparc/sparc32/libgcc-compat.c	Fri Feb  7 00:29:23 2003
@@ -0,0 +1,112 @@
+/* pre-.hidden libgcc compatibility
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Guido Guenther <agx@sigxcpu.org>
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+
+#include <stdint.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_6)
+
+extern int64_t __ashldi3 (int64_t, int32_t);
+int64_t __ashldi3_internal (int64_t u, int32_t b)
+{
+  return __ashldi3 (u, b);
+}
+symbol_version (__ashldi3_internal, __ashldi3, GLIBC_2.0);
+
+
+extern int64_t __ashrdi3 (int64_t, int32_t);
+int64_t __ashrdi3_internal (int64_t u, int32_t b)
+{
+  return __ashrdi3 (u, b);
+}
+symbol_version (__ashrdi3_internal, __ashrdi3, GLIBC_2.0);
+
+
+extern int64_t __lshrdi3 (int64_t, int32_t);
+int64_t __lshrdi3_internal (int64_t u, int32_t b)
+{
+  return __lshrdi3 (u, b);
+}
+symbol_version (__lshrdi3_internal, __lshrdi3, GLIBC_2.0);
+
+extern int32_t __cmpdi2 (int64_t, int64_t);
+int32_t __cmpdi2_internal (int64_t u, int64_t v)
+{
+  return __cmpdi2 (u, v);
+}
+symbol_version (__cmpdi2_internal, __cmpdi2, GLIBC_2.0);
+
+
+extern int32_t __ucmpdi2 (int64_t, int64_t);
+int32_t __ucmpdi2_internal (int64_t u, int64_t v)
+{
+  return __ucmpdi2 (u, v);
+}
+symbol_version (__ucmpdi2_internal, __ucmpdi2, GLIBC_2.0);
+
+
+extern int64_t __fixdfdi (double);
+int64_t __fixdfdi_internal (double d)
+{
+  return __fixdfdi (d);
+}
+symbol_version (__fixdfdi_internal, __fixdfdi, GLIBC_2.0);
+
+
+extern int64_t __fixsfdi (float);
+int64_t __fixsfdi_internal (float d)
+{
+  return __fixsfdi (d);
+}
+symbol_version (__fixsfdi_internal, __fixsfdi, GLIBC_2.0);
+
+
+extern int64_t __fixunsdfdi (double);
+int64_t __fixunsdfdi_internal (double d)
+{
+	  return __fixunsdfdi (d);
+}
+symbol_version (__fixunsdfdi_internal, __fixunsdfdi, GLIBC_2.0);
+
+extern int64_t __fixunssfdi (float);
+int64_t __fixunssfdi_internal (float d)
+{
+  return __fixunssfdi (d);
+}
+
+symbol_version (__fixsfdi_internal, __fixsfdi, GLIBC_2.0);
+
+extern double __floatdidf (int64_t);
+double __floatdidf_internal (int64_t u)
+{
+	  return __floatdidf (u);
+}
+symbol_version (__floatdidf_internal, __floatdidf, GLIBC_2.0);
+
+
+extern float floatdisf (int64_t);
+float __floatdisf_internal (int64_t u)
+{
+  return __floatdisf (u);
+}
+symbol_version (__floatdisf_internal, __floatdisf, GLIBC_2.0);
+
+#endif
--- /dev/null	Sat Mar 16 18:32:44 2002
+++ sysdeps/sparc/sparc32/divdi3.c	Fri Feb  7 00:08:00 2003
@@ -0,0 +1,51 @@
+/* 64-bit multiplication and division libgcc routines for 32-bit sparc
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Guido Guenther <agx@sigxcpu.org>
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define _DIVDI3_C
+#include <sysdeps/wordsize-32/divdi3.c>
+
+INTDEF (__udivdi3);
+INTDEF (__moddi3);
+INTDEF (__umoddi3);
+
+#ifdef HAVE_DOT_HIDDEN
+asm (".hidden __divdi3");
+asm (".hidden __udivdi3");
+asm (".hidden __moddi3");
+asm (".hidden __umoddi3");
+#endif
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_6)
+
+symbol_version (INTUSE (__divdi3), __divdi3, GLIBC_2.0);
+symbol_version (INTUSE (__udivdi3), __udivdi3, GLIBC_2.0);
+symbol_version (INTUSE (__moddi3), __moddi3, GLIBC_2.0);
+symbol_version (INTUSE (__umoddi3), __umoddi3, GLIBC_2.0);
+
+extern DWtype __muldi3 (DWtype, DWtype);
+DWtype __muldi3_internal (DWtype u, DWtype v)
+{
+  return __muldi3 (u, v);
+}
+symbol_version (__muldi3_internal, __muldi3, GLIBC_2.0);
+
+#endif
Index: sysdeps/sparc/sparc32/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- sysdeps/sparc/sparc32/Makefile	6 Jul 2001 04:56:04 -0000	1.5
+++ sysdeps/sparc/sparc32/Makefile	6 Feb 2003 23:32:15 -0000
@@ -20,6 +20,17 @@
 sysdep_routines = dotmul umul $(divrem) alloca
 endif	# gnulib
 
+ifeq ($(subdir),csu)
+ifeq (yes,$(build-shared))
+# Compatibility
+ifeq (yes,$(have-protected))
+CPPFLAGS-libgcc-compat.c = -DHAVE_DOT_HIDDEN
+endif
+sysdep_routines += libgcc-compat
+shared-only-routines += libgcc-compat
+endif
+endif
+
 # We distribute these files, even though they are generated,
 # so as to avoid the need for a functioning m4 to build the library.
 divrem := sdiv udiv rem urem
Index: sysdeps/sparc/sparc32/Dist
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sparc/sparc32/Dist,v
retrieving revision 1.4
diff -u -u -r1.4 Dist
--- sysdeps/sparc/sparc32/Dist	9 Oct 2000 00:39:58 -0000	1.4
+++ sysdeps/sparc/sparc32/Dist	6 Feb 2003 23:51:09 -0000
@@ -7,3 +7,5 @@
 urem.S
 alloca.S
 ieee754.h
+divdi3.c
+libgcc-compat.c
--- sysdeps/sparc/sparc32/Versions.orig	2003-02-07 07:46:20.000000000 -0500
+++ sysdeps/sparc/sparc32/Versions	2003-02-07 07:46:58.000000000 -0500
@@ -1,5 +1,9 @@
 libc {
   GLIBC_2.0 {
     .div; .mul; .rem; .udiv; .umul; .urem;
+    __divdi3; __moddi3; __udivdi3; __umoddi3; __muldi3;
+    __ashldi3; __ashrdi3; __lshrdi3; __cmpdi2; __ucmpdi2;
+    __fixdfdi; __fixsfdi; __fixunsdfdi; __fixunssfdi; 
+    __floatdidf; __floatdisf;
   }
 }

Reply to: