Skip to content

Instantly share code, notes, and snippets.

@dscharrer
Last active March 25, 2019 02:28
Show Gist options
  • Save dscharrer/4961226 to your computer and use it in GitHub Desktop.
Save dscharrer/4961226 to your computer and use it in GitHub Desktop.
Patches for compiling glibc-2.6.1 with an up to date toolchain.
Patches to compile (crossdev) glibc-2.6.1 with an otherwise up to date (~arch) toolchain (binutils 2.23.1, gcc 4.7.2)
Tested with armv6j-hardfloat-linux-gnueabi and x86_64-bindist-linux-gnu targets.
cross-i686-bindist-linux-gnu/glibc failed with gcc 4.6 and 4.7, but worked with gcc 4.5
--- glibc-2.6.1/configure.old 2013-02-12 05:10:28.614496246 +0100
+++ glibc-2.6.1/configure 2013-02-12 05:12:44.171568520 +0100
@@ -4045,7 +4045,7 @@
ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.1[3-9]*|2.[2-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
@@ -4106,7 +4106,7 @@
ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.1[3-9]*|2.[2-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
Fixes "undefined reference to `_begin'" error.
Taken from http://sourceware.org/ml/crossgcc/2009-05/msg00019.html
--- glibc-2.6.1/elf/Makefile.old 2013-02-12 12:24:15.373415572 +0100
+++ glibc-2.6.1/elf/Makefile 2013-02-12 12:25:34.443498780 +0100
@@ -307,7 +307,7 @@
$(LDFLAGS-rtld) -Wl,-z,defs -Wl,--verbose 2>&1 | \
LC_ALL=C \
sed -e '/^=========/,/^=========/!d;/^=========/d' \
- -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
+ -e 's/\. = .* + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
> [email protected]
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
$(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
Fixes make error:
Makefile:240: *** mixed implicit and normal rules. Stop.
--- glibc-2.6.1/manual/Makefile.old 2013-02-12 05:22:12.744911170 +0100
+++ glibc-2.6.1/manual/Makefile 2013-02-12 05:22:50.389931695 +0100
@@ -237,7 +237,10 @@
.PHONY: stubs
stubs: $(objpfx)stubs
endif
-$(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
+$(objpfx)stubs ../po/manual.pot:
+ $(make-target-directory)
+ touch $@
+$(objpfx)stamp%:
$(make-target-directory)
touch $@
--- glibc-2.6.1/configure.old 2013-02-12 05:10:28.614496246 +0100
+++ glibc-2.6.1/configure 2013-02-12 05:12:44.171568520 +0100
@@ -4463,7 +4463,7 @@
# Found it, now check the version.
echo "$as_me:$LINENO: checking version of $SED" >&5
echo $ECHO_N "checking version of $SED... $ECHO_C" >&6
- ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed version \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*(GNU sed) \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
3.0[2-9]*|3.[1-9]*|[4-9]*)
# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# T2 SDE: package/.../glibc/x86-fnstsw.patch
# Copyright (C) 2008 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---
Fix more strict checking in binutils since 2.18.50.0.3:
sysdeps/i386/fpu/ftestexcept.c:33: Error: suffix or operands invalid for `fnstsw'
- Rene Rebe <[email protected]>
--- glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c.vanilla 2008-09-02 12:45:07.000000000 +0200
+++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-09-02 12:46:37.000000000 +0200
@@ -26,7 +26,7 @@
int
fetestexcept (int excepts)
{
- int temp;
+ short temp;
int xtemp = 0;
/* Get current exceptions. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment