libc/glibc: correctly handle dual-bitness archs
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jan 09 16:05:01 2010 +0100 (2010-01-09)
changeset 17195c0d326c2cea
parent 1718 fa028a13929e
child 1720 3995b34ba925
child 1721 4ff4eeb061e5
libc/glibc: correctly handle dual-bitness archs

If the selected ARCH is dual-bitness (eg. supports 32- and 64-bit),
then we need to know the correct place where to fetch some headers.
Currently, this applies only to x86 variants: i386 and x86_64.
scripts/build/libc/glibc.sh
     1.1 --- a/scripts/build/libc/glibc.sh	Sat Jan 09 17:31:25 2010 +0100
     1.2 +++ b/scripts/build/libc/glibc.sh	Sat Jan 09 16:05:01 2010 +0100
     1.3 @@ -103,6 +103,7 @@
     1.4  do_libc_headers() {
     1.5      local cvs
     1.6      local -a extra_config
     1.7 +    local arch4hdrs
     1.8  
     1.9      CT_DoStep INFO "Installing C library headers"
    1.10  
    1.11 @@ -113,6 +114,13 @@
    1.12  
    1.13      CT_DoLog EXTRA "Configuring C library"
    1.14  
    1.15 +    # The x86 arch needs special care... Bizarelly enough... :-(
    1.16 +    case "${CT_KERNEL_ARCH}:${CT_ARCH_BITNESS}" in
    1.17 +        x86:32) arch4hdrs="i386";;
    1.18 +        x86:64) arch4hdrs="x86_64";;
    1.19 +        *)      arch4hdrs="${CT_KERNEL_ARCH}";;
    1.20 +    esac
    1.21 +
    1.22      # The following three things have to be done to build glibc-2.3.x, but they don't hurt older versions.
    1.23      # 1. override CC to keep glibc's configure from using $TARGET-gcc. 
    1.24      # 2. disable linuxthreads, which needs a real cross-compiler to generate tcb-offsets.h properly
    1.25 @@ -230,9 +238,9 @@
    1.26              # NOTE: for some archs, the pathes are different, but they are not
    1.27              # supported by crosstool-NG right now. See original crosstool when they are.
    1.28              pthread_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
    1.29 -            pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
    1.30 +            pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/nptl/sysdeps/unix/sysv/linux/${arch4hdrs}/bits/pthreadtypes.h"
    1.31              if [ ! -f "${pthreadtypes_h}" ]; then
    1.32 -                pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/ports/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
    1.33 +                pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/ports/sysdeps/unix/sysv/linux/${arch4hdrs}/nptl/bits/pthreadtypes.h"
    1.34              fi
    1.35              ;;
    1.36          linuxthreads)