diff options
author | Ray Donnelly <mingw.android@gmail.com> | 2014-04-12 12:16:52 (GMT) |
---|---|---|
committer | Alexey Neyman <stilor@att.net> | 2016-06-10 00:12:49 (GMT) |
commit | c7da54edf4c2e3a3eb97eb5fb967143e5071a670 (patch) | |
tree | 89bf44037408dcb914889f2213e7a8101ef39c2b /scripts/functions | |
parent | 67b314a05156f9af221b807d543030ef9f0dc842 (diff) |
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/functions | 19 |
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() { |