public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-dev] [PATCH] toolchain-funcs.eclass: include riscv bitness in tc-arch
@ 2021-05-02 22:22 99% fedora.dm0
  0 siblings, 0 replies; 1+ results
From: fedora.dm0 @ 2021-05-02 22:22 UTC (permalink / raw
  To: gentoo-dev; +Cc: toolchain

This makes tc-arch identify RISC-V systems as either "riscv64" or
"riscv32".  It will still return "riscv" for the kernel arch or if
bitness is not given in the host triplet.

This fixes the expected values of cpu_family in meson projects:
https://mesonbuild.com/Reference-tables.html#cpu-families

Signed-off-by: David Michael <fedora.dm0@gmail.com>
---

Hi,

When building systemd from Git, it now relies on the "stable" cpu_family
value for riscv64[0].  Meson gets this value from tc-arch.  From a quick
grep, it looked like the only place that compared tc-arch output with
"riscv" was toolchain.eclass, but there may be some other subtle issue I
haven't encountered.  Does this look okay to apply?

Thanks.

David

[0] https://github.com/systemd/systemd/commit/a00ff2e1b596f0d08d32b8ca9cefe8aca1212604

 eclass/toolchain-funcs.eclass | 10 +++++++++-
 eclass/toolchain.eclass       |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 267cf5cfce3..5dd6dcbd658 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -687,7 +687,15 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
 				echo ppc
 			fi
 			;;
-		riscv*)		echo riscv;;
+		riscv*)
+			if [[ ${type} != "kern" && ${host} == riscv32* ]] ; then
+				echo riscv32
+			elif [[ ${type} != "kern" && ${host} == riscv64* ]] ; then
+				echo riscv64
+			else
+				echo riscv
+			fi
+			;;
 		s390*)		echo s390;;
 		score*)		echo score;;
 		sh64*)		ninj sh64 sh;;
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index f41ce22c591..b1d2e671917 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1084,7 +1084,7 @@ toolchain_src_configure() {
 		# https://gcc.gnu.org/PR93157
 		[[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 )
 		;;
-	riscv)
+	riscv*)
 		# Add --with-abi flags to set default ABI
 		confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
 		;;
-- 
2.26.3



^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-05-02 22:22 99% [gentoo-dev] [PATCH] toolchain-funcs.eclass: include riscv bitness in tc-arch fedora.dm0

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox