Robert P. J. DAY says:
Based on feedback from Mike Frysinger, add the following patchset for
glibc-2.7. Not stress-tested, but at least make it available for
interested testers.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/glibc/2.7/120-glibc-2.7-cygwin.patch Sun Feb 17 22:19:26 2008 +0000
1.3 @@ -0,0 +1,185 @@
1.4 +Fixes
1.5 +elf/librtld.os: In function `process_envvars': : undefined reference to `__access'
1.6 +...
1.7 +when building glibc-2.3.x on cygwin
1.8 +
1.9 +Idea from
1.10 +http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch
1.11 +Basically, make glibc use .oST as suffix for 'object static'
1.12 +instead of .oS, since cygwin has trouble distinguishing .os from .oS
1.13 +(Original patch had .on, but .oST is more mnemonic for 'object static')
1.14 +
1.15 +glibc-linuxthreads-2.3.5 also requires a patch, see
1.16 +../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch
1.17 +
1.18 +[ forward ported to glibc-2.3.5 by Petr Cvachoucek:
1.19 +
1.20 +Message-ID: <4282FCBA.3040000@unicontrols.cz>
1.21 +Date: Thu, 12 May 2005 08:50:34 +0200
1.22 +From: Petr Cvachoucek <cvachoucek@unicontrols.cz>
1.23 +To: Dan Kegel <dank@kegel.com>
1.24 +CC: crossgcc@sources.redhat.com
1.25 +Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin
1.26 +
1.27 +Hi Dan,
1.28 +following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain
1.29 +on cygwin. Tested to build toolchains for powerpc 604 and 750 targets.
1.30 +
1.31 +--
1.32 + Petr Cvachoucek
1.33 + Unicontrols a.s.
1.34 + http://www.unicontrols.cz
1.35 +]
1.36 +
1.37 +diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig
1.38 +--- glibc-2.3.5/Makeconfig 2005-02-16 11:50:19.000000000 +0100
1.39 ++++ glibc-2.3.5-cygwin/Makeconfig 2005-05-11 08:24:51.046875000 +0200
1.40 +@@ -470,7 +470,7 @@
1.41 + # run the linked programs.
1.42 + link-libc = -Wl,-rpath-link=$(rpath-link) \
1.43 + $(common-objpfx)libc.so$(libc.so-version) \
1.44 +- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib)
1.45 ++ $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib)
1.46 + # This is how to find at build-time things that will be installed there.
1.47 + rpath-dirs = math elf dlfcn nss nis rt resolv crypt
1.48 + endif
1.49 +@@ -691,7 +691,7 @@
1.50 + # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
1.51 + # to pass different flags for each flavor.
1.52 + libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
1.53 +-all-object-suffixes := .o .os .op .og .ob .oS
1.54 ++all-object-suffixes := .o .os .op .og .ob .oST
1.55 + object-suffixes :=
1.56 + CPPFLAGS-.o = $(pic-default)
1.57 + CFLAGS-.o = $(filter %frame-pointer,$(+cflags))
1.58 +@@ -747,14 +747,14 @@
1.59 +
1.60 + ifeq (yes,$(build-shared))
1.61 + # Build special library that contains the static-only routines for libc.
1.62 +-object-suffixes-for-libc += .oS
1.63 ++object-suffixes-for-libc += .oST
1.64 +
1.65 + # Must build the routines as PIC, though, because they can end up in (users')
1.66 + # shared objects. We don't want to use CFLAGS-os because users may, for
1.67 + # example, make that processor-specific.
1.68 +-CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag)
1.69 +-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
1.70 +-libtype.oS = lib%_nonshared.a
1.71 ++CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag)
1.72 ++CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
1.73 ++libtype.oST = lib%_nonshared.a
1.74 + endif
1.75 +
1.76 + # The assembler can generate debug information too.
1.77 +diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules
1.78 +--- glibc-2.3.5/Makerules 2004-12-15 19:52:39.000000000 +0100
1.79 ++++ glibc-2.3.5-cygwin/Makerules 2005-05-11 08:25:33.578125000 +0200
1.80 +@@ -417,7 +417,7 @@
1.81 + # Bounded pointer thunks are only built for *.ob
1.82 + elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks))
1.83 +
1.84 +-elide-routines.oS += $(filter-out $(static-only-routines),\
1.85 ++elide-routines.oST += $(filter-out $(static-only-routines),\
1.86 + $(routines) $(aux) $(sysdep_routines)) \
1.87 + $(elide-bp-thunks)
1.88 + elide-routines.os += $(static-only-routines) $(elide-bp-thunks)
1.89 +@@ -984,7 +984,7 @@
1.90 + install: $(inst_libdir)/libc.so
1.91 + $(inst_libdir)/libc.so: $(common-objpfx)format.lds \
1.92 + $(common-objpfx)libc.so$(libc.so-version) \
1.93 +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\
1.94 ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\
1.95 + $(libprefix)$(libc-name)) \
1.96 + $(+force)
1.97 + (echo '/* GNU ld script';\
1.98 +@@ -992,7 +992,7 @@
1.99 + echo ' the static library, so try that secondarily. */';\
1.100 + cat $<; \
1.101 + echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
1.102 +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
1.103 ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\
1.104 + ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \
1.105 + ) > $@.new
1.106 + mv -f $@.new $@
1.107 +diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk
1.108 +--- glibc-2.3.5/extra-lib.mk 2004-12-02 23:54:47.000000000 +0100
1.109 ++++ glibc-2.3.5-cygwin/extra-lib.mk 2005-05-11 08:27:28.156250000 +0200
1.110 +@@ -13,7 +13,7 @@
1.111 +
1.112 + ifneq (,$($(lib)-static-only-routines))
1.113 + ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version)))
1.114 +-object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS)
1.115 ++object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST)
1.116 + endif
1.117 + endif
1.118 +
1.119 +@@ -29,7 +29,7 @@
1.120 +
1.121 + # Add each flavor of library to the lists of things to build and install.
1.122 + install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
1.123 +-extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\
1.124 ++extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\
1.125 + $(patsubst %,%$o,$(filter-out \
1.126 + $($(lib)-shared-only-routines),\
1.127 + $(all-$(lib)-routines))))
1.128 +@@ -57,7 +57,7 @@
1.129 +
1.130 +
1.131 + # Use o-iterator.mk to generate a rule for each flavor of library.
1.132 +-ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib))))
1.133 ++ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib))))
1.134 + define o-iterator-doit
1.135 + $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \
1.136 + $(patsubst %,$(objpfx)%$o,\
1.137 +@@ -65,7 +65,7 @@
1.138 + $(all-$(lib)-routines))); \
1.139 + $$(build-extra-lib)
1.140 + endef
1.141 +-object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib)))
1.142 ++object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib)))
1.143 + include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left))
1.144 + endif
1.145 +
1.146 +@@ -77,9 +77,9 @@
1.147 + $(build-extra-lib)
1.148 + endif
1.149 +
1.150 +-ifneq (,$(filter .oS,$(object-suffixes-$(lib))))
1.151 +-$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \
1.152 +- $(patsubst %,$(objpfx)%.oS,\
1.153 ++ifneq (,$(filter .oST,$(object-suffixes-$(lib))))
1.154 ++$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \
1.155 ++ $(patsubst %,$(objpfx)%.oST,\
1.156 + $(filter $($(lib)-static-only-routines),\
1.157 + $(all-$(lib)-routines)))
1.158 + $(build-extra-lib)
1.159 +diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile
1.160 +--- glibc-2.3.5/nptl/Makefile 2005-02-16 09:45:56.000000000 +0100
1.161 ++++ glibc-2.3.5-cygwin/nptl/Makefile 2005-05-11 08:26:01.812500000 +0200
1.162 +@@ -375,7 +375,7 @@
1.163 +
1.164 + $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \
1.165 + $(objpfx)libpthread.so$(libpthread.so-version) \
1.166 +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\
1.167 ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\
1.168 + $(libprefix)pthread) \
1.169 + $(+force)
1.170 + (echo '/* GNU ld script';\
1.171 +@@ -383,7 +383,7 @@
1.172 + echo ' the static library, so try that secondarily. */';\
1.173 + cat $<; \
1.174 + echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \
1.175 +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\
1.176 ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\
1.177 + ')' \
1.178 + ) > $@.new
1.179 + mv -f $@.new $@
1.180 +diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile
1.181 +--- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile 2004-08-16 08:46:14.000000000 +0200
1.182 ++++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile 2005-05-11 08:26:25.937500000 +0200
1.183 +@@ -10,4 +10,4 @@
1.184 + ASFLAGS-.op += -Wa,-Av9a
1.185 + ASFLAGS-.og += -Wa,-Av9a
1.186 + ASFLAGS-.ob += -Wa,-Av9a
1.187 +-ASFLAGS-.oS += -Wa,-Av9a
1.188 ++ASFLAGS-.oST += -Wa,-Av9a
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/patches/glibc/2.7/140-glibc-2.7-configure-apple-as.patch Sun Feb 17 22:19:26 2008 +0000
2.3 @@ -0,0 +1,26 @@
2.4 +http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch
2.5 +http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html
2.6 +
2.7 +The following makes it possible to configure glibc-2.3.2 on Mac OS X,
2.8 +where the assembler but doesn't understand the --version flag.
2.9 +
2.10 +Fixes the symptom
2.11 +checking whether ld is GNU ld... no
2.12 +checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as
2.13 +checking version of /usr/libexec/gcc/darwin/ppc/as...
2.14 +<PAUSES HERE AND JUST SITS THERE DOING NOTHING>
2.15 +
2.16 +NOTE: This patch should apparently be pushed upstream so we don't need to
2.17 +keep adding it here.
2.18 +
2.19 +--- glibc-2.3.2/configure~ Wed Feb 26 09:20:48 2003
2.20 ++++ glibc-2.3.2/configure Fri Feb 27 13:12:53 2004
2.21 +@@ -4524,7 +4524,7 @@
2.22 + # Found it, now check the version.
2.23 + { echo "$as_me:$LINENO: checking version of $AS" >&5
2.24 + echo $ECHO_N "checking version of $AS... $ECHO_C" >&6; }
2.25 +- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
2.26 ++ ac_prog_version=`$AS -v </dev/null 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
2.27 + case $ac_prog_version in
2.28 + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2.29 + 2.1[3-9]*)
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/patches/glibc/2.7/150-glibc-2.7-fix-pr631.patch Sun Feb 17 22:19:26 2008 +0000
3.3 @@ -0,0 +1,43 @@
3.4 +From dank@kegel.com
3.5 +Wed Jun 15 09:12:43 PDT 2005
3.6 +
3.7 +Fixes
3.8 +
3.9 +build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r'
3.10 +build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent'
3.11 +... 53 lines deleted ...
3.12 +build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r'
3.13 +collect2: ld returned 1 exit status
3.14 +make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1
3.15 +
3.16 +when building glibc with --enable-static-nss.
3.17 +
3.18 +See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631
3.19 +
3.20 +--- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005
3.21 ++++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005
3.22 +@@ -508,7 +508,7 @@
3.23 +
3.24 + # The static libraries.
3.25 + ifeq (yes,$(build-static))
3.26 +-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
3.27 ++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a
3.28 + else
3.29 + ifeq (yes,$(build-shared))
3.30 + # We can try to link the programs with lib*_pic.a...
3.31 +--- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005
3.32 ++++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005
3.33 +@@ -120,6 +120,13 @@
3.34 + install-bin-script = ldd
3.35 + endif
3.36 +
3.37 ++ifeq (yes,$(build-static-nss))
3.38 ++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
3.39 ++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
3.40 ++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
3.41 ++ $(resolvobjdir)/libresolv.a
3.42 ++endif
3.43 ++
3.44 + others = sprof sln
3.45 + install-bin = sprof
3.46 + others-static = sln
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/patches/glibc/2.7/160-glibc-2.7-i686-assembler.patch Sun Feb 17 22:19:26 2008 +0000
4.3 @@ -0,0 +1,43 @@
4.4 +If gcc is configured to generate i686 code or better by default (like
4.5 +when using the --with-arch=pentium3 configure option), then the __i686
4.6 +macro will always be defined automatically and thus screw up the
4.7 +compilation of some .S files.
4.8 +
4.9 +http://bugs.gentoo.org/131108
4.10 +http://sourceware.org/ml/libc-alpha/2006-04/msg00090.html
4.11 +
4.12 +2006-04-25 Mike Frysinger <vapier@gentoo.org>
4.13 +
4.14 + * sysdeps/i386/sysdep.h (__i686): Undefine.
4.15 +
4.16 +Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h
4.17 +===================================================================
4.18 +--- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469)
4.19 ++++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy)
4.20 +@@ -29,6 +29,10 @@
4.21 + #include <dl-sysdep.h>
4.22 + #include <tls.h>
4.23 +
4.24 ++#if defined __i686 && defined __ASSEMBLER__
4.25 ++#undef __i686
4.26 ++#define __i686 __i686
4.27 ++#endif
4.28 +
4.29 + /* For Linux we can use the system call table in the header file
4.30 + /usr/include/asm/unistd.h
4.31 +Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c
4.32 +===================================================================
4.33 +--- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469)
4.34 ++++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy)
4.35 +@@ -45,6 +45,11 @@
4.36 + /* Embed an #include to pull in the alignment and .end directives. */
4.37 + asm ("\n#include \"defs.h\"");
4.38 +
4.39 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
4.40 ++asm ("\n#undef __i686");
4.41 ++asm ("\n#define __i686 __i686");
4.42 ++asm ("\n#endif");
4.43 ++
4.44 + /* The initial common code ends here. */
4.45 + asm ("\n/*@HEADER_ENDS*/");
4.46 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/patches/glibc/2.7/170-glibc-i386-preferred-stack-boundary.patch Sun Feb 17 22:19:26 2008 +0000
5.3 @@ -0,0 +1,18 @@
5.4 +(C) 2007 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
5.5 +License: LGPL v2.1
5.6 +
5.7 +Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12,
5.8 +and 2 is not.
5.9 +
5.10 +diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile
5.11 +--- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100
5.12 ++++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200
5.13 +@@ -36,7 +36,7 @@
5.14 + ifeq ($(subdir),csu)
5.15 + sysdep-CFLAGS += -mpreferred-stack-boundary=4
5.16 + else
5.17 +-sysdep-CFLAGS += -mpreferred-stack-boundary=2
5.18 ++sysdep-CFLAGS += -mpreferred-stack-boundary=4
5.19 + # Likewise, any function which calls user callbacks
5.20 + uses-callbacks += -mpreferred-stack-boundary=4
5.21 + # Likewise, any stack alignment tests
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/patches/glibc/2.7/make-install-lib-all.patch.dont_apply Sun Feb 17 22:19:26 2008 +0000
6.3 @@ -0,0 +1,24 @@
6.4 +From http://svn.exactcode.de/t2/trunk/package/base/glibc32/make-install-lib-all.patch
6.5 +Rule to install all needed libraries, not just the ones installed by install-lib,
6.6 +yet not install programs.
6.7 +Needed because we can't use the main install target, as we can't build programs before
6.8 +we have the final gcc installed; linking fails because libeh.a is not present,
6.9 +and glibc insists on linking programs with that library.
6.10 +
6.11 +diff -Naur glibc-2.3.4.orig/Makerules glibc-2.3.4/Makerules
6.12 +--- glibc-2.3.4.orig/Makerules 2004-12-15 20:52:39.000000000 +0200
6.13 ++++ glibc-2.3.4/Makerules 2005-02-19 15:16:31.415125176 +0200
6.14 +@@ -867,6 +867,13 @@
6.15 + installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
6.16 + $(inst_libdir)/$(patsubst %,$(libtype$o),\
6.17 + $(libprefix)$(libc-name)))
6.18 ++
6.19 ++install-lib-all: $(inst_slibdir)/libc.so$(libc.so-version) \
6.20 ++ $(inst_slibdir)/libc-$(version).so \
6.21 ++ $(inst_libdir)/libc.so \
6.22 ++ $(inst_libdir)/libc.a \
6.23 ++ install-lib
6.24 ++
6.25 + install: $(installed-libcs)
6.26 + $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
6.27 + $(make-target-directory)