diff --git a/architecture/mips/archtest.sh b/architecture/mips/archtest.sh index 3b894a5d7..c13497af4 100644 --- a/architecture/mips/archtest.sh +++ b/architecture/mips/archtest.sh @@ -16,5 +16,7 @@ case "$ROCKCFG_MIPS_ABI" in arch_machine=mips64 arch_target="${arch_machine}${arch_endianess}-unknown-linux-gnu" arch_target32="mips${arch_endianess}-unknown-linux-gnu" + BUILD32="-mabi=32" + BUILD64="-mabi=$ROCKCFG_MIPS_ABI" ;; esac diff --git a/architecture/x86/archtest.sh b/architecture/x86/archtest.sh index c1fd56e72..26d59ba99 100644 --- a/architecture/x86/archtest.sh +++ b/architecture/x86/archtest.sh @@ -15,6 +15,8 @@ else arch_sizeof_char_p=8 arch_machine="x86_64" arch_target32="i686-pc-linux-gnu" + BUILD32="-m32" + BUILD64="-m64" fi arch_target="${arch_machine}-unknown-linux-gnu" diff --git a/package/base/gcc/gcc.conf b/package/base/gcc/gcc.conf index deea1b42c..7759cd441 100644 --- a/package/base/gcc/gcc.conf +++ b/package/base/gcc/gcc.conf @@ -180,6 +180,13 @@ fi if [ "$ROCKCFG_MULTILIB" = 0 ] ; then var_append extraconfopt " " "--disable-multilib" + + if [ "$arch_machine" = mips64 ] ; then + # When building only 64-bit libraries and programs, tell gcc + # to build its own libraries with -mabi=64 too. --with-abi is + # available in gcc34 and above. + var_append extraconfopt " " "--with-abi=64" + fi fi custmain="custmain" diff --git a/package/base/gcc/parse-config b/package/base/gcc/parse-config index ff99e8f0b..df7ad5baf 100644 --- a/package/base/gcc/parse-config +++ b/package/base/gcc/parse-config @@ -49,7 +49,7 @@ unset x y z if [ $stagelevel -ge 1 ] ; then if [[ "$xpkg" = *-32bit ]] ; then export CC="${CC} ${BUILD32}" CXX="${CXX} ${BUILD32}" - elif [ "$ROCKCFG_MULTILIB" = 1 ] ; then + elif [ "$BUILD64" ] ; then export CC="${CC} ${BUILD64}" CXX="${CXX} ${BUILD64}" fi fi diff --git a/package/base/glibc/glibc.conf b/package/base/glibc/glibc.conf index 2258c6de7..c983698a1 100644 --- a/package/base/glibc/glibc.conf +++ b/package/base/glibc/glibc.conf @@ -29,13 +29,11 @@ pkg_glibc_cross="" pkg_glibc_headers_only=0 pkg_glibc_cc="" -if [ "$ROCKCFG_MULTILIB" = 1 ] ; then - if [[ "$xpkg" = *-32bit ]] ; then - pkg_glibc_cc="$BUILD32" - pkg_glibc_host="$arch_target32" - else - pkg_glibc_cc="$BUILD64" - fi +if [[ "$xpkg" = *-32bit ]] ; then + pkg_glibc_cc="$BUILD32" + pkg_glibc_host="$arch_target32" +elif [ "$BUILD64" ] ; then + pkg_glibc_cc="$BUILD64" fi prefix="usr" @@ -69,7 +67,10 @@ if [ $stagelevel -le 2 ]; then $confdir/glibc$pkg_glibc_version/*.patch.cross.$arch 2>/dev/null | tr '\n' ' '`" fi -configscript="../glibc-*/configure" +# Use absolute path to configure script as e.g. the path to +# ports/sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed is based on it +# and will point to the wrong location otherwise. +configscript="$builddir/glibc-*/configure" if [ $stagelevel -eq 0 ] ; then pkg_glibc_headers_only=1 @@ -114,10 +115,18 @@ if [ "$pkg_glibc_cross" ] ; then fi fi -# Fix for mips when building glibc headers. -if [[ "$pkg_glibc_host" == mips* ]] ; then - if [ $pkg_glibc_headers_only = 1 ] ; then - var_append patchfiles " " "$confdir/glibc$pkg_glibc_version/glibc-*-mips-mabi-stage0.diff" +# Fix for mips/mips64 when building glibc headers. +if [ $pkg_glibc_headers_only = 1 ] ; then + if [[ "$arch_machine" == mips* ]] ; then + # don't pass mips specific options to build C compiler + var_append BUILDCC_WRAPPER_REMOVE " " "-mabi=*" + # installing headers fails if _MIPS_SZPTR (and thus _WORDSIZE) + # is not defined, with: ./bits/types.h:129:3: error: #error + if [[ "$arch_machine" == mips64* ]] ; then + var_append BUILDCC_WRAPPER_APPEND " " "-D_MIPS_SZPTR=64" + else + var_append BUILDCC_WRAPPER_APPEND " " "-D_MIPS_SZPTR=32" + fi fi fi diff --git a/package/base/glibc/glibc27/glibc-2.7-mips-mabi-stage0.diff b/package/base/glibc/glibc27/glibc-2.7-mips-mabi-stage0.diff deleted file mode 100644 index fea1c92ab..000000000 --- a/package/base/glibc/glibc27/glibc-2.7-mips-mabi-stage0.diff +++ /dev/null @@ -1,14 +0,0 @@ -In stage 0 glibc configure tries to call the build system gcc with -mabi=32, -causing test failures. Also set _MIPS_SZPTR for 32bit builds since it is not -defined elsewhere. - -See http://sourceware.org/ml/crossgcc/2005-07/msg00036.html and -http://sourceware.org/ml/crossgcc/2008-01/msg00007.html - ---- glibc-2.7/ports/sysdeps/mips/mips32/Makefile-orig 2003-03-29 09:15:28.000000000 +0100 -+++ glibc-2.7/ports/sysdeps/mips/mips32/Makefile 2008-10-06 03:29:36.000000000 +0200 -@@ -1,3 +1,3 @@ - ifeq ($(filter -mabi=32,$(CC)),) --CC += -mabi=32 -+CC += -D"_MIPS_SZPTR=32" - endif diff --git a/scripts/parse-config b/scripts/parse-config index 523b83ce1..81f6c470f 100644 --- a/scripts/parse-config +++ b/scripts/parse-config @@ -134,7 +134,6 @@ export LC_ALL=C; umask 022 # export BUILDCXX="c++" BUILD_CXX="c++" HOSTCXX="c++" HOST_CXX="c++" export BUILDCC="gcc" BUILD_CC="gcc" HOSTCC="gcc" HOST_CC="gcc" export BUILDCXX="g++" BUILD_CXX="g++" HOSTCXX="g++" HOST_CXX="g++" -export BUILD32="-m32" BUILD64="-m64" if [ "$ROCKCFG_LINGUAS" == "all" ] ; then unset LINGUAS