diff options
author | Bryan Hundven <bryanhundven@gmail.com> | 2016-06-17 18:02:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-17 18:02:59 -0700 |
commit | 6e7c61650a39a67ee02ed58c11d64c94c436bb33 (patch) | |
tree | 199f985d8429efb8d075bba2051502f13a30ccf6 /scripts/build/arch/x86.sh | |
parent | 7300eb17b43a38320d25dff47230f483a82b4154 (diff) | |
parent | dc8f2d1c04258069101e913d22c898298b98384c (diff) | |
download | crosstool-ng-6e7c61650a39a67ee02ed58c11d64c94c436bb33.tar.gz crosstool-ng-6e7c61650a39a67ee02ed58c11d64c94c436bb33.tar.bz2 crosstool-ng-6e7c61650a39a67ee02ed58c11d64c94c436bb33.zip |
Merge pull request #403 from stilor/multilib-1
First chunk of multilib changes for merging
Diffstat (limited to 'scripts/build/arch/x86.sh')
-rw-r--r-- | scripts/build/arch/x86.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/scripts/build/arch/x86.sh b/scripts/build/arch/x86.sh index 69407db9..ca0f08bf 100644 --- a/scripts/build/arch/x86.sh +++ b/scripts/build/arch/x86.sh @@ -20,4 +20,51 @@ CT_DoArchTupleValues() { esac fi CT_TARGET_ARCH="${CT_TARGET_ARCH}${CT_ARCH_SUFFIX}" + + # Shouldn't be possible to specify this (CT_TARGET_SYS is not specified by the user, + # it is computed by scripts/functions from libc choices). But trap if such invalid + # values ever come from the caller: + case "${CT_TARGET_ARCH}-${CT_TARGET_SYS}" in + i[34567]86-gnux32) + CT_DoLog ERROR "Invalid CT_TARGET: i[34567]86-<vendor>-<os>-gnux32 is invalid." + CT_DoLog ERROR "CT_TARGET: ${CT_TARGET}" + CT_Abort "Go read: https://wiki.debian.org/Multiarch/Tuples" + ;; + esac +} + +#------------------------------------------------------------------------------ +# Get multilib architecture-specific target +# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple" +CT_DoArchMultilibTarget () +{ + local target="${1}"; shift + local -a multi_flags=( "$@" ) + + local bit32=false + local bit64=false + local abi_dflt=false + local abi_x32=false + + for m in "${multi_flags[@]}"; do + case "$m" in + -m32) bit32=true; abi_dflt=true;; + -m64) bit64=true; abi_dflt=true;; + -mx32) bit64=true; abi_x32=true;; + esac + done + + # Fix up architecture. + case "${target}" in + x86_64-*) $bit32 && target=${target/#x86_64-/i386-} ;; + i[34567]86-*) $bit64 && target=${target/#i[34567]86-/x86_64-} ;; + esac + + # Fix up the ABI part. + case "${target}" in + *x32) $abi_dflt && target=${target/%x32} ;; + *) $abi_x32 && target=${target}x32 ;; + esac + + echo "${target}" } |