1 |
ARM tuples will change from armv7a-hardfloat-linux-gnueabi to |
2 |
armv7a-unknown-linux-gnueabihf or similar in the 17.0 profiles. The |
3 |
function already treated the latter as hardfloat but this commit will |
4 |
now treat ambiguous tuples such as arm-unknown-linux-gnueabi as |
5 |
softfloat rather than hardfloat. This brings Gentoo in line with most |
6 |
of the ARM Linux community. However, the function will now check |
7 |
existing toolchains to avoid breaking existing systems, if possible. |
8 |
|
9 |
This has been achieved by splitting the function in three, |
10 |
tc-detect-is-softfloat for checking existing toolchains, |
11 |
tc-tuple-is-softfloat for checking just the tuple, and the new |
12 |
tc-is-softfloat that calls the first two. The output from the first |
13 |
two could be compared to inform the user that they are not using a |
14 |
recommended tuple. |
15 |
--- |
16 |
eclass/toolchain-funcs.eclass | 74 ++++++++++++++++++++++++++++------- |
17 |
1 file changed, 60 insertions(+), 14 deletions(-) |
18 |
|
19 |
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass |
20 |
index d9a37c91a8ef..3fa32820151c 100644 |
21 |
--- a/eclass/toolchain-funcs.eclass |
22 |
+++ b/eclass/toolchain-funcs.eclass |
23 |
@@ -217,6 +217,65 @@ tc-cpp-is-true() { |
24 |
[[ ${RESULT} == true ]] |
25 |
} |
26 |
|
27 |
+# @FUNCTION: tc-detect-is-softfloat |
28 |
+# @RETURN: |
29 |
+# Shell true if (positive or negative) detection was possible, shell |
30 |
+# false otherwise. Also outputs a string when detection succeeds, see |
31 |
+# tc-is-softfloat for the possible values. |
32 |
+# @DESCRIPTION: |
33 |
+# Detect whether the CTARGET (or CHOST) toolchain is a softfloat based |
34 |
+# one by examining the toolchain's output, if possible. |
35 |
+tc-detect-is-softfloat() { |
36 |
+ # If fetching CPP falls back to the default (gcc -E) then fail |
37 |
+ # detection as this may not be the correct toolchain. |
38 |
+ [[ $(tc-getTARGET_CPP) == "gcc -E" ]] && return 1 |
39 |
+ |
40 |
+ case ${CTARGET:-${CHOST}} in |
41 |
+ # arm-unknown-linux-gnueabi is ambiguous. We used to treat it as |
42 |
+ # hardfloat but we now treat it as softfloat like most everyone |
43 |
+ # else. Check existing toolchains to respect existing systems. |
44 |
+ arm*) |
45 |
+ if tc-cpp-is-true "defined(__ARM_PCS_VFP)"; then |
46 |
+ echo "no" |
47 |
+ else |
48 |
+ # Confusingly __SOFTFP__ is defined only when |
49 |
+ # -mfloat-abi is soft, not softfp. |
50 |
+ if tc-cpp-is-true "defined(__SOFTFP__)"; then |
51 |
+ echo "yes" |
52 |
+ else |
53 |
+ echo "softfp" |
54 |
+ fi |
55 |
+ fi |
56 |
+ |
57 |
+ return 0 ;; |
58 |
+ *) |
59 |
+ return 1 ;; |
60 |
+ esac |
61 |
+} |
62 |
+ |
63 |
+# @FUNCTION: tc-tuple-is-softfloat |
64 |
+# @RETURN: See tc-is-softfloat for the possible values. |
65 |
+# @DESCRIPTION: |
66 |
+# Determine whether the CTARGET (or CHOST) toolchain is a softfloat |
67 |
+# based one solely from the tuple. |
68 |
+tc-tuple-is-softfloat() { |
69 |
+ local CTARGET=${CTARGET:-${CHOST}} |
70 |
+ case ${CTARGET//_/-} in |
71 |
+ bfin*|h8300*) |
72 |
+ echo "only" ;; |
73 |
+ *-softfloat-*) |
74 |
+ echo "yes" ;; |
75 |
+ *-softfp-*) |
76 |
+ echo "softfp" ;; |
77 |
+ arm*-hardfloat-*|arm*eabihf) |
78 |
+ echo "no" ;; |
79 |
+ arm*) |
80 |
+ echo "yes" ;; |
81 |
+ *) |
82 |
+ echo "no" ;; |
83 |
+ esac |
84 |
+} |
85 |
+ |
86 |
# @FUNCTION: tc-is-softfloat |
87 |
# @DESCRIPTION: |
88 |
# See if this toolchain is a softfloat based one. |
89 |
@@ -231,20 +290,7 @@ tc-cpp-is-true() { |
90 |
# softfloat flags in the case where support is optional, but |
91 |
# rejects softfloat flags where the target always lacks an fpu. |
92 |
tc-is-softfloat() { |
93 |
- local CTARGET=${CTARGET:-${CHOST}} |
94 |
- case ${CTARGET} in |
95 |
- bfin*|h8300*) |
96 |
- echo "only" ;; |
97 |
- *) |
98 |
- if [[ ${CTARGET//_/-} == *-softfloat-* ]] ; then |
99 |
- echo "yes" |
100 |
- elif [[ ${CTARGET//_/-} == *-softfp-* ]] ; then |
101 |
- echo "softfp" |
102 |
- else |
103 |
- echo "no" |
104 |
- fi |
105 |
- ;; |
106 |
- esac |
107 |
+ tc-detect-is-softfloat || tc-tuple-is-softfloat |
108 |
} |
109 |
|
110 |
# @FUNCTION: tc-is-static-only |
111 |
-- |
112 |
2.17.0 |