Gentoo Archives: gentoo-dev

From: Sergei Trofimovich <slyfox@g.o>
To: fedora.dm0@×××××.com
Cc: gentoo-dev@l.g.o, toolchain@g.o
Subject: Re: [gentoo-dev] [PATCH] toolchain-funcs.eclass: include riscv bitness in tc-arch
Date: Mon, 03 May 2021 08:41:27
Message-Id: 20210503094116.3889bf7f@sf
In Reply to: [gentoo-dev] [PATCH] toolchain-funcs.eclass: include riscv bitness in tc-arch by fedora.dm0@gmail.com
1 On Sun, 02 May 2021 18:22:43 -0400
2 fedora.dm0@×××××.com wrote:
3
4 > This makes tc-arch identify RISC-V systems as either "riscv64" or
5 > "riscv32". It will still return "riscv" for the kernel arch or if
6 > bitness is not given in the host triplet.
7
8 tc-arch returns portage's ARCH= value based on passed tuple.
9 There are no ARCH=riscv32 or ARCH=riscv64 in Gentoo. Only ARCH=riscv.
10
11 You probably need to map gentoo's ABI USE to upstream's ABI flag.
12 But it's not clear from your description what effect you intend to achieve.
13
14 > This fixes the expected values of cpu_family in meson projects:
15 > https://mesonbuild.com/Reference-tables.html#cpu-families
16
17 I'm not sure what meson's `cpu_family` is. Is it something that should
18 affect -march=/-mabi=? Please state your intent explicitly. The fix does
19 not look correct.
20
21 > Signed-off-by: David Michael <fedora.dm0@×××××.com>
22 > ---
23 >
24 > Hi,
25 >
26 > When building systemd from Git, it now relies on the "stable" cpu_family
27 > value for riscv64[0]. Meson gets this value from tc-arch. From a quick
28 > grep, it looked like the only place that compared tc-arch output with
29 > "riscv" was toolchain.eclass, but there may be some other subtle issue I
30 > haven't encountered. Does this look okay to apply?
31 >
32 > Thanks.
33 >
34 > David
35 >
36 > [0] https://github.com/systemd/systemd/commit/a00ff2e1b596f0d08d32b8ca9cefe8aca1212604
37 >
38 > eclass/toolchain-funcs.eclass | 10 +++++++++-
39 > eclass/toolchain.eclass | 2 +-
40 > 2 files changed, 10 insertions(+), 2 deletions(-)
41 >
42 > diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
43 > index 267cf5cfce3..5dd6dcbd658 100644
44 > --- a/eclass/toolchain-funcs.eclass
45 > +++ b/eclass/toolchain-funcs.eclass
46 > @@ -687,7 +687,15 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
47 > echo ppc
48 > fi
49 > ;;
50 > - riscv*) echo riscv;;
51 > + riscv*)
52 > + if [[ ${type} != "kern" && ${host} == riscv32* ]] ; then
53 > + echo riscv32
54 > + elif [[ ${type} != "kern" && ${host} == riscv64* ]] ; then
55 > + echo riscv64
56 > + else
57 > + echo riscv
58 > + fi
59 > + ;;
60 > s390*) echo s390;;
61 > score*) echo score;;
62 > sh64*) ninj sh64 sh;;
63 > diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
64 > index f41ce22c591..b1d2e671917 100644
65 > --- a/eclass/toolchain.eclass
66 > +++ b/eclass/toolchain.eclass
67 > @@ -1084,7 +1084,7 @@ toolchain_src_configure() {
68 > # https://gcc.gnu.org/PR93157
69 > [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 )
70 > ;;
71 > - riscv)
72 > + riscv*)
73 > # Add --with-abi flags to set default ABI
74 > confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
75 > ;;
76 > --
77 > 2.26.3
78 >
79 >
80
81
82 --
83
84 Sergei

Replies

Subject Author
Re: [gentoo-dev] [PATCH] toolchain-funcs.eclass: include riscv bitness in tc-arch David Michael <fedora.dm0@×××××.com>