libc/glibc: fix cross-compiling to i686
authorEsben Haabendal <eha@dev.doredevelopment.dk>
Wed Apr 06 20:15:40 2011 +0200 (2011-04-06)
changeset 2378fa3c0b3cebf6
parent 2377 32c08de1d54f
child 2379 372245834071
libc/glibc: fix cross-compiling to i686

In OE-lite we use the attached patch for building i686 cross compilers.
Thanks to Khem Raj for original patch :-)

At the same time, remove the corresponding patch that was in
the ports patchset.

CC: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Esben Haabendal <eha@dev.doredevelopment.dk>
[yann.morin.1998@anciens.enib.fr: remove patch from ports]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
patches/glibc/2.10.1/900-march-i686.patch
patches/glibc/2.11.1/900-march-i686.patch
patches/glibc/2.11/900-march-i686.patch
patches/glibc/2.12.1/900-march-i686.patch
patches/glibc/2.12.2/900-march-i686.patch
patches/glibc/2.9/900-march-i686.patch
patches/glibc/ports-2.10.1/290-undefine-__i686.patch
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.10.1/900-march-i686.patch	Wed Apr 06 20:15:40 2011 +0200
     1.3 @@ -0,0 +1,34 @@
     1.4 +2007-02-15  Khem Raj  <kraj@xxxxxxxxxx>
     1.5 +
     1.6 +       * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686.
     1.7 +       * nptl/sysdeps/pthread/pt-initfini.c: Ditto.
     1.8 +
     1.9 +diff -urN glibc-2.10.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.10.1/nptl/sysdeps/pthread/pt-initfini.c
    1.10 +--- glibc-2.10.1.orig/nptl/sysdeps/pthread/pt-initfini.c	2009-12-08 21:10:20.000000000 +0100
    1.11 ++++ glibc-2.10.1/nptl/sysdeps/pthread/pt-initfini.c	2010-12-30 11:33:31.520855595 +0100
    1.12 +@@ -45,6 +45,11 @@
    1.13 + /* Embed an #include to pull in the alignment and .end directives. */
    1.14 + asm ("\n#include \"defs.h\"");
    1.15 + 
    1.16 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
    1.17 ++asm ("\n#undef __i686");
    1.18 ++asm ("\n#define __i686 __i686");
    1.19 ++asm ("\n#endif");
    1.20 ++
    1.21 + /* The initial common code ends here. */
    1.22 + asm ("\n/*@HEADER_ENDS*/");
    1.23 + 
    1.24 +diff -urN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.10.1/sysdeps/unix/sysv/linux/i386/sysdep.h
    1.25 +--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-12-08 21:10:20.000000000 +0100
    1.26 ++++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-12-30 11:33:31.520855595 +0100
    1.27 +@@ -29,6 +29,10 @@
    1.28 + #include <dl-sysdep.h>
    1.29 + #include <tls.h>
    1.30 + 
    1.31 ++#if defined __i686 && defined __ASSEMBLER__
    1.32 ++#undef __i686
    1.33 ++#define __i686 __i686
    1.34 ++#endif
    1.35 + 
    1.36 + /* For Linux we can use the system call table in the header file
    1.37 + 	/usr/include/asm/unistd.h
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/glibc/2.11.1/900-march-i686.patch	Wed Apr 06 20:15:40 2011 +0200
     2.3 @@ -0,0 +1,34 @@
     2.4 +2007-02-15  Khem Raj  <kraj@xxxxxxxxxx>
     2.5 +
     2.6 +       * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686.
     2.7 +       * nptl/sysdeps/pthread/pt-initfini.c: Ditto.
     2.8 +
     2.9 +diff -urN glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c
    2.10 +--- glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c	2009-12-08 21:10:20.000000000 +0100
    2.11 ++++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c	2010-12-30 11:33:31.520855595 +0100
    2.12 +@@ -45,6 +45,11 @@
    2.13 + /* Embed an #include to pull in the alignment and .end directives. */
    2.14 + asm ("\n#include \"defs.h\"");
    2.15 + 
    2.16 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
    2.17 ++asm ("\n#undef __i686");
    2.18 ++asm ("\n#define __i686 __i686");
    2.19 ++asm ("\n#endif");
    2.20 ++
    2.21 + /* The initial common code ends here. */
    2.22 + asm ("\n/*@HEADER_ENDS*/");
    2.23 + 
    2.24 +diff -urN glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h
    2.25 +--- glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-12-08 21:10:20.000000000 +0100
    2.26 ++++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-12-30 11:33:31.520855595 +0100
    2.27 +@@ -29,6 +29,10 @@
    2.28 + #include <dl-sysdep.h>
    2.29 + #include <tls.h>
    2.30 + 
    2.31 ++#if defined __i686 && defined __ASSEMBLER__
    2.32 ++#undef __i686
    2.33 ++#define __i686 __i686
    2.34 ++#endif
    2.35 + 
    2.36 + /* For Linux we can use the system call table in the header file
    2.37 + 	/usr/include/asm/unistd.h
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/patches/glibc/2.11/900-march-i686.patch	Wed Apr 06 20:15:40 2011 +0200
     3.3 @@ -0,0 +1,34 @@
     3.4 +2007-02-15  Khem Raj  <kraj@xxxxxxxxxx>
     3.5 +
     3.6 +       * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686.
     3.7 +       * nptl/sysdeps/pthread/pt-initfini.c: Ditto.
     3.8 +
     3.9 +diff -urN glibc-2.11.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11/nptl/sysdeps/pthread/pt-initfini.c
    3.10 +--- glibc-2.11.orig/nptl/sysdeps/pthread/pt-initfini.c	2009-12-08 21:10:20.000000000 +0100
    3.11 ++++ glibc-2.11/nptl/sysdeps/pthread/pt-initfini.c	2010-12-30 11:33:31.520855595 +0100
    3.12 +@@ -45,6 +45,11 @@
    3.13 + /* Embed an #include to pull in the alignment and .end directives. */
    3.14 + asm ("\n#include \"defs.h\"");
    3.15 + 
    3.16 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
    3.17 ++asm ("\n#undef __i686");
    3.18 ++asm ("\n#define __i686 __i686");
    3.19 ++asm ("\n#endif");
    3.20 ++
    3.21 + /* The initial common code ends here. */
    3.22 + asm ("\n/*@HEADER_ENDS*/");
    3.23 + 
    3.24 +diff -urN glibc-2.11.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.11/sysdeps/unix/sysv/linux/i386/sysdep.h
    3.25 +--- glibc-2.11.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-12-08 21:10:20.000000000 +0100
    3.26 ++++ glibc-2.11/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-12-30 11:33:31.520855595 +0100
    3.27 +@@ -29,6 +29,10 @@
    3.28 + #include <dl-sysdep.h>
    3.29 + #include <tls.h>
    3.30 + 
    3.31 ++#if defined __i686 && defined __ASSEMBLER__
    3.32 ++#undef __i686
    3.33 ++#define __i686 __i686
    3.34 ++#endif
    3.35 + 
    3.36 + /* For Linux we can use the system call table in the header file
    3.37 + 	/usr/include/asm/unistd.h
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/patches/glibc/2.12.1/900-march-i686.patch	Wed Apr 06 20:15:40 2011 +0200
     4.3 @@ -0,0 +1,34 @@
     4.4 +2007-02-15  Khem Raj  <kraj@xxxxxxxxxx>
     4.5 +
     4.6 +       * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686.
     4.7 +       * nptl/sysdeps/pthread/pt-initfini.c: Ditto.
     4.8 +
     4.9 +diff -urN glibc-2.12.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.12.1/nptl/sysdeps/pthread/pt-initfini.c
    4.10 +--- glibc-2.12.1.orig/nptl/sysdeps/pthread/pt-initfini.c	2009-10-30 18:17:08.000000000 +0100
    4.11 ++++ glibc-2.12.1/nptl/sysdeps/pthread/pt-initfini.c	2010-12-30 11:36:19.858708534 +0100
    4.12 +@@ -45,6 +45,11 @@
    4.13 + /* Embed an #include to pull in the alignment and .end directives. */
    4.14 + asm ("\n#include \"defs.h\"");
    4.15 + 
    4.16 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
    4.17 ++asm ("\n#undef __i686");
    4.18 ++asm ("\n#define __i686 __i686");
    4.19 ++asm ("\n#endif");
    4.20 ++
    4.21 + /* The initial common code ends here. */
    4.22 + asm ("\n/*@HEADER_ENDS*/");
    4.23 + 
    4.24 +diff -urN glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.12.1/sysdeps/unix/sysv/linux/i386/sysdep.h
    4.25 +--- glibc-2.12.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-10-30 18:17:08.000000000 +0100
    4.26 ++++ glibc-2.12.1/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-12-30 11:36:19.858708534 +0100
    4.27 +@@ -29,6 +29,10 @@
    4.28 + #include <dl-sysdep.h>
    4.29 + #include <tls.h>
    4.30 + 
    4.31 ++#if defined __i686 && defined __ASSEMBLER__
    4.32 ++#undef __i686
    4.33 ++#define __i686 __i686
    4.34 ++#endif
    4.35 + 
    4.36 + /* For Linux we can use the system call table in the header file
    4.37 + 	/usr/include/asm/unistd.h
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/patches/glibc/2.12.2/900-march-i686.patch	Wed Apr 06 20:15:40 2011 +0200
     5.3 @@ -0,0 +1,34 @@
     5.4 +2007-02-15  Khem Raj  <kraj@xxxxxxxxxx>
     5.5 +
     5.6 +       * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686.
     5.7 +       * nptl/sysdeps/pthread/pt-initfini.c: Ditto.
     5.8 +
     5.9 +diff -urN glibc-2.12.2.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.12.2/nptl/sysdeps/pthread/pt-initfini.c
    5.10 +--- glibc-2.12.2.orig/nptl/sysdeps/pthread/pt-initfini.c	2009-10-30 18:17:08.000000000 +0100
    5.11 ++++ glibc-2.12.2/nptl/sysdeps/pthread/pt-initfini.c	2010-12-30 11:36:19.858708534 +0100
    5.12 +@@ -45,6 +45,11 @@
    5.13 + /* Embed an #include to pull in the alignment and .end directives. */
    5.14 + asm ("\n#include \"defs.h\"");
    5.15 + 
    5.16 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
    5.17 ++asm ("\n#undef __i686");
    5.18 ++asm ("\n#define __i686 __i686");
    5.19 ++asm ("\n#endif");
    5.20 ++
    5.21 + /* The initial common code ends here. */
    5.22 + asm ("\n/*@HEADER_ENDS*/");
    5.23 + 
    5.24 +diff -urN glibc-2.12.2.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.12.2/sysdeps/unix/sysv/linux/i386/sysdep.h
    5.25 +--- glibc-2.12.2.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-10-30 18:17:08.000000000 +0100
    5.26 ++++ glibc-2.12.2/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-12-30 11:36:19.858708534 +0100
    5.27 +@@ -29,6 +29,10 @@
    5.28 + #include <dl-sysdep.h>
    5.29 + #include <tls.h>
    5.30 + 
    5.31 ++#if defined __i686 && defined __ASSEMBLER__
    5.32 ++#undef __i686
    5.33 ++#define __i686 __i686
    5.34 ++#endif
    5.35 + 
    5.36 + /* For Linux we can use the system call table in the header file
    5.37 + 	/usr/include/asm/unistd.h
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/patches/glibc/2.9/900-march-i686.patch	Wed Apr 06 20:15:40 2011 +0200
     6.3 @@ -0,0 +1,34 @@
     6.4 +2007-02-15  Khem Raj  <kraj@xxxxxxxxxx>
     6.5 +
     6.6 +       * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686.
     6.7 +       * nptl/sysdeps/pthread/pt-initfini.c: Ditto.
     6.8 +
     6.9 +diff -urN glibc-2.9.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.9/nptl/sysdeps/pthread/pt-initfini.c
    6.10 +--- glibc-2.9.orig/nptl/sysdeps/pthread/pt-initfini.c	2009-12-08 21:10:20.000000000 +0100
    6.11 ++++ glibc-2.9/nptl/sysdeps/pthread/pt-initfini.c	2010-12-30 11:33:31.520855595 +0100
    6.12 +@@ -45,6 +45,11 @@
    6.13 + /* Embed an #include to pull in the alignment and .end directives. */
    6.14 + asm ("\n#include \"defs.h\"");
    6.15 + 
    6.16 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
    6.17 ++asm ("\n#undef __i686");
    6.18 ++asm ("\n#define __i686 __i686");
    6.19 ++asm ("\n#endif");
    6.20 ++
    6.21 + /* The initial common code ends here. */
    6.22 + asm ("\n/*@HEADER_ENDS*/");
    6.23 + 
    6.24 +diff -urN glibc-2.9.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.9/sysdeps/unix/sysv/linux/i386/sysdep.h
    6.25 +--- glibc-2.9.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-12-08 21:10:20.000000000 +0100
    6.26 ++++ glibc-2.9/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-12-30 11:33:31.520855595 +0100
    6.27 +@@ -29,6 +29,10 @@
    6.28 + #include <dl-sysdep.h>
    6.29 + #include <tls.h>
    6.30 + 
    6.31 ++#if defined __i686 && defined __ASSEMBLER__
    6.32 ++#undef __i686
    6.33 ++#define __i686 __i686
    6.34 ++#endif
    6.35 + 
    6.36 + /* For Linux we can use the system call table in the header file
    6.37 + 	/usr/include/asm/unistd.h
     7.1 --- a/patches/glibc/ports-2.10.1/290-undefine-__i686.patch	Tue Apr 05 01:04:31 2011 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,42 +0,0 @@
     7.4 -If gcc is configured to generate i686 code or better by default (like 
     7.5 -when using the --with-arch=pentium3 configure option), then the __i686
     7.6 -macro will always be defined automatically and thus screw up the
     7.7 -compilation of some .S files.
     7.8 -http://bugs.gentoo.org/131108
     7.9 -http://sourceware.org/ml/libc-alpha/2006-04/msg00090.html
    7.10 -
    7.11 -2006-04-25  Mike Frysinger  <vapier@gentoo.org>
    7.12 -
    7.13 -	* sysdeps/i386/sysdep.h (__i686): Undefine.
    7.14 -
    7.15 -diff -durN glibc-2.10.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.10.1/nptl/sysdeps/pthread/pt-initfini.c
    7.16 ---- glibc-2.10.1.orig/nptl/sysdeps/pthread/pt-initfini.c	2007-06-17 20:02:01.000000000 +0200
    7.17 -+++ glibc-2.10.1/nptl/sysdeps/pthread/pt-initfini.c	2009-11-13 00:50:22.000000000 +0100
    7.18 -@@ -45,6 +45,9 @@
    7.19 - /* Embed an #include to pull in the alignment and .end directives. */
    7.20 - asm ("\n#include \"defs.h\"");
    7.21 - 
    7.22 -+/* Embed an #include to pull in asm settings. */
    7.23 -+asm ("\n#ifdef __i686__\n#include <sysdep.h>\n#endif");
    7.24 -+
    7.25 - /* The initial common code ends here. */
    7.26 - asm ("\n/*@HEADER_ENDS*/");
    7.27 - 
    7.28 -diff -durN glibc-2.10.1.orig/sysdeps/i386/sysdep.h glibc-2.10.1/sysdeps/i386/sysdep.h
    7.29 ---- glibc-2.10.1.orig/sysdeps/i386/sysdep.h	2006-10-28 08:44:03.000000000 +0200
    7.30 -+++ glibc-2.10.1/sysdeps/i386/sysdep.h	2009-11-13 00:50:22.000000000 +0100
    7.31 -@@ -18,6 +18,14 @@
    7.32 -    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    7.33 -    02111-1307 USA.  */
    7.34 - 
    7.35 -+/*
    7.36 -+ * When building for i686 targets or better, gcc automatically defines
    7.37 -+ * '__i686' to '1' for us which causes trouble when using section names
    7.38 -+ * like '__i686.get_pc_thunk.reg'.  Since we check for __i686__ in the
    7.39 -+ * code, killing '__i686' shouldn't be a problem.
    7.40 -+ */
    7.41 -+#undef __i686
    7.42 -+
    7.43 - #include <sysdeps/generic/sysdep.h>
    7.44 - 
    7.45 - #ifdef	__ASSEMBLER__