# HG changeset patch # User "Yann E. MORIN" # Date 1254514238 -7200 # Node ID 8c40b842e798312e17f1143301d6de024da5f7b9 # Parent 2e84b052ed5f283b0327730fb66236075e0fab94 libc/glibc: fix building for seemingly native toolchains Build glibc with -O2 as a fix/workaround to building seemingly-native toolchains. See: - docs/overview.txt - docs/known-issues.txt - http://sourceware.org/ml/crossgcc/2009-09/msg00055.html diff -r 2e84b052ed5f -r 8c40b842e798 docs/known-issues.txt --- a/docs/known-issues.txt Thu Oct 01 22:14:45 2009 +0200 +++ b/docs/known-issues.txt Fri Oct 02 22:10:38 2009 +0200 @@ -51,8 +51,10 @@ None known. Workaround: - If this happens for you, stick with glibc-2.6.1 for now. - Or investigate! :-) + It seems that using -O2 in the CFLAGS fixes the problem. It has been + confirmed in the following threads: + http://sourceware.org/ml/crossgcc/2009-09/msg00055.html (for glibc) + http://sourceware.org/ml/crossgcc/2009-10/msg00001.html (for eglibc) -------------------------------- Symptoms: diff -r 2e84b052ed5f -r 8c40b842e798 docs/overview.txt --- a/docs/overview.txt Thu Oct 01 22:14:45 2009 +0200 +++ b/docs/overview.txt Fri Oct 02 22:10:38 2009 +0200 @@ -28,6 +28,7 @@ Tools wrapper Using the toolchain Toolchain types + Seemingly-native toolchains Internals Makefile front-end Kconfig parser @@ -590,6 +591,21 @@ were all being hashed out, Canada had three national political parties. http://en.wikipedia.org/wiki/Cross_compiler +Seemingly-native toolchains | +----------------------------+ + +Seemingly-native toolchains are toolchains that target the same architecture +as the one it is built on, and on which it will run, but the machine tuple +may be different (eg i686 vs. i386, or x86_64-unknown-linux-gnu vs. +x86_64-pc-linux-gnu). This also applies if the target architecture is of the +same kind (eg. x86 vs. x86_64, or ppc vs. ppc64). + +Such toolchain is tricky to build, as the configure scripts may incorrectly +assume that files (headers and libs) from the build (or host) machine can be +used by the cross-compiler it is going to build. The problem seems to arise +only with glibc (and eglibc?) starting with version 2.7. + + _____________ / Internals / diff -r 2e84b052ed5f -r 8c40b842e798 scripts/build/libc/glibc.sh --- a/scripts/build/libc/glibc.sh Thu Oct 01 22:14:45 2009 +0200 +++ b/scripts/build/libc/glibc.sh Fri Oct 02 22:10:38 2009 +0200 @@ -180,7 +180,7 @@ libc_cv_ppc_machine=yes \ CT_DoExecLog ALL \ - make CFLAGS="-O -DBOOTSTRAP_GCC" \ + make CFLAGS="-O2 -DBOOTSTRAP_GCC" \ OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \ PARALLELMFLAGS="${PARALLELMFLAGS}" \ sysdeps/gnu/errlist.c @@ -197,7 +197,7 @@ CT_DoExecLog ALL \ make cross-compiling=yes \ install_root=${CT_SYSROOT_DIR} \ - CFLAGS="-O -DBOOTSTRAP_GCC" \ + CFLAGS="-O2 -DBOOTSTRAP_GCC" \ ${LIBC_SYSROOT_ARG} \ OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \ PARALLELMFLAGS="${PARALLELMFLAGS}" \ @@ -325,7 +325,7 @@ # Please see the comment for the configure step in do_libc(). BUILD_CC="${CT_BUILD}-gcc" \ - CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O " \ + CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O2" \ CC="${cross_cc} ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \ AR=${CT_TARGET}-ar \ RANLIB=${CT_TARGET}-ranlib \ @@ -457,7 +457,7 @@ # silly messages. GNU folks again, he? BUILD_CC="${CT_BUILD}-gcc" \ - CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O" \ + CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O2" \ CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \ AR=${CT_TARGET}-ar \ RANLIB=${CT_TARGET}-ranlib \