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....@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


Reply via email to