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

glibc patch needed on ppc for gcc >= 3.1 builds



Ben,
   We will need the following patch added to glibc for building
on ppc with gcc >= 3.1. A similiar patch will be required for all the
other arches as well. This patch already exists upstream in
glibc-2-2-branch (without the INTUSE macro in the 
sysdeps/powerpc/libgcc-compat.c file so you can grab that copy
from...

http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/powerpc/libgcc-compat.c?rev=1.1.2.3&content-type=text/x-cvsweb-markup&cvsroot=glibc&only_with_tag=glibc-2-2-branch

...and use its sysdeps/powerpc/libgcc-compat.c instead if you like).
However here is a complete patch that will work. 
                                    Jack
ps Franz Sirl created this patch by searching all the binaries for
libgcc symbols and them adding them to this libgcc-compat.c for
resolving but not linking into new binaries. This is because 
gcc > 3.1 fixes a bug with gcc incorrectly linking in libgcc
symbols into binaries. Without this sort of patch when glibc gets
rebuilt against gcc > 3.1, any pre-existing binaries expecting to
see these libgcc symbols resolved via glibc will be broken.
-------------------------------------------------------------------------------
#! /bin/sh -e

# All lines beginning with `# DP:' are a description of the patch.
# DP: Fix "/usr/include/bits/string2.h:419: 
# DP: warning: pointer of type `void *' used in arithmetic"
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

Index: sysdeps/powerpc/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/powerpc/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- sysdeps/powerpc/Makefile	6 Dec 2001 23:41:32 -0000	1.15
+++ sysdeps/powerpc/Makefile	15 May 2002 14:23:39 -0000
@@ -35,6 +35,11 @@ CFLAGS-initfini.s = -g0 -fpic -O1
 CFLAGS-init.o = -G0
 CFLAGS-gmon-start.o = -G0
 endif
+ifeq (yes,$(build-shared))
+# Compatibility
+sysdep_routines += divdi3 libgcc-compat
+shared-only-routines += divdi3 libgcc-compat
+endif
 endif
 
 ifeq ($(subdir),string)
Index: sysdeps/powerpc/Versions
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/powerpc/Versions,v
retrieving revision 1.2
diff -u -p -r1.2 Versions
--- sysdeps/powerpc/Versions	Wed Jun 19 21:29:49 2002
+++ sysdeps/powerpc/Versions.new	Wed Jun 19 21:32:53 2002
@@ -3,6 +3,17 @@
     _dl_cpuclock_offset;
   }
 }
+libc {
+  GLIBC_2.0 {
+    # Functions from libgcc.
+    __divdi3; __moddi3; __udivdi3; __umoddi3;
+    __cmpdi2; __ucmpdi2;
+    __ashldi3; __ashrdi3; __lshrdi3;
+    __fixdfdi; __fixunsdfdi;
+    __fixsfdi; __fixunssfdi;
+    __floatdidf; __floatdisf;
+  }
+}
 libm {
   GLIBC_2.1 {
     # symbols used in macros from sysdeps/powerpc/bits/fenv.h
--- /dev/null	Thu Oct  4 06:30:44 2001
+++ sysdeps/powerpc/libgcc-compat.c	Sun May 19 02:44:02 2002
@@ -0,0 +1,116 @@
+/* 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)
+
+# define INTUSE(name) name##_internal
+
+extern int64_t __ashldi3 (int64_t, int32_t);
+int64_t INTUSE (__ashldi3) (int64_t u, int32_t b)
+{
+  return __ashldi3 (u, b);
+}
+symbol_version (INTUSE (__ashldi3), __ashldi3, GLIBC_2.0);
+
+
+extern int64_t __ashrdi3 (int64_t, int32_t);
+int64_t INTUSE (__ashrdi3) (int64_t u, int32_t b)
+{
+  return __ashrdi3 (u, b);
+}
+symbol_version (INTUSE (__ashrdi3), __ashrdi3, GLIBC_2.0);
+
+
+extern int64_t __lshrdi3 (int64_t, int32_t);
+int64_t INTUSE (__lshrdi3) (int64_t u, int32_t b)
+{
+  return __lshrdi3 (u, b);
+}
+symbol_version (INTUSE (__lshrdi3), __lshrdi3, GLIBC_2.0);
+
+
+extern int32_t __cmpdi2 (int64_t, int64_t);
+int32_t INTUSE (__cmpdi2) (int64_t u, int64_t v)
+{
+  return __cmpdi2 (u, v);
+}
+symbol_version (INTUSE (__cmpdi2), __cmpdi2, GLIBC_2.0);
+
+
+extern int32_t __ucmpdi2 (int64_t, int64_t);
+int32_t INTUSE (__ucmpdi2) (int64_t u, int64_t v)
+{
+  return __ucmpdi2 (u, v);
+}
+symbol_version (INTUSE (__ucmpdi2), __ucmpdi2, GLIBC_2.0);
+
+
+extern int64_t __fixdfdi (double);
+int64_t INTUSE (__fixdfdi) (double d)
+{
+  return __fixdfdi (d);
+}
+symbol_version (INTUSE (__fixdfdi), __fixdfdi, GLIBC_2.0);
+
+
+extern int64_t __fixunsdfdi (double);
+int64_t INTUSE (__fixunsdfdi) (double d)
+{
+  return __fixunsdfdi (d);
+}
+symbol_version (INTUSE (__fixunsdfdi), __fixunsdfdi, GLIBC_2.0);
+
+
+extern int64_t __fixsfdi (float);
+int64_t INTUSE (__fixsfdi) (float d)
+{
+  return __fixsfdi (d);
+}
+symbol_version (INTUSE (__fixsfdi), __fixsfdi, GLIBC_2.0);
+
+
+extern int64_t __fixunssfdi (float);
+int64_t INTUSE (__fixunssfdi) (float d)
+{
+  return __fixunssfdi (d);
+}
+symbol_version (INTUSE (__fixunssfdi), __fixunssfdi, GLIBC_2.0);
+
+
+extern double __floatdidf (int64_t);
+double INTUSE (__floatdidf) (int64_t u)
+{
+  return __floatdidf (u);
+}
+symbol_version (INTUSE (__floatdidf), __floatdidf, GLIBC_2.0);
+
+
+extern float __floatdisf (int64_t);
+float INTUSE (__floatdisf) (int64_t u)
+{
+  return __floatdisf (u);
+}
+symbol_version (INTUSE (__floatdisf), __floatdisf, GLIBC_2.0);
+
+#endif
+



-- 
To UNSUBSCRIBE, email to debian-glibc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: