Gentoo Archives: gentoo-dev

From: fedora.dm0@×××××.com
To: gentoo-dev@l.g.o
Cc: toolchain@g.o
Subject: [gentoo-dev] [PATCH] toolchain-funcs.eclass: include riscv bitness in tc-arch
Date: Sun, 02 May 2021 22:22:48
Message-Id: 871raog4i4.fsf@gmail.com
1 This makes tc-arch identify RISC-V systems as either "riscv64" or
2 "riscv32". It will still return "riscv" for the kernel arch or if
3 bitness is not given in the host triplet.
4
5 This fixes the expected values of cpu_family in meson projects:
6 https://mesonbuild.com/Reference-tables.html#cpu-families
7
8 Signed-off-by: David Michael <fedora.dm0@×××××.com>
9 ---
10
11 Hi,
12
13 When building systemd from Git, it now relies on the "stable" cpu_family
14 value for riscv64[0]. Meson gets this value from tc-arch. From a quick
15 grep, it looked like the only place that compared tc-arch output with
16 "riscv" was toolchain.eclass, but there may be some other subtle issue I
17 haven't encountered. Does this look okay to apply?
18
19 Thanks.
20
21 David
22
23 [0] https://github.com/systemd/systemd/commit/a00ff2e1b596f0d08d32b8ca9cefe8aca1212604
24
25 eclass/toolchain-funcs.eclass | 10 +++++++++-
26 eclass/toolchain.eclass | 2 +-
27 2 files changed, 10 insertions(+), 2 deletions(-)
28
29 diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
30 index 267cf5cfce3..5dd6dcbd658 100644
31 --- a/eclass/toolchain-funcs.eclass
32 +++ b/eclass/toolchain-funcs.eclass
33 @@ -687,7 +687,15 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
34 echo ppc
35 fi
36 ;;
37 - riscv*) echo riscv;;
38 + riscv*)
39 + if [[ ${type} != "kern" && ${host} == riscv32* ]] ; then
40 + echo riscv32
41 + elif [[ ${type} != "kern" && ${host} == riscv64* ]] ; then
42 + echo riscv64
43 + else
44 + echo riscv
45 + fi
46 + ;;
47 s390*) echo s390;;
48 score*) echo score;;
49 sh64*) ninj sh64 sh;;
50 diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
51 index f41ce22c591..b1d2e671917 100644
52 --- a/eclass/toolchain.eclass
53 +++ b/eclass/toolchain.eclass
54 @@ -1084,7 +1084,7 @@ toolchain_src_configure() {
55 # https://gcc.gnu.org/PR93157
56 [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 )
57 ;;
58 - riscv)
59 + riscv*)
60 # Add --with-abi flags to set default ABI
61 confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
62 ;;
63 --
64 2.26.3

Replies