Gentoo Archives: gentoo-dev

From: Sergei Trofimovich <slyfox@g.o>
To: James Le Cuirot <chewi@g.o>
Cc: gentoo-dev@l.g.o, arm@g.o
Subject: Re: [gentoo-dev] [arm17] [PATCH] toolchain-funcs.eclass: Update tc-is-softfloat for new ARM triplets
Date: Tue, 24 Jul 2018 23:34:50
Message-Id: 20180725003416.49416d46@sf
In Reply to: [gentoo-dev] [arm17] [PATCH] toolchain-funcs.eclass: Update tc-is-softfloat for new ARM triplets by James Le Cuirot
1 On Wed, 25 Jul 2018 00:09:28 +0100
2 James Le Cuirot <chewi@g.o> wrote:
3
4 > The triplet will change from armv7a-hardfloat-linux-gnueabi to
5 > armv7a-unknown-linux-gnueabihf or similar. The function already
6 > treated the latter as hardfloat but ambiguous triplets such as
7 > arm-unknown-linux-gnueabi will change from hardfloat to softfloat in
8 > line with most everyone else. However, we will now check existing
9 > toolchains to avoid breaking existing systems, if possible.
10
11 [+arm@ CC]
12
13 1. This changelog is not clear if arm-unknown-linux-gnueabi will change
14 meaning in this commit.
15 2. Did Gentoo ever use arm-unknown-linux-gnueabi tuple? I don't see
16 it in recent profile history.
17 3. What are existing toolchain tuples? All the ones people use?
18
19 > ---
20 > eclass/toolchain-funcs.eclass | 39 ++++++++++++++++++++++++++++-------
21 > 1 file changed, 32 insertions(+), 7 deletions(-)
22 >
23 > diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
24 > index cea8949b45d7..f484fffc2664 100644
25 > --- a/eclass/toolchain-funcs.eclass
26 > +++ b/eclass/toolchain-funcs.eclass
27 > @@ -204,13 +204,38 @@ tc-is-softfloat() {
28 > bfin*|h8300*)
29 > echo "only" ;;
30 > *)
31 > - if [[ ${CTARGET//_/-} == *-softfloat-* ]] ; then
32 > - echo "yes"
33 > - elif [[ ${CTARGET//_/-} == *-softfp-* ]] ; then
34 > - echo "softfp"
35 > - else
36 > - echo "no"
37 > - fi
38 > + case ${CTARGET//_/-} in
39 > + *-softfloat-*)
40 > + echo "yes" ;;
41 > + *-softfp-*)
42 > + echo "softfp" ;;
43 > + arm*)
44 > + # arm-unknown-linux-gnueabi is ambiguous. We used to
45 > + # treat it as hardfloat but we now treat it as
46 > + # softfloat like most everyone else. However, we
47 > + # check existing toolchains to avoid breaking
48 > + # existing systems, if possible.
49 > + if type -P ${CTARGET}-cpp >/dev/null; then
50
51 I believe correct way to get cpp for target is
52 "$(tc-getCPP ${CTARGET}) -E"
53
54 > + if ${CTARGET}-cpp -E - <<< __ARM_PCS_VFP 2>/dev/null | grep -q __ARM_PCS_VFP; then
55
56 4. This magic is hard to follow and reason about.
57 I suggest moving out autodetection of current setup into another helper.
58 Bonus point for detection of mismatch of actual vs. intended state.
59
60 Then we could start warning users about the fact of inconsistency and point
61 to migration procedure. And we could have cleaner ${CTARGET} matches against
62 what Gentoo expects.
63
64 5. you don't use ${CFLAGS} here. I feel we should use them as people do occasionally
65 override defaults.
66
67 > + # Confusingly __SOFTFP__ is defined only
68 > + # when -mfloat-abi is soft, not softfp.
69 > + if ${CTARGET}-cpp -E - <<< __SOFTFP__ 2>/dev/null | grep -q __SOFTFP__; then
70 > + echo "softfp"
71 > + else
72 > + echo "yes"
73 > + fi
74 > + else
75 > + echo "no"
76 > + fi
77 > + elif [[ ${CTARGET} == *-hardfloat-* || ${CTARGET} == *hf ]]; then
78
79 I suggest using *-gnueabihf. I don't think anything more generic is recognized by toolchains
80 as a hardfloat target.
81
82 Also please link to description of what you think canonical hardfloat tuples are supposed to
83 be. Upstreams do not agree on the definition.
84
85 > + echo "no"
86 > + else
87 > + echo "yes"
88 > + fi
89 > + ;;
90 > + *)
91 > + echo "no" ;;
92 > + esac
93 > ;;
94 > esac
95 > }
96 > --
97 > 2.17.0
98 >
99 >
100
101
102 --
103
104 Sergei

Replies