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

Re: how to find symbols needed for libgcc-compat in glibc



Guido,
   Here is a mockup patch that should be roughly what you need. Note 
that I haven't sanity checked the exact types and sizes for the calls
in libgcc-compat. Someone on mips will have to do that. Also if you
haven't gone through every single debian package and scanned for symbols
you may need to add more to libgcc-compat.c. You can look at...

http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/powerpc/Attic/libgcc-compat.c?cvsroot=glibc

to see some other ones you may actually need.

-------------------------------------------------------------------------------
diff -uNr libc/sysdeps/mips/Dist libc.mips/sysdeps/mips/Dist
--- libc/sysdeps/mips/Dist      2001-07-27 22:52:19.000000000 -0700
+++ libc.mips/sysdeps/mips/Dist 2002-10-14 06:28:16.000000000 -0700
@@ -1,3 +1,5 @@
+divdi3.c
+libgcc-compat.c
 setjmp_aux.c
 regdef.h
 sgidefs.h
diff -uNr libc/sysdeps/mips/divdi3.c libc.mips/sysdeps/mips/divdi3.c
--- libc/sysdeps/mips/divdi3.c  1969-12-31 17:00:00.000000000 -0700
+++ libc.mips/sysdeps/mips/divdi3.c     2002-10-14 06:03:04.000000000 -0700
@@ -0,0 +1,44 @@
+/* 64-bit multiplication and division libgcc routines for 32-bit Mips
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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);
+
+#endif
+
diff -uNr libc/sysdeps/mips/libgcc-compat.c libc.mips/sysdeps/mips/libgcc-compat
.c
--- libc/sysdeps/mips/libgcc-compat.c   1969-12-31 17:00:00.000000000 -0700
+++ libc.mips/sysdeps/mips/libgcc-compat.c      2002-10-14 06:19:07.000000000 -0
700
@@ -0,0 +1,41 @@
+/* pre-.hidden libgcc compatibility
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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 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);
+
+#endif
+
diff -uNr libc/sysdeps/mips/Makefile libc.mips/sysdeps/mips/Makefile
--- libc/sysdeps/mips/Makefile  2000-09-06 00:52:59.000000000 -0700
+++ libc.mips/sysdeps/mips/Makefile     2002-10-14 06:21:14.000000000 -0700
@@ -6,3 +6,15 @@
 ifeq ($(subdir),setjmp)
 sysdep_routines += setjmp_aux
 endif
+
+ifeq ($(subdir),csu)
+ifeq (yes,$(build-shared))
+# Compatibility
+ifeq (yes,$(have-protected))
+CPPFLAGS-divdi3.c = -DHAVE_DOT_HIDDEN
+CPPFLAGS-libgcc-compat.S = -DHAVE_DOT_HIDDEN
+endif
+sysdep_routines += libgcc-compat
+shared-only-routines += libgcc-compat
+endif
+endif
diff -uNr libc/sysdeps/mips/Versions libc.mips/sysdeps/mips/Versions
--- libc/sysdeps/mips/Versions  1969-12-31 17:00:00.000000000 -0700
+++ libc.mips/sysdeps/mips/Versions     2002-10-14 06:17:29.000000000 -0700
@@ -0,0 +1,7 @@
+libc {
+  GLIBC_2.0 {
+    # Functions from libgcc.
+    __divdi3; __moddi3; __udivdi3; __umoddi3;
+    __cmpdi2; __ucmpdi2;
+  }
+}
-------------------------------------------------------------------------------
Again the above patch hasn't been tested but is cribbed from what we currently
have for divdi3.c on powerpc32 and what we originally had used for
libgcc-compat.c before we changed over to optimized assembly.
                                     Jack



Reply to: