summaryrefslogtreecommitdiff
path: root/scripts/functions
diff options
context:
space:
mode:
authorBryan Hundven <bryanhundven@gmail.com>2016-06-18 01:02:59 (GMT)
committerGitHub <noreply@github.com>2016-06-18 01:02:59 (GMT)
commit6e7c61650a39a67ee02ed58c11d64c94c436bb33 (patch)
tree199f985d8429efb8d075bba2051502f13a30ccf6 /scripts/functions
parent7300eb17b43a38320d25dff47230f483a82b4154 (diff)
parentdc8f2d1c04258069101e913d22c898298b98384c (diff)
Merge pull request #403 from stilor/multilib-1
First chunk of multilib changes for merging
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 70c1ba6..62d264e 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() {