diff --git a/pkgs/development/libraries/glibc/builder.sh b/pkgs/development/libraries/glibc/builder.sh index 3c253c2d264..f06d25320b6 100644 --- a/pkgs/development/libraries/glibc/builder.sh +++ b/pkgs/development/libraries/glibc/builder.sh @@ -7,6 +7,7 @@ export NIX_NO_SELF_RPATH=1 postUnpack() { cd $sourceRoot unpackFile $linuxthreadsSrc + rm -rf nptl cd .. } @@ -17,15 +18,23 @@ preConfigure() { mkdir ../build cd ../build configureScript=../$sourceRoot/configure + # `--with-tls --without-__thread' is required when for + # linuxthreads. See + # http://sources.redhat.com/bugzilla/show_bug.cgi?id=317. Be sure + # to read Drepper's comment for another classic example of glibc's + # release management strategy. configureFlags="--enable-add-ons --disable-profile \ - --with-headers=$kernelHeaders/include" + --with-headers=$kernelHeaders/include \ + --with-tls --without-__thread" } preConfigure=preConfigure postInstall() { - make localedata/install-locales + if test -n "$installLocales"; then + make localedata/install-locales + fi rm $out/etc/ld.so.cache (cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1 # `glibcbug' causes a retained dependency on the C compiler. diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix index 90be37aefe6..0b096bfd66e 100644 --- a/pkgs/development/libraries/glibc/default.nix +++ b/pkgs/development/libraries/glibc/default.nix @@ -1,24 +1,38 @@ -{stdenv, fetchurl, kernelHeaders, patch}: - -assert patch != null; +{stdenv, fetchurl, kernelHeaders, installLocales ? true}: stdenv.mkDerivation { - name = "glibc-2.3.2"; + name = "glibc-2.3.3"; builder = ./builder.sh; src = fetchurl { - url = ftp://ftp.nl.net/pub/gnu/glibc/glibc-2.3.2.tar.bz2; - md5 = "ede969aad568f48083e413384f20753c"; + url = http://ftp.gnu.org/pub/gnu/glibc/glibc-2.3.3.tar.bz2; + md5 = "e825807b98042f807799ccc9dd96d31b"; }; linuxthreadsSrc = fetchurl { - url = ftp://ftp.nl.net/pub/gnu/glibc/glibc-linuxthreads-2.3.2.tar.bz2; - md5 = "894b8969cfbdf787c73e139782167607"; + url = http://ftp.gnu.org/pub/gnu/glibc/glibc-linuxthreads-2.3.3.tar.bz2; + md5 = "8149ea62922e75bd692bc3b92e5e766b"; }; - # This is a patch to make glibc compile under GCC 3.3. Presumably - # later releases of glibc won't need this. - patches = [./glibc-2.3.2-sscanf-1.patch]; + patches = [ + # This patch fixes the bug + # http://sources.redhat.com/bugzilla/show_bug.cgi?id=312. Note + # that this bug was marked as `WORKSFORME' with the comment to + # just use glibc from CVS. This and the unholy Linuxthreads/NPTL + # mess proves that glibc, together with the Linux kernel, + # constitutes an AXIS OF EVIL wrt release management. Patch + # obtained from + # http://www.pengutronix.de/software/ptxdist/patches-cvs/glibc-2.3.2/generic/fixup.patch. + ./fixup.patch - buildInputs = [patch]; - inherit kernelHeaders; + # Likewise, this fixes the bug reported in + # http://sources.redhat.com/ml/libc-alpha/2003-07/msg00117.html. + # Die, glibc, die. + ./no-unit-at-a-time.patch + + # This is a patch to make glibc compile under GCC 3.3. Presumably + # later releases of glibc won't need this. +# ./glibc-2.3.2-sscanf-1.patch + ]; + + inherit kernelHeaders installLocales; } diff --git a/pkgs/development/libraries/glibc/fixup.patch b/pkgs/development/libraries/glibc/fixup.patch new file mode 100644 index 00000000000..5f1e8a4e63e --- /dev/null +++ b/pkgs/development/libraries/glibc/fixup.patch @@ -0,0 +1,74 @@ +Fixes +dl-runtime.c:56: error: conflicting types for 'fixup' +../sysdeps/i386/dl-machine.h:158: error: previous declaration of 'fixup' was here +when building with gcc-3.4.0 + +First hunk: +Define ARCH_FIXUP_ATTRIBUTE and use it in the fixup function declarations. +http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/i386/dl-machine.h.diff?r1=1.124&r2=1.125&cvsroot=glibc + +Second hunk: +If ARCH_FIXUP_ATTRIBUTE is not defined, provide dummy definition. +Use macro in fixup function definitions. +http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/elf/dl-runtime.c.diff?r1=1.64&r2=1.65&cvsroot=glibc +[rediffed against glibc-2.3.2] + +=================================================================== +RCS file: /cvs/glibc/libc/sysdeps/i386/dl-machine.h,v +retrieving revision 1.124 +retrieving revision 1.125 +diff -u -r1.124 -r1.125 +--- libc/sysdeps/i386/dl-machine.h 2004/03/05 10:14:49 1.124 ++++ libc/sysdeps/i386/dl-machine.h 2004/03/09 07:42:29 1.125 +@@ -154,11 +154,14 @@ + destroys the passed register information. */ + /* GKM FIXME: Fix trampoline to pass bounds so we can do + without the `__unbounded' qualifier. */ +-static ElfW(Addr) fixup (struct link_map *__unbounded l, ElfW(Word) reloc_offset) +- __attribute__ ((regparm (2), unused)); ++#define ARCH_FIXUP_ATTRIBUTE __attribute__ ((regparm (3), unused)) ++ ++static ElfW(Addr) fixup (struct link_map *__unbounded l, ++ ElfW(Word) reloc_offset) ++ ARCH_FIXUP_ATTRIBUTE; + static ElfW(Addr) profile_fixup (struct link_map *l, ElfW(Word) reloc_offset, + ElfW(Addr) retaddr) +- __attribute__ ((regparm (3), unused)); ++ ARCH_FIXUP_ATTRIBUTE; + # endif + + /* This code is used in dl-runtime.c to call the `fixup' function +=================================================================== +--- /home/dank/downloads/glibc-2.3.2/elf/dl-runtime.c Fri Feb 7 11:41:12 2003 ++++ glibc-2.3.2/elf/dl-runtime.c Thu Apr 8 22:24:26 2004 +@@ -36,6 +36,12 @@ + # define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym)) + #endif + ++/* The fixup functions might have need special attributes. If none ++ are provided define the macro as empty. */ ++#ifndef ARCH_FIXUP_ATTRIBUTE ++# define ARCH_FIXUP_ATTRIBUTE ++#endif ++ + + /* This function is called through a special trampoline from the PLT the + first time each PLT entry is called. We must perform the relocation +@@ -45,7 +51,7 @@ + function. */ + + #ifndef ELF_MACHINE_NO_PLT +-static ElfW(Addr) __attribute_used__ ++static ElfW(Addr) __attribute_used__ ARCH_FIXUP_ATTRIBUTE + fixup ( + # ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS + ELF_MACHINE_RUNTIME_FIXUP_ARGS, +@@ -132,7 +138,7 @@ + + #if !defined PROF && !defined ELF_MACHINE_NO_PLT && !__BOUNDED_POINTERS__ + +-static ElfW(Addr) __attribute_used__ ++static ElfW(Addr) __attribute_used__ ARCH_FIXUP_ATTRIBUTE + profile_fixup ( + #ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS + ELF_MACHINE_RUNTIME_FIXUP_ARGS, diff --git a/pkgs/development/libraries/glibc/no-unit-at-a-time.patch b/pkgs/development/libraries/glibc/no-unit-at-a-time.patch new file mode 100644 index 00000000000..36b7639941b --- /dev/null +++ b/pkgs/development/libraries/glibc/no-unit-at-a-time.patch @@ -0,0 +1,69 @@ +diff -rc glibc-orig/csu/Makefile glibc-2.3.3/csu/Makefile +*** glibc-orig/csu/Makefile 2003-09-25 22:29:39.000000000 +0200 +--- glibc-2.3.3/csu/Makefile 2004-09-17 11:06:56.000000000 +0200 +*************** +*** 104,110 **** + $(crtstuff:%=$(objpfx)%.o): %.o: %.S $(objpfx)defs.h + $(compile.S) -g0 $(ASFLAGS-.os) -o $@ + +! CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions + + vpath initfini.c $(full_config_sysdirs) + +--- 104,110 ---- + $(crtstuff:%=$(objpfx)%.o): %.o: %.S $(objpfx)defs.h + $(compile.S) -g0 $(ASFLAGS-.os) -o $@ + +! CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions -fno-unit-at-a-time + + vpath initfini.c $(full_config_sysdirs) + +diff -rc glibc-orig/linuxthreads/Makefile glibc-2.3.3/linuxthreads/Makefile +*** glibc-orig/linuxthreads/Makefile 2003-10-02 20:48:48.000000000 +0200 +--- glibc-2.3.3/linuxthreads/Makefile 2004-09-17 13:06:20.000000000 +0200 +*************** +*** 68,74 **** + vpath %.c Examples + + tst-cancel-ARGS = "$(objpfx)" +! CFLAGS-tst-cancel.c = -fno-inline -fno-inline-functions + + include ../Makeconfig + +--- 68,74 ---- + vpath %.c Examples + + tst-cancel-ARGS = "$(objpfx)" +! CFLAGS-tst-cancel.c = -fno-inline -fno-inline-functions -fno-unit-at-a-time + + include ../Makeconfig + +*************** +*** 101,107 **** + extra-objs += $(crti-objs) $(crtn-objs) + omit-deps += crti crtn + +! CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions + endif + + librt-tests = ex10 ex11 +--- 101,107 ---- + extra-objs += $(crti-objs) $(crtn-objs) + omit-deps += crti crtn + +! CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions -fno-unit-at-a-time + endif + + librt-tests = ex10 ex11 +diff -rc glibc-orig/linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile glibc-2.3.3/linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile +*** glibc-orig/linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile 2003-04-12 01:34:02.000000000 +0200 +--- glibc-2.3.3/linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile 2004-09-17 13:05:43.000000000 +0200 +*************** +*** 1,3 **** + ifeq ($(subdir),linuxthreads) +! CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions -fno-asynchronous-unwind-tables + endif +--- 1,3 ---- + ifeq ($(subdir),linuxthreads) +! CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions -fno-asynchronous-unwind-tables -fno-unit-at-a-time + endif