commit:     976ef028d3a1c18cfa64f3880a8a2754da35afea
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 11 14:59:37 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 11 15:01:57 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=976ef028

multilib*.eclass: Add support for rv32 abi

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 eclass/multilib-build.eclass | 14 +++++++++++---
 eclass/multilib.eclass       | 30 +++++++++++++++++++++++++++---
 2 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index 620bdcedce5..dc4f8a2bd15 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -49,6 +49,8 @@ _MULTILIB_FLAGS=(
 #      abi_ppc_64:ppc64
        abi_riscv_lp64d:lp64d
        abi_riscv_lp64:lp64
+       abi_riscv_ilp32d:ilp32d
+       abi_riscv_ilp32:ilp32
        abi_s390_32:s390
        abi_s390_64:s390x
 )
@@ -492,12 +494,18 @@ multilib_prepare_wrappers() {
 #              error "abi_mips_o32 not supported by the package."
 #      endif
 #elif defined(__riscv)
-#      if defined(__riscv_float_abi_double)
+#      if (__WORDSIZE == 64) && defined(__riscv_float_abi_double)
 #              error "abi_riscv_lp64d not supported by the package."
-#      elif defined(__riscv_float_abi_single)
+#      elif (__WORDSIZE == 64) && defined(__riscv_float_abi_single)
 #              error "abi_riscv_lp64f not supported by the package."
-#      else
+#      elif (__WORDSIZE == 64)
 #              error "abi_riscv_lp64 not supported by the package."
+#      elif (__WORDSIZE == 32) && defined(__riscv_float_abi_double)
+#              error "abi_riscv_ilp32d not supported by the package."
+#      elif (__WORDSIZE == 32) && defined(__riscv_float_abi_single)
+#              error "abi_riscv_ilp32f not supported by the package."
+#      else
+#              error "abi_riscv_ilp32 not supported by the package."
 #      endif
 #elif defined(__sparc__)
 #      if defined(__arch64__)

diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass
index 342d21a2e1c..9c7042fcd29 100644
--- a/eclass/multilib.eclass
+++ b/eclass/multilib.eclass
@@ -397,19 +397,43 @@ multilib_env() {
                        : ${DEFAULT_ABI=ppc64}
                ;;
                riscv64*)
-                       export CFLAGS_lp64d=${CFLAGS_lp64d--mabi=lp64d}
+                       export CFLAGS_lp64d=${CFLAGS_lp64d--mabi=lp64d 
-march=rv64imafdc}
                        export CHOST_lp64d=${CTARGET}
                        export CTARGET_lp64d=${CTARGET}
                        export LIBDIR_lp64d="lib64/lp64d"
 
-                       export CFLAGS_lp64=${CFLAGS_lp64--mabi=lp64}
+                       export CFLAGS_lp64=${CFLAGS_lp64--mabi=lp64 
-march=rv64imac}
                        export CHOST_lp64=${CTARGET}
                        export CTARGET_lp64=${CTARGET}
                        export LIBDIR_lp64="lib64/lp64"
 
-                       : ${MULTILIB_ABIS=lp64d lp64}
+                       export CFLAGS_ilp32d=${CFLAGS_ilp32d--mabi=ilp32d 
-march=rv32imafdc}
+                       export CHOST_ilp32d=${CTARGET/riscv64/riscv32}
+                       export CTARGET_ilp32d=${CTARGET/riscv64/riscv32}
+                       export LIBDIR_ilp32d="lib32/ilp32d"
+
+                       export CFLAGS_ilp32=${CFLAGS_ilp32--mabi=ilp32 
-march=rv32imac}
+                       export CHOST_ilp32=${CTARGET/riscv64/riscv32}
+                       export CTARGET_ilp32=${CTARGET/riscv64/riscv32}
+                       export LIBDIR_ilp32="lib32/ilp32"
+
+                       : ${MULTILIB_ABIS=lp64d lp64 ilp32d ilp32}
                        : ${DEFAULT_ABI=lp64d}
                ;;
+               riscv32*)
+                       export CFLAGS_ilp32d=${CFLAGS_ilp32d--mabi=ilp32d}
+                       export CHOST_ilp32d=${CTARGET}
+                       export CTARGET_ilp32d=${CTARGET}
+                       export LIBDIR_ilp32d="lib32/ilp32d"
+
+                       export CFLAGS_ilp32=${CFLAGS_ilp32--mabi=ilp32 
-march=rv32imac}
+                       export CHOST_ilp32=${CTARGET}
+                       export CTARGET_ilp32=${CTARGET}
+                       export LIBDIR_ilp32="lib32/ilp32"
+
+                       : ${MULTILIB_ABIS=ilp32d ilp32}
+                       : ${DEFAULT_ABI=ilp32d}
+               ;;
                s390x*)
                        export CFLAGS_s390=${CFLAGS_s390--m31} # the 31 is not 
a typo
                        export CHOST_s390=${CTARGET/s390x/s390}

Reply via email to