mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-19 12:57:53 +00:00
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>
This commit is contained in:
parent
67b314a051
commit
c7da54edf4
@ -137,7 +137,7 @@ do_libc_backend() {
|
||||
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}${extra_dir//\//_}"
|
||||
|
||||
target=${CT_TARGET}
|
||||
target=$( CT_DoMultilibTarget "${CT_TARGET}" ${extra_flags} )
|
||||
case "${target}" in
|
||||
# SPARC quirk: glibc 2.23 and newer dropped support for SPARCv8 and
|
||||
# earlier (corresponding pthread barrier code is missing). Until this
|
||||
@ -147,6 +147,18 @@ do_libc_backend() {
|
||||
target=${target/#sparc-/sparcv9-}
|
||||
fi
|
||||
;;
|
||||
# x86 quirk: architecture name is i386, but glibc expects i[4567]86 - to
|
||||
# indicate the desired optimization. If it was a multilib variant of x86_64,
|
||||
# then it targets at least NetBurst a.k.a. i786, but we'll follow arch/x86.sh
|
||||
# and set the optimization to i686. Otherwise, replace with the most
|
||||
# conservative choice, i486.
|
||||
i386-*)
|
||||
if [ "${CT_TARGET_ARCH}" = "x86_64" ]; then
|
||||
target=${target/#i386-/i686-}
|
||||
else
|
||||
target=${target/#i386-/i486-}
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
do_libc_backend_once extra_dir="${extra_dir}" \
|
||||
@ -193,6 +205,7 @@ do_libc_backend() {
|
||||
# libc_full : Build full libc : bool : n
|
||||
# extra_flags : Extra CFLAGS to use (for multilib) : string : (empty)
|
||||
# extra_dir : Extra subdir for multilib : string : (empty)
|
||||
# target : Build libc using this target (for multilib) : string : ${CT_TARGET}
|
||||
do_libc_backend_once() {
|
||||
local libc_headers
|
||||
local libc_startfiles
|
||||
@ -213,6 +226,10 @@ do_libc_backend_once() {
|
||||
eval "${arg// /\\ }"
|
||||
done
|
||||
|
||||
if [ "${target}" = "" ]; then
|
||||
target="${CT_TARGET}"
|
||||
fi
|
||||
|
||||
CT_DoLog EXTRA "Configuring C library"
|
||||
|
||||
case "${CT_LIBC}" in
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user