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

Bug#190399: glibc: should support x86-64



Package: glibc
Version: 2.3.1-17
Tags: patch
Severity: wishlist

In order to start the new amd64 (aka x86-64) port of Debian,
a biarch i386/x86-64 glibc package will be needed. The required
changes are rather small, as most of this has already been
done for the sparc64 architecture and copied for s390x.
As a separate issue, these three 64 bit libc6 packaged should 
probably be merged in order to prevent duplicate bugs.

This bug has a circular dependency on Bug#190066 (gcc-3.3) and
another dependency on Bug#189350 (binutils). I have already
provided patches for both and uploaded binary packages to 
http://www.arndb.de/debian/ .

The attached patch contains further notes on the specific changes.
# The kernel headers for /usr/include/asm/ are normally (i.e. on s390x and
# sparc64) generated from a script distributed as
# /usr/src/kernel/generate-asm.sh.
# That approach is somewhat flawed because it doesn't work with
# the various kernel-headers packages that are distributed for
# some purpose.
# Here, I'm doing the same thing that generate-asm.sh does but
# in a simpler and more portable way. It can be easily extended
# for the other architectures and will also solve Bug#169358.
#
# The only backdraw is that in order to build lib64c itself,
# a temporary symlink $(objdir_64)/asm ->
#  $(LINUX_SOURCE)/include/asm-x86_64 has to be created (see
# below).
diff -u glibc-2.3.1/debian/packages.d/libc-dev.mk glibc-2.3.1/debian/packages.d/libc-dev.mk
--- glibc-2.3.1/debian/packages.d/libc-dev.mk
+++ glibc-2.3.1/debian/packages.d/libc-dev.mk
@@ -44,12 +44,11 @@
 	  rm -f $$link; ln -sf $$linksrc $$link; done
 endif
 	$(make_directory) $(tmpdir)/$@$(includedir)
-	cp -a $(install_root)$(includedir) $(tmpdir)/$@/usr/
 ifeq ($(DEB_HOST_GNU_SYSTEM),linux)
 	$(make_directory) $(addprefix $(LINUX_SOURCE)/include/,asm linux)
 	cp -R $(LINUX_SOURCE)/include/linux/. $(tmpdir)/$@$(includedir)/linux/
-	cp -R $(LINUX_SOURCE)/include/asm/. $(tmpdir)/$@$(includedir)/asm/
 ifeq ($(DEB_HOST_GNU_CPU),sparc)
+	cp -a $(install_root)$(includedir) $(tmpdir)/$@/usr/
 # Sparc has a 32/64 build setup, make sure we support it
 	cp -R $(LINUX_SOURCE)/include/asm-sparc \
 		$(tmpdir)/$@$(includedir)/.
@@ -60,7 +59,28 @@
 	$(tmpdir)/$@$(bindir)/generate-asm $(tmpdir)/$@$(includedir)/
 	rm -rf $(tmpdir)/$@$(includedir)/asm-sparc64
 else
+ifeq ($(DEB_HOST_GNU_CPU),i386)
+	# only the x86_64 are biarch capable, so we can't use the
+	# ones in install_root here
+	cp -a $(install_root_64)$(includedir) $(tmpdir)/$@/usr/
+	# x86_64 has a 32/64 build setup, make sure we support it
+	cp -R $(LINUX_SOURCE)/include/asm-{i386,x86_64} \
+	$(tmpdir)/$@$(includedir)/.
+	pushd $(tmpdir)/$@$(includedir) ; \
+	mkdir asm ; \
+	for i in `( ls asm-i386 ; ls asm-x86_64 ) | sort | uniq` ; do \
+		printf > asm/$$i "%s\n%s\n%s\n%s\n%s\n"	\
+			"#ifdef __x86_64__"		\
+			"#include <asm-x86_64/$$i>"	\
+			"#else"				\
+			"#include <asm-i386/$$i>"	\
+			"#endif" ;			\
+	done ; \
+	popd
+	rm -rf $(tmpdir)/$@$(includedir)/asm-x86_64
+else
 ifeq ($(DEB_HOST_GNU_CPU),s390)
+	cp -a $(install_root)$(includedir) $(tmpdir)/$@/usr/
 	# IBM zSeries has a 32/64 build setup, make sure we support it
 	cp -R $(LINUX_SOURCE)/include/asm-{s390,s390x} \
 	$(tmpdir)/$@$(includedir)/.
@@ -69,11 +89,15 @@
 	$(tmpdir)/$@$(bindir)/generate-asm $(tmpdir)/$@$(includedir)/
 	rm -rf $(tmpdir)/$@$(includedir)/asm-s390x
 else
+	cp -a $(install_root)$(includedir) $(tmpdir)/$@/usr/
 	cp -R $(LINUX_SOURCE)/include/asm/. $(tmpdir)/$@$(includedir)/asm/
 endif
 endif
+endif
 	rm -rf $(tmpdir)/$@$(includedir)/linux/modules
 	rm -f $(tmpdir)/$@$(includedir)/linux/modversions.h
+else
+	cp -a $(install_root)$(includedir) $(tmpdir)/$@/usr/
 endif
 # Remove cruft from CVS trees
 	find $(tmpdir)/$@$(includedir)/ -name CVS -type d | xargs -r rm -rf
# The changes to debian/control, debian/rules, debian/packages.d/x86_64.mk,
# debian/lib64c/postinst, debian/control.in/x86_64 and 
# debian/sysdeps/linux.mk are simple duplications of the respective s390x 
# versions. The name for the 64 bit package, however is not libc6-x64-64
# but lib64c6. I think it would be a good idea to rename the s390 and sparc
# packages to lib64c6 as well, as that will remove some complexity from the
# rules file and from dependend packages
diff -u glibc-2.3.1/debian/control glibc-2.3.1/debian/control
--- glibc-2.3.1/debian/control
+++ glibc-2.3.1/debian/control
@@ -317,6 +317,27 @@
  which use the standard C library. This is the 64bit version of the
  library, meant for zSeries systems.
 
+
+Package: lib64c6
+Architecture: i386
+Section: base
+Priority: required
+Depends: libc6 (= ${Source-Version})
+Description: GNU C Library: 64bit Shared libraries for x86_64
+ This package includes shared versions of the standard C library and the
+ standard math library, as well as many others. This is the 64bit version
+ library, meant for AMD Hammer (x86_64) systems.
+
+Package: lib64c6-dev
+Architecture: i386
+Section: devel
+Priority: standard
+Depends: lib64c6 (= ${Source-Version}), libc6-dev (= ${Source-Version}), gcc-3.2 (>= 3.2.1-0pre1)
+Description: GNU C Library: 64bit Development Libraries for x86_64
+ Contains the symlinks and object files needed to compile and link programs
+ which use the standard C library. This is the 64bit version of the
+ library, meant for AMD Hammer (x86_64) systems.
+
 Package: libc-udeb
 Architecture: any
 Section: debian-installer
diff -u glibc-2.3.1/debian/rules glibc-2.3.1/debian/rules
--- glibc-2.3.1/debian/rules
+++ glibc-2.3.1/debian/rules
@@ -176,6 +176,9 @@
 ifeq ($(DEB_HOST_GNU_CPU),sparc)
 #include $(package_rules)/sparc64.mk
 endif
+ifeq ($(DEB_HOST_GNU_CPU),i386)
+include $(package_rules)/x86_64.mk
+endif
 ifeq ($(DEB_HOST_GNU_CPU),s390)
 include $(package_rules)/s390x.mk
 endif
diff -u glibc-2.3.1/debian/rules.d/control.mk glibc-2.3.1/debian/rules.d/control.mk
--- glibc-2.3.1/debian/rules.d/control.mk
+++ glibc-2.3.1/debian/rules.d/control.mk
@@ -1,5 +1,5 @@
 # Add opt to this line to generate optimized packages
-control_deps := $(addprefix debian/control.in/, libc6 libc6.1 libc0.3 libc1 sparc64 s390x) # 
+control_deps := $(addprefix debian/control.in/, libc6 libc6.1 libc0.3 libc1 sparc64 s390x x86_64) # 
 
 threads_archs := alpha arm i386 m68k mips mipsel powerpc sparc ia64 hppa s390 sh3 sh4 sh3eb sh4eb freebsd-i386
 
@@ -26,6 +26,7 @@
 	cat debian/control.in/libc1		>> $@T
 	cat debian/control.in/sparc64		>> $@T
 	cat debian/control.in/s390x		>> $@T
+	cat debian/control.in/x86_64		>> $@T
 #	Uncomment this line to enable optimized packages
 #	cat debian/control.in/opt		>> $@T
 	cat debian/control.in/libc-udeb         >> $@T
diff -u glibc-2.3.1/debian/sysdeps/linux.mk glibc-2.3.1/debian/sysdeps/linux.mk
--- glibc-2.3.1/debian/sysdeps/linux.mk
+++ glibc-2.3.1/debian/sysdeps/linux.mk
@@ -17,6 +17,10 @@
 #  arch_packages += $(libc)-sparc64 $(libc)-dev-sparc64
 #endif
 
+ifeq ($(DEB_HOST_GNU_CPU),i386)
+  arch_packages += lib64c6 lib64c6-dev
+endif
+
 ifeq ($(DEB_HOST_GNU_CPU),s390)
   arch_packages += $(libc)-s390x $(libc)-dev-s390x
 endif
only in patch2:
unchanged:
--- glibc-2.3.1.orig/debian/control.in/x86_64
+++ glibc-2.3.1/debian/control.in/x86_64
@@ -0,0 +1,21 @@
+
+Package: lib64c6
+Architecture: i386
+Section: base
+Priority: required
+Depends: libc6 (= ${Source-Version})
+Description: GNU C Library: 64bit Shared libraries for x86_64
+ This package includes shared versions of the standard C library and the
+ standard math library, as well as many others. This is the 64bit version
+ library, meant for AMD Hammer (x86_64) systems.
+
+Package: lib64c6-dev
+Architecture: i386
+Section: devel
+Priority: standard
+Depends: lib64c6 (= ${Source-Version}), libc6-dev (= ${Source-Version}), gcc-3.2 (>= 3.2.1-0pre1)
+Description: GNU C Library: 64bit Development Libraries for x86_64
+ Contains the symlinks and object files needed to compile and link programs
+ which use the standard C library. This is the 64bit version of the
+ library, meant for AMD Hammer (x86_64) systems.
+
only in patch2:
unchanged:
--- glibc-2.3.1.orig/debian/lib64c/postinst
+++ glibc-2.3.1/debian/lib64c/postinst
@@ -0,0 +1,6 @@
+#!/bin/sh -e
+
+if [ "$1" = "configure" ]
+then
+    ldconfig
+fi
only in patch2:
unchanged:
--- glibc-2.3.1.orig/debian/packages.d/x86_64.mk
+++ glibc-2.3.1/debian/packages.d/x86_64.mk
@@ -0,0 +1,162 @@
+# Build 64bit libraries
+
+objdir_64		= $(objdir)_64
+install_root_64		= $(install_root)_64
+stamp_install_64	= $(stamp_install)_64
+stamp_build_64		= $(stamp_build)_64
+stamp_configure_64	= $(stamp_configure)_64
+lib64c			= lib64c6
+
+flags_64 = -g0 -O2 -Wall
+
+MYCC = gcc-3.3 -m64
+
+ifeq ($(log_build),/dev/tty)
+  log_build_64 = /dev/tty
+else
+  log_build_64 = $(log_build)_64
+endif
+
+$(stamp_install_64): $(stamp_build_64)
+	$(checkroot)
+	$(make_directory) $(install_root_64)
+	$(MAKE) -C $(objdir_64) install_root=$(install_root_64) install
+	touch $@
+
+$(stamp_build_64): $(stamp_configure_64)
+ifeq ($(NO_LOG),)
+	@if [ -s $(log_build_64) ]; then savelog $(log_build_64); fi
+endif
+	@echo 'Building GNU C Library for a $(DEB_BUILD_GNU_TYPE) host (64bit).'
+	$(MAKE) -C $(objdir_64) PARALLELMFLAGS="$(PARALLELMFLAGS)" 2>&1 | tee $(log_build_64)
+	touch $@
+
+$(stamp_configure_64): $(stamp_unpack) $(stamp_patch)
+	$(make_directory) $(objdir_64) $(stampdir)
+	rm -f $(objdir_64)/configparms
+	echo "CC = $(MYCC)"		>> $(objdir_64)/configparms
+	echo "BUILD_CC = $(MYCC)"	>> $(objdir_64)/configparms
+	echo "CFLAGS = $(flags_64)"	>> $(objdir_64)/configparms
+	echo "BUILD_CFLAGS = $(flags_64)"	>> $(objdir_64)/configparms
+	echo "BASH := /bin/bash"	>> $(objdir_64)/configparms
+	echo "KSH := /bin/bash"		>> $(objdir_64)/configparms
+	echo "mandir = $(mandir)"	>> $(objdir_64)/configparms
+	echo "infodir = $(infodir)"	>> $(objdir_64)/configparms
+	echo "libexecdir = $(libexecdir)"	>> $(objdir_64)/configparms
+	echo "LIBGD = no"		>> $(objdir_64)/configparms
+	echo "cross-compiling = yes"	>> $(objdir_64)/configparms
+	echo 
+	ln -s $(LINUX_SOURCE)/include/asm-x86_64 $(objdir_64)/asm # Hack
+	cd $(objdir_64) && CC="$(MYCC)" CFLAGS="$(flags_64)" \
+	$(srcdir)/configure --host=x86_64-linux \
+		--build=i386-linux --prefix=/usr --without-cvs \
+		--disable-profile --enable-static --enable-kernel=2.4.0 \
+		--enable-add-ons="$(add-ons)" $(with_headers)
+
+	touch $@
+
+$(lib64c): $(stamp_install_64) debian/control $(mkdir)/sysdeps.mk \
+  debian/libc/DEBIAN/shlibs
+	$(checkroot)
+	$(debian-clean)
+	-rm -rf $(tmpdir)/$@
+
+	$(make_directory) $(tmpdir)/$@/DEBIAN
+	$(INSTALL_PROGRAM) debian/lib64c/p* $(tmpdir)/$@/DEBIAN
+	cat debian/libc/DEBIAN/shlibs | sed -e 's_$(libc)_$@_' -e \
+		's_/lib/_/lib64/_' > \
+		$(tmpdir)/$@/DEBIAN/shlibs
+
+	$(make_directory) $(tmpdir)/$@/lib64 $(tmpdir)/$@/usr/lib64
+
+	# Compatibility links
+	$(make_directory) $(tmpdir)/$@/lib $(tmpdir)/$@/usr/lib
+	ln -s ../lib64 $(tmpdir)/$@/lib/64
+	ln -s ../lib64 $(tmpdir)/$@/usr/lib/64
+	ln -s ../lib64/ld-$(VERSION).so $(tmpdir)/$@/lib/ld-linux-x86-64.so.2
+
+	$(INSTALL_DATA) $(install_root_64)/lib64/lib*-$(VERSION).so $(tmpdir)/$@/lib64/.
+	$(INSTALL_PROGRAM) $(install_root_64)/lib64/libc-$(VERSION).so $(tmpdir)/$@/lib64/.
+	$(INSTALL_DATA) $(install_root_64)/lib64/libSegFault.so $(tmpdir)/$@/lib64/.
+ifeq ($(threads),yes)
+	$(INSTALL_DATA) $(install_root_64)/lib64/libpthread-0.10.so $(tmpdir)/$@/lib64/.
+	$(INSTALL_DATA) $(install_root_64)/lib64/libthread_db-1.0.so $(tmpdir)/$@/lib64/.
+endif
+	@set -e; \
+	cd $(install_root_64)/lib64/; \
+	for l in `find . -type l -name 'lib*.so.*'`; \
+		do cp -vdf $$l $(tmpdir)/$@/lib64/.; done
+	cd $(tmpdir)/$@ && \
+	$(STRIP) lib64/lib*-$(VERSION).so
+ifeq ($(threads),yes)
+	$(STRIP) $(tmpdir)/$@/lib64/libpthread-0.10.so
+	$(STRIP) $(tmpdir)/$@/lib64/libthread_db-1.0.so
+endif
+	$(INSTALL_PROGRAM) $(install_root_64)/lib64/ld-$(VERSION).so \
+		$(tmpdir)/$@/lib64/.
+	#### XXX
+	# test -e /lib64/ld-linux.so.2 && \
+		# $(INSTALL_PROGRAM) /lib64/ld-*.so $(tmpdir)/$@/lib64/ld-$(VERSION).so
+	cp -vdf $(install_root_64)/lib64/ld*.so.* \
+		$(tmpdir)/$@/lib64/.
+	cp -vfa $(install_root_64)/usr/lib64/gconv \
+		$(tmpdir)/$@/usr/lib64/.
+	$(make_directory) $(tmpdir)/$@$(docdir)
+	ln -sf $(libc) $(tmpdir)/$@$(docdir)/$@
+	find $(tmpdir)/$@ -name CVS -print -prune | xargs --no-run-if-empty rm -rf
+	dpkg-gencontrol -isp -p$@ -P$(tmpdir)/$@
+	chown -R root.root $(tmpdir)/$@
+	chmod -R go=rX $(tmpdir)/$@
+	dpkg --build $(tmpdir)/$@ ..
+
+$(lib64c)-dev: $(stamp_install_64) debian/control $(mkdir)/sysdeps.mk
+	$(checkroot)
+	$(debian-clean)
+	-rm -rf $(tmpdir)/$@
+
+	$(make_directory) $(tmpdir)/$@/DEBIAN
+
+	$(make_directory) $(tmpdir)/$@$(libdir)64
+	$(INSTALL_DATA) $(install_root_64)$(libdir)64/*.o $(tmpdir)/$@$(libdir)64/.
+	$(INSTALL_DATA) $(install_root_64)$(libdir)64/*.a $(tmpdir)/$@$(libdir)64/.
+	rm -f $(tmpdir)/$@$(libdir)64/*_?.a
+ifeq ($(DEB_BUILD_OPTION_STRIP),yes)
+# Don't strip linker scripts.
+	@tostrip=; for file in $(tmpdir)/$@$(libdir)64/*; do \
+	  case `file $$file` in \
+	  *text) ;; *) tostrip="$$tostrip $$file" ;; esac; \
+	done; echo "$(STRIP) -g $$tostrip"; \
+	$(STRIP) -g $$tostrip
+endif
+	for f in $(install_root_64)$(libdir)64/lib*.so; do \
+	  case "$$f" in \
+	  *-$(VERSION).so | *-0.[789].so ) ;; \
+	  */libSegFault.so|*/libthread_db.so|*/libdb.so) ;; \
+	  *) cp -df $$f $(tmpdir)/$@$(libdir)64/. || exit 1 ;; \
+	  esac; \
+	done
+	cd $(tmpdir)/$@$(libdir)64; \
+	for link in `find . -name '*.so' -type l`; do \
+	  linksrc=$$(readlink $$link | sed 's%../..%%'); \
+	  rm -f $$link; ln -sf $$linksrc $$link; done
+
+	# IBM zSeries has a 32/64 build setup, make sure we support it
+	$(make_directory) $(tmpdir)/$@$(includedir)
+	cp -R $(LINUX_SOURCE)/include/asm-x86_64 \
+		$(tmpdir)/$@$(includedir)/.
+	# Remove cruft from CVS trees
+	find $(tmpdir)/$@$(includedir)/ -name CVS -type d | xargs -r rm -rf
+	find $(tmpdir)/$@$(includedir)/ -name '.#*' -type f | xargs rm -f
+
+	$(make_directory) $(tmpdir)/$@$(docdir)/$@
+	$(INSTALL_DATA) debian/changelog $(tmpdir)/$@$(docdir)/$@/changelog.Debian
+	-find $(tmpdir)/$@$(docdir)/$@ -type f | xargs -r gzip -9f
+	$(INSTALL_DATA) debian/copyright $(tmpdir)/$@$(docdir)/$@/.
+
+	# cp -a debian/libc-dev/{postinst,prerm} $(tmpdir)/$@/DEBIAN
+
+	find $(tmpdir)/$@ -name CVS -print -prune | xargs --no-run-if-empty rm -rf
+	dpkg-gencontrol -isp -p$@ -P$(tmpdir)/$@
+	chown -R root.root $(tmpdir)/$@
+	chmod -R go=rX $(tmpdir)/$@
+	dpkg --build $(tmpdir)/$@ ..
diff -u glibc-2.3.1/debian/patches/0list glibc-2.3.1/debian/patches/0list
--- glibc-2.3.1/debian/patches/0list
+++ glibc-2.3.1/debian/patches/0list
@@ -58,0 +59,2 @@
+x86-64-sigcontext.h
+sscanf-gcc3.3
# the sigcontext.h file distributed with x86-64 break some compiles,
# this solves the problem, but the final solution should be to
# fix bits/sigcontext.h in a way that does not need asm/sigcontext.h
only in patch2:
unchanged:
--- glibc-2.3.1.orig/debian/patches/x86-64-sigcontext.h.dpatch
+++ glibc-2.3.1/debian/patches/x86-64-sigcontext.h.dpatch
@@ -0,0 +1,103 @@
+#! /bin/sh -e
+
+# All lines beginning with `# DP:' are a description of the patch.
+# DP: Description: fix sigcontext.h header file for x86_64
+# DP: Author: Arnd Bergmann
+# DP: Upstream status: Not submitted
+# DP: Status Details:
+# DP: Date: 2003-01-21
+
+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 -p1 < $0;;
+  -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
+  *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+--- glibc-2.3.1/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h.orig 2003-01-20 13:15:42.000000000 +0100
++++ glibc-2.3.1/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h 2003-01-22 02:29:49.000000000 +0100
+@@ -23,8 +23,16 @@
+ # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+ #endif
+ 
++#define sigcontext_struct sigcontext
++
+ #include <bits/wordsize.h>
+ 
++#if __WORDSIZE == 32
++
++#include <asm/sigcontext.h>
++
++#else /* __WORDSIZE == 64 */
++
+ struct _fpreg
+ {
+   unsigned short significand[4];
+@@ -43,61 +51,6 @@
+   __uint32_t	element[4];
+ };
+ 
+-
+-
+-#if __WORDSIZE == 32
+-
+-struct _fpstate
+-{
+-  /* Regular FPU environment.  */
+-  __uint32_t	cw;
+-  __uint32_t		sw;
+-  __uint32_t		tag;
+-  __uint32_t		ipoff;
+-  __uint32_t		cssel;
+-  __uint32_t		dataoff;
+-  __uint32_t		datasel;
+-  struct _fpreg	_st[8];
+-  unsigned short status;
+-  unsigned short magic;
+-
+-  /* FXSR FPU environment.  */
+-  __uint32_t		_fxsr_env[6];
+-  __uint32_t		mxcsr;
+-  __uint32_t		reserved;
+-  struct _fpxreg	_fxsr_st[8];
+-  struct _xmmreg	_xmm[8];
+-  __uint32_t		padding[56];
+-};
+-
+-struct sigcontext
+-{
+-  unsigned short gs, __gsh;
+-  unsigned short fs, __fsh;
+-  unsigned short es, __esh;
+-  unsigned short ds, __dsh;
+-  unsigned long edi;
+-  unsigned long esi;
+-  unsigned long ebp;
+-  unsigned long esp;
+-  unsigned long ebx;
+-  unsigned long edx;
+-  unsigned long ecx;
+-  unsigned long eax;
+-  unsigned long trapno;
+-  unsigned long err;
+-  unsigned long eip;
+-  unsigned short cs, __csh;
+-  unsigned long eflags;
+-  unsigned long esp_at_signal;
+-  unsigned short ss, __ssh;
+-  struct _fpstate * fpstate;
+-  unsigned long oldmask;
+-  unsigned long cr2;
+-};
+-
+-#else /* __WORDSIZE == 64 */
+-
+ struct _fpstate
+ {
+   /* FPU environment matching the 64-bit FXSAVE layout.  */
only in patch2:
unchanged:
# applicable only until the update to 2.3.2
--- glibc-2.3.1.orig/debian/patches/sscanf-gcc3.3.dpatch
+++ glibc-2.3.1/debian/patches/sscanf-gcc3.3.dpatch
@@ -0,0 +1,34 @@
+#! /bin/sh -e
+
+# All lines beginning with `# DP:' are a description of the patch.
+# DP: Description: fix sscanf.c for compilation with gcc-3.3
+# DP: Author: Arnd Bergmann
+# DP: Upstream status: already in 2.3.2
+# DP: Date: 2003-04-22
+
+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 -p1 < $0;;
+  -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
+  *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+--- glibc-2.3.1/stdio-common/sscanf.c	2002-08-10 20:09:08.000000000 +0200
++++ glibc-2.3.1/stdio-common/sscanf.c	2003-04-23 02:55:03.000000000 +0200
+@@ -27,9 +27,7 @@
+ /* Read formatted input from S, according to the format string FORMAT.  */
+ /* VARARGS2 */
+ int
+-sscanf (s, format)
+-     const char *s;
+-     const char *format;
++sscanf (const char *s, const char *format, ...)
+ {
+   va_list arg;
+   int done;

Reply to: