summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2018-07-24 22:54:27 +0100
committerJames Le Cuirot <chewi@gentoo.org>2018-08-21 21:37:27 +0100
commit921cb9c10de4d237924a61a1c27f914dfb479a64 (patch)
tree57b3522793cd58074600333067735919d692a795
parenttoolchain-funcs.eclass: tc-cpp-is-true function to simplify helpers (diff)
downloadgentoo-921cb9c10de4d237924a61a1c27f914dfb479a64.tar.gz
gentoo-921cb9c10de4d237924a61a1c27f914dfb479a64.tar.bz2
gentoo-921cb9c10de4d237924a61a1c27f914dfb479a64.zip
toolchain-funcs.eclass: Update tc-is-softfloat for new ARM tuples
ARM tuples will change from armv7a-hardfloat-linux-gnueabi to armv7a-unknown-linux-gnueabihf or similar in the 17.0 profiles. The function already treated the latter as hardfloat but this commit will now treat ambiguous tuples such as arm-unknown-linux-gnueabi as softfloat rather than hardfloat. This brings Gentoo in line with most of the ARM Linux community. However, the function will now check existing toolchains to avoid breaking existing systems, if possible. This has been achieved by splitting the function in three, tc-detect-is-softfloat for checking existing toolchains, tc-tuple-is-softfloat for checking just the tuple, and the new tc-is-softfloat that calls the first two. The output from the first two could be compared to inform the user that they are not using a recommended tuplet.
-rw-r--r--eclass/toolchain-funcs.eclass74
1 files changed, 60 insertions, 14 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index d9a37c91a8ef..3fa32820151c 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -217,6 +217,65 @@ tc-cpp-is-true() {
[[ ${RESULT} == true ]]
}
+# @FUNCTION: tc-detect-is-softfloat
+# @RETURN:
+# Shell true if (positive or negative) detection was possible, shell
+# false otherwise. Also outputs a string when detection succeeds, see
+# tc-is-softfloat for the possible values.
+# @DESCRIPTION:
+# Detect whether the CTARGET (or CHOST) toolchain is a softfloat based
+# one by examining the toolchain's output, if possible.
+tc-detect-is-softfloat() {
+ # If fetching CPP falls back to the default (gcc -E) then fail
+ # detection as this may not be the correct toolchain.
+ [[ $(tc-getTARGET_CPP) == "gcc -E" ]] && return 1
+
+ case ${CTARGET:-${CHOST}} in
+ # arm-unknown-linux-gnueabi is ambiguous. We used to treat it as
+ # hardfloat but we now treat it as softfloat like most everyone
+ # else. Check existing toolchains to respect existing systems.
+ arm*)
+ if tc-cpp-is-true "defined(__ARM_PCS_VFP)"; then
+ echo "no"
+ else
+ # Confusingly __SOFTFP__ is defined only when
+ # -mfloat-abi is soft, not softfp.
+ if tc-cpp-is-true "defined(__SOFTFP__)"; then
+ echo "yes"
+ else
+ echo "softfp"
+ fi
+ fi
+
+ return 0 ;;
+ *)
+ return 1 ;;
+ esac
+}
+
+# @FUNCTION: tc-tuple-is-softfloat
+# @RETURN: See tc-is-softfloat for the possible values.
+# @DESCRIPTION:
+# Determine whether the CTARGET (or CHOST) toolchain is a softfloat
+# based one solely from the tuple.
+tc-tuple-is-softfloat() {
+ local CTARGET=${CTARGET:-${CHOST}}
+ case ${CTARGET//_/-} in
+ bfin*|h8300*)
+ echo "only" ;;
+ *-softfloat-*)
+ echo "yes" ;;
+ *-softfp-*)
+ echo "softfp" ;;
+ arm*-hardfloat-*|arm*eabihf)
+ echo "no" ;;
+ arm*)
+ echo "yes" ;;
+ *)
+ echo "no" ;;
+ esac
+}
+
# @FUNCTION: tc-is-softfloat
# @DESCRIPTION:
# See if this toolchain is a softfloat based one.
@@ -231,20 +290,7 @@ tc-cpp-is-true() {
# softfloat flags in the case where support is optional, but
# rejects softfloat flags where the target always lacks an fpu.
tc-is-softfloat() {
- local CTARGET=${CTARGET:-${CHOST}}
- case ${CTARGET} in
- bfin*|h8300*)
- echo "only" ;;
- *)
- if [[ ${CTARGET//_/-} == *-softfloat-* ]] ; then
- echo "yes"
- elif [[ ${CTARGET//_/-} == *-softfp-* ]] ; then
- echo "softfp"
- else
- echo "no"
- fi
- ;;
- esac
+ tc-detect-is-softfloat || tc-tuple-is-softfloat
}
# @FUNCTION: tc-is-static-only