aboutsummaryrefslogtreecommitdiff
path: root/scripts/functions
diff options
context:
space:
mode:
authorRay Donnelly <mingw.android@gmail.com>2014-04-12 13:16:52 +0100
committerAlexey Neyman <stilor@att.net>2016-06-09 17:12:49 -0700
commitc7da54edf4c2e3a3eb97eb5fb967143e5071a670 (patch)
tree89bf44037408dcb914889f2213e7a8101ef39c2b /scripts/functions
parent67b314a05156f9af221b807d543030ef9f0dc842 (diff)
downloadcrosstool-ng-c7da54edf4c2e3a3eb97eb5fb967143e5071a670.tar.gz
crosstool-ng-c7da54edf4c2e3a3eb97eb5fb967143e5071a670.tar.bz2
crosstool-ng-c7da54edf4c2e3a3eb97eb5fb967143e5071a670.zip
glibc: Use common arch call to get multilib targets
The previous patch added the function 'CT_DoMultilibTarget()' to scripts/build/arch/*.sh. This patch calls the common function to (currently) get just the target tuple for the current multilib target. This patch was originally by: Cody P Schafer Changed by Alexey Neyman: first, try `gcc -print-multiarch`. If it is supported, use whatever it reports. Otherwise, fall back to our guesswork. Move "i486" quirk into glibc.sh, as it is specific to glibc (e.g. uclibc will need i386, which is what GCC reports). Signed-off-by: Bryan Hundven <bryanhundven@gmail.com> Signed-off-by: Ray Donnelly <mingw.android@gmail.com> Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts/functions')
-rw-r--r--scripts/functions19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/functions b/scripts/functions
index 70c1ba61..62d264e3 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -1305,6 +1305,25 @@ CT_DoBuildTargetTuple() {
CT_ARCH_TARGET_LDFLAGS="${CT_ARCH_TARGET_LDFLAGS} ${CT_ARCH_ENDIAN_LDFLAG}"
}
+# This function determines the target tuple for a given set of compiler
+# flags, using either GCC's multiarch feature (if supported; if not,
+# GCC prints nothing and exits with status 0), falling back to calling
+# the architecture-specific functions.
+CT_DoMultilibTarget() {
+ local target="$1"; shift
+ local -a multi_flags=( "$@" )
+ local gcc_multiarch
+
+ gcc_multiarch=$( "${CT_TARGET}-gcc" -print-multiarch "${multi_flags[@]}" )
+ if [ -n "${gcc_multiarch}" ]; then
+ echo "${gcc_multiarch}"
+ return
+ fi
+
+ # Fall back to arch-specific guesswork
+ CT_DoArchMultilibTarget "${target}" "${multi_flags[@]}"
+}
+
# This function does pause the build until the user strikes "Return"
# Usage: CT_DoPause [optional_message]
CT_DoPause() {