Gentoo Archives: gentoo-dev

From: James Le Cuirot <chewi@g.o>
To:
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: Wed, 25 Jul 2018 22:19:34
Message-Id: 20180725231913.1acb1477@symphony.aura-online.co.uk
In Reply to: Re: [gentoo-dev] [arm17] [PATCH] toolchain-funcs.eclass: Update tc-is-softfloat for new ARM triplets by Sergei Trofimovich
1 On Wed, 25 Jul 2018 00:34:16 +0100
2 Sergei Trofimovich <slyfox@g.o> wrote:
3
4 > On Wed, 25 Jul 2018 00:09:28 +0100
5 > James Le Cuirot <chewi@g.o> wrote:
6 >
7 > > The triplet will change from armv7a-hardfloat-linux-gnueabi to
8 > > armv7a-unknown-linux-gnueabihf or similar. The function already
9 > > treated the latter as hardfloat but ambiguous triplets such as
10 > > arm-unknown-linux-gnueabi will change from hardfloat to softfloat in
11 > > line with most everyone else. However, we will now check existing
12 > > toolchains to avoid breaking existing systems, if possible.
13 >
14 > [+arm@ CC]
15
16 I had intended for most of the information to go into the news item but
17 I guess this commit message is the best place for additional background
18 information that may not concern the users so I'll beef it up a bit.
19
20 > 1. This changelog is not clear if arm-unknown-linux-gnueabi will
21 > change meaning in this commit.
22
23 Agreed, the wording could be clearer, I will improve it. I was also
24 partly wrong because although tc-is-softfloat did consider
25 arm-unknown-linux-gnueabi to be hardfloat, toolchain.eclass applies
26 the additional armv[67]* condition. The example you gave on IRC was
27 armv7a-unknown-linux-gnueabi so I will mention that instead.
28
29 > 2. Did Gentoo ever use arm-unknown-linux-gnueabi tuple? I don't see
30 > it in recent profile history.
31
32 This was wrong as per above but armv7a-unknown-linux-gnueabi was never
33 used either. However, crossdev expands arm to arm-unknown-linux-gnueabi.
34 17.0/musl also defaults to arm-unknown-linux-musleabi. I'm just trying
35 to cover all the bases. :)
36
37 > 3. What are existing toolchain tuples? All the ones people use?
38
39 Yes. Who knows what's out there? ;) I'll clarify that
40
41 > > ---
42 > > eclass/toolchain-funcs.eclass | 39 ++++++++++++++++++++++++++++-------
43 > > 1 file changed, 32 insertions(+), 7 deletions(-)
44 > >
45 > > diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
46 > > index cea8949b45d7..f484fffc2664 100644
47 > > --- a/eclass/toolchain-funcs.eclass
48 > > +++ b/eclass/toolchain-funcs.eclass
49 > > @@ -204,13 +204,38 @@ tc-is-softfloat() {
50 > > bfin*|h8300*)
51 > > echo "only" ;;
52 > > *)
53 > > - if [[ ${CTARGET//_/-} == *-softfloat-* ]] ; then
54 > > - echo "yes"
55 > > - elif [[ ${CTARGET//_/-} == *-softfp-* ]] ; then
56 > > - echo "softfp"
57 > > - else
58 > > - echo "no"
59 > > - fi
60 > > + case ${CTARGET//_/-} in
61 > > + *-softfloat-*)
62 > > + echo "yes" ;;
63 > > + *-softfp-*)
64 > > + echo "softfp" ;;
65 > > + arm*)
66 > > + # arm-unknown-linux-gnueabi is ambiguous. We used to
67 > > + # treat it as hardfloat but we now treat it as
68 > > + # softfloat like most everyone else. However, we
69 > > + # check existing toolchains to avoid breaking
70 > > + # existing systems, if possible.
71 > > + if type -P ${CTARGET}-cpp >/dev/null; then
72 >
73 > I believe correct way to get cpp for target is
74 > "$(tc-getCPP ${CTARGET}) -E"
75
76 Good point. I was initially concerned about Clang but I guess we want
77 this to work the same way under Clang and apparently it does define the
78 same macros.
79
80 > > + if ${CTARGET}-cpp -E - <<< __ARM_PCS_VFP 2>/dev/null | grep -q __ARM_PCS_VFP; then
81 >
82 > 4. This magic is hard to follow and reason about.
83 > I suggest moving out autodetection of current setup into another helper.
84 > Bonus point for detection of mismatch of actual vs. intended state.
85
86 Fair enough, it managed to confused mgorny. ;)
87
88 > Then we could start warning users about the fact of inconsistency and point
89 > to migration procedure. And we could have cleaner ${CTARGET} matches against
90 > what Gentoo expects.
91
92 Not sure about this. As I've said, I don't want to force users to
93 migrate. Would a warning be too annoying?
94
95 > 5. you don't use ${CFLAGS} here. I feel we should use them as people do occasionally
96 > override defaults.
97
98 I considered it but can we reliably get the flags for CTARGET?
99
100 > > + # Confusingly __SOFTFP__ is defined only
101 > > + # when -mfloat-abi is soft, not softfp.
102 > > + if ${CTARGET}-cpp -E - <<< __SOFTFP__ 2>/dev/null | grep -q __SOFTFP__; then
103 > > + echo "softfp"
104 > > + else
105 > > + echo "yes"
106 > > + fi
107 > > + else
108 > > + echo "no"
109 > > + fi
110 > > + elif [[ ${CTARGET} == *-hardfloat-* || ${CTARGET} == *hf ]]; then
111 >
112 > I suggest using *-gnueabihf. I don't think anything more generic is recognized by toolchains
113 > as a hardfloat target.
114
115 There is also musleabihf and uclibceabihf. Would *eabihf be better?
116
117 > Also please link to description of what you think canonical hardfloat tuples are supposed to
118 > be. Upstreams do not agree on the definition.
119
120 I thought this was basically dictated by our profiles but okay.
121
122 > > + echo "no"
123 > > + else
124 > > + echo "yes"
125 > > + fi
126 > > + ;;
127 > > + *)
128 > > + echo "no" ;;
129 > > + esac
130 > > ;;
131 > > esac
132 > > }
133 > > --
134 > > 2.17.0
135
136 --
137 James Le Cuirot (chewi)
138 Gentoo Linux Developer

Replies