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

librt-mips.dpatch should be replaced to the newer patch



Hi Guido, Thiemo and debian-mips toolchain guys,

At Thu, 17 Oct 2002 19:11:55 +0200,
Guido Guenther wrote:
> On Thu, Oct 17, 2002 at 07:02:40AM -0700, Jeff Bailey wrote:
> > Note for the mips folks: I applied the patch so you can compile, not
> > the patches for the testsuite.  I'll catch those next round, hopefully
> > with a CVS update so we get all the regex fixes too.
> let me point out that without[1]:
>  http://honk.physik.uni-konstanz.de/linux-mips/glibc/patches/librt-mips.dpatch
> glibc 2.3.1 does not even install on mips(el) since tzconfig fails.
> The symbols for clock_{set,get}time are versioned incorrectly in our
> woody glibc and the programs currently in the archive depend on
> these incorrectly versioned symbols.
> I might come up with another patch after looking into the current test
> failures(which will not be too soon), but the above patch should work
> around the problem fine until then.
> Regards,
>  -- Guido
> 
> [1] http://lists.debian.org/debian-glibc/2002/debian-glibc-200210/msg00081.html)

You reported this issue back to 2 years ago.  I put your patch which
resolved MIPS clock_{get,set}time woody compatibility problem greatly.

However, I think this patch is incomplete, so it does not fix the
actual problem.  It modifies symbol version of clock_{get,set}time
from GLIBC_2.2 to GLIBC_2.0:

	mips:~> objdump -T /lib/librt-2.3.2.so | & egrep "clock_.*time"
	00004c30 g    DF .text  00000000  GLIBC_2.0   clock_settime
	00004ae0 g    DF .text  00000000  GLIBC_2.0   clock_gettime

But /bin/ls has clock_gettime reference with version GLIBC_2.0.

	mips:~> objdump -T /bin/ls | & egrep "clock_.*time"
	00000000      DF *UND*  00000000  GLIBC_2.0   clock_gettime

So, if we removed librt-mips.dpatch, /bin/ls does not work.

	mips:/# /bin/ls
	/bin/ls: /lib/librt.so.1: version `GLIBC_2.0' not found (required by /bin/ls)

This means: (1) we cannot remove this patch after sarge. (2) various
binaries using librt on debian are incompatible with other distro's.
(3) glibc upstream cvs does not use directly without this patch on
debian chroot environment.  I concern especially (2) even if most
debian mips users don't distribute binary only DSO over distributions.

I fixed it with the attached updated patch librt-mips.dpatch.  It's
replaced with the current librt-mips.dpatch.  Using patched glibc,
librt provides both GLIBC_2.0 and GLIBC_2.2:

	mips:~> objdump -T /lib/librt-2.3.2.so | & egrep "clock_.*time"
	00004b10 g    DF .text  00000000 (GLIBC_2.0)  clock_gettime
	00004c60 g    DF .text  00000000 (GLIBC_2.0)  clock_settime
	00004c60 g    DF .text  00000000  GLIBC_2.2   clock_settime
	00004b10 g    DF .text  00000000  GLIBC_2.2   clock_gettime

The current /bin/ls works fine.  Installing coreutils which is built
with the patched debian glibc also shows nicely:

	mips# objdump -T build-tree/coreutils-5.2.1/src/ls |& egrep "clock_.*time"
	00418c40      DF *UND*  00000000  GLIBC_2.2   clock_gettime

I think it should be applied until sarge is released.  I'll push it to
-20.  I plan to keep these librt-mips patches until sarge+1.  Guido,
Thiemo, if you have comment for it, please let me know.

Regards,
-- gotom


#! /bin/sh -e

# All lines beginning with `# DP:' are a description of the patch.
# DP: Description: clock_{get,set}time@@GLIBC_2.0 - programs in Woody need it.
# DP:		   Add fix that the previous version does not provide @GLIBC_2.2 symbols.
# DP: Related bugs: 
# DP: Dpatch author: GOTO Masanori <gotom@debian.org>
# DP: Patch author: Guido Guenther <agx@debian.org>, GOTO Masanori <gotom@debian.org>
# DP: Upstream status: Debian-Specific
# DP: Status Details: debian-specific, until sarge+1 will be released.
# DP: Date: 2004-12-24 (updated)

PATCHLEVEL=0

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 -p$PATCHLEVEL < $0;;
    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p$PATCHLEVEL < $0;;
    *)
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
	exit 1
esac
exit 0

# append the patch here and adjust the -p? flag in the patch calls.
--- sysdeps/unix/sysv/linux/mips/Versions.orig	Tue Sep 24 15:56:55 2002
+++ sysdeps/unix/sysv/linux/mips/Versions	Tue Sep 24 15:49:27 2002
@@ -34,3 +34,9 @@
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
 }
+librt {
+  GLIBC_2.0 {
+    # c*
+    clock_gettime; clock_settime;
+  }
+}
--- Versions.def	2004-12-21 00:37:04.000000000 +0900
+++ Versions.def.new	2004-12-21 09:50:31.000000000 +0900
@@ -82,6 +82,7 @@
   GLIBC_PRIVATE
 }
 librt {
+  GLIBC_2.0
   GLIBC_2.1
   GLIBC_2.2
   GLIBC_2.3
--- sysdeps/unix/clock_gettime.c~	2004-12-04 17:05:53.000000000 +0900
+++ sysdeps/unix/clock_gettime.c	2004-12-23 12:04:01.000000000 +0900
@@ -39,8 +39,13 @@
 
 
 /* Get current value of CLOCK and store it in TP.  */
+#ifdef DEBIAN_LIBRT_MIPS
+int
+__clock_gettime (clockid_t clock_id, struct timespec *tp)
+#else
 int
 clock_gettime (clockid_t clock_id, struct timespec *tp)
+#endif
 {
   int retval = -1;
 
--- sysdeps/unix/clock_settime.c~	2004-12-04 17:05:53.000000000 +0900
+++ sysdeps/unix/clock_settime.c	2004-12-23 12:09:27.000000000 +0900
@@ -37,8 +37,13 @@
 
 
 /* Set CLOCK to value TP.  */
+#ifdef DEBIAN_LIBRT_MIPS
+int
+__clock_settime (clockid_t clock_id, const struct timespec *tp)
+#else
 int
 clock_settime (clockid_t clock_id, const struct timespec *tp)
+#endif
 {
   int retval;
 
--- /dev/null	2004-09-27 19:55:25.000000000 +0900
+++ sysdeps/unix/sysv/linux/mips/clock_settime.c	2004-12-23 12:07:36.000000000 +0900
@@ -0,0 +1,18 @@
+/*
+ * It adds for debian specific librt-mips binary incompatibility problems.
+ * - gotom 2004-12-20.
+ */
+
+#define DEBIAN_LIBRT_MIPS
+
+/* include linux clock_settime */
+#include <sysdeps/unix/sysv/linux/clock_settime.c>
+
+/* compat symbols. */
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT (librt, GLIBC_2_0, GLIBC_2_2)
+strong_alias (__clock_settime, __clock_settime_old);
+compat_symbol (librt, __clock_settime_old, clock_settime, GLIBC_2_0);
+#endif
+versioned_symbol (librt, __clock_settime, clock_settime, GLIBC_2_2);
--- /dev/null	2004-09-27 19:55:25.000000000 +0900
+++ sysdeps/unix/sysv/linux/mips/clock_gettime.c	2004-12-23 12:07:35.000000000 +0900
@@ -0,0 +1,18 @@
+/*
+ * It adds for debian specific librt-mips binary incompatibility problems.
+ * - gotom 2004-12-20.
+ */
+
+#define DEBIAN_LIBRT_MIPS
+
+/* include linux clock_gettime */
+#include <sysdeps/unix/sysv/linux/clock_gettime.c>
+
+/* compat symbols. */
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT (librt, GLIBC_2_0, GLIBC_2_2)
+strong_alias (__clock_gettime, __clock_gettime_old);
+compat_symbol (librt, __clock_gettime_old, clock_gettime, GLIBC_2_0);
+#endif
+versioned_symbol (librt, __clock_gettime, clock_gettime, GLIBC_2_2);



Reply to: