patches/glibc/ports-2.10.1/290-undefine-__i686.patch
author Johannes Stezenbach <js@sig21.net>
Thu Jul 29 19:47:16 2010 +0200 (2010-07-29)
changeset 2045 fdaa6c7f6dea
permissions -rw-r--r--
cc/gcc: add option to compile against static libstdc++, for gcc-4.4 and newer

Idea and know-how taken from CodeSourcery build script.

Normal build:
$ ldd arm-unknown-linux-uclibcgnueabi-gcc
linux-gate.so.1 => (0xb77f3000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb76e8000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb75a1000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb757a000)
/lib/ld-linux.so.2 (0xb77f4000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb755c000)

CC_STATIC_LIBSTDCXX=y:
$ ldd arm-unknown-linux-uclibcgnueabi-gcc
linux-gate.so.1 => (0xb7843000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb76e6000)
/lib/ld-linux.so.2 (0xb7844000)

I made CC_STATIC_LIBSTDCXX default=y since I think
it is always desirable.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
yann@1625
     1
If gcc is configured to generate i686 code or better by default (like 
yann@1625
     2
when using the --with-arch=pentium3 configure option), then the __i686
yann@1625
     3
macro will always be defined automatically and thus screw up the
yann@1625
     4
compilation of some .S files.
yann@1625
     5
http://bugs.gentoo.org/131108
yann@1625
     6
http://sourceware.org/ml/libc-alpha/2006-04/msg00090.html
yann@1625
     7
yann@1625
     8
2006-04-25  Mike Frysinger  <vapier@gentoo.org>
yann@1625
     9
yann@1625
    10
	* sysdeps/i386/sysdep.h (__i686): Undefine.
yann@1625
    11
yann@1625
    12
diff -durN glibc-2.10.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.10.1/nptl/sysdeps/pthread/pt-initfini.c
yann@1625
    13
--- glibc-2.10.1.orig/nptl/sysdeps/pthread/pt-initfini.c	2007-06-17 20:02:01.000000000 +0200
yann@1625
    14
+++ glibc-2.10.1/nptl/sysdeps/pthread/pt-initfini.c	2009-11-13 00:50:22.000000000 +0100
yann@1625
    15
@@ -45,6 +45,9 @@
yann@1625
    16
 /* Embed an #include to pull in the alignment and .end directives. */
yann@1625
    17
 asm ("\n#include \"defs.h\"");
yann@1625
    18
 
yann@1625
    19
+/* Embed an #include to pull in asm settings. */
yann@1625
    20
+asm ("\n#ifdef __i686__\n#include <sysdep.h>\n#endif");
yann@1625
    21
+
yann@1625
    22
 /* The initial common code ends here. */
yann@1625
    23
 asm ("\n/*@HEADER_ENDS*/");
yann@1625
    24
 
yann@1625
    25
diff -durN glibc-2.10.1.orig/sysdeps/i386/sysdep.h glibc-2.10.1/sysdeps/i386/sysdep.h
yann@1625
    26
--- glibc-2.10.1.orig/sysdeps/i386/sysdep.h	2006-10-28 08:44:03.000000000 +0200
yann@1625
    27
+++ glibc-2.10.1/sysdeps/i386/sysdep.h	2009-11-13 00:50:22.000000000 +0100
yann@1625
    28
@@ -18,6 +18,14 @@
yann@1625
    29
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
yann@1625
    30
    02111-1307 USA.  */
yann@1625
    31
 
yann@1625
    32
+/*
yann@1625
    33
+ * When building for i686 targets or better, gcc automatically defines
yann@1625
    34
+ * '__i686' to '1' for us which causes trouble when using section names
yann@1625
    35
+ * like '__i686.get_pc_thunk.reg'.  Since we check for __i686__ in the
yann@1625
    36
+ * code, killing '__i686' shouldn't be a problem.
yann@1625
    37
+ */
yann@1625
    38
+#undef __i686
yann@1625
    39
+
yann@1625
    40
 #include <sysdeps/generic/sysdep.h>
yann@1625
    41
 
yann@1625
    42
 #ifdef	__ASSEMBLER__