On Sun, 02 May 2021 18:22:43 -0400
fedora....@gmail.com wrote:

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

tc-arch returns portage's ARCH= value based on passed tuple.
There are no ARCH=riscv32 or ARCH=riscv64 in Gentoo. Only ARCH=riscv.

You probably need to map gentoo's ABI USE to upstream's ABI flag.
But it's not clear from your description what effect you intend to achieve.

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

I'm not sure what meson's `cpu_family` is. Is it something that should
affect -march=/-mabi=? Please state your intent explicitly. The fix does
not look correct.

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


-- 

  Sergei

Reply via email to