From: Zong Li <zong@andestech.com>
To: <joseph@codesourcery.com>, <libc-alpha@sourceware.org>,
<palmer@dabbelt.com>, <darius@bluespec.com>, <andrew@sifive.com>,
<dj@redhat.com>
Cc: <zongbox@gmail.com>, Zong Li <zong@andestech.com>
Subject: [PATCH 8/9] RISC-V: Build Infastructure for the 32 bit
Date: Thu, 12 Jul 2018 10:27:00 -0000 [thread overview]
Message-ID: <b86a591054c6316d5cebb934ddd75d11fea0fa5a.1531384754.git.zong@andestech.com> (raw)
In-Reply-To: <cover.1531384753.git.zong@andestech.com>
Add build infastructure for RV32I, RV32IF and RV32ID.
---
sysdeps/riscv/preconfigure | 6 +----
sysdeps/riscv/rv32/Implies-after | 1 +
sysdeps/riscv/rv32/rvd/Implies | 3 +++
sysdeps/riscv/rv32/rvf/Implies | 1 +
sysdeps/unix/sysv/linux/riscv/Makefile | 4 ++-
sysdeps/unix/sysv/linux/riscv/configure | 39 ++++++++++++++++++++++++++++
sysdeps/unix/sysv/linux/riscv/configure.ac | 8 ++++++
sysdeps/unix/sysv/linux/riscv/rv32/Implies | 3 +++
sysdeps/unix/sysv/linux/riscv/shlib-versions | 4 +++
9 files changed, 63 insertions(+), 6 deletions(-)
create mode 100644 sysdeps/riscv/rv32/Implies-after
create mode 100644 sysdeps/riscv/rv32/rvd/Implies
create mode 100644 sysdeps/riscv/rv32/rvf/Implies
create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/Implies
diff --git a/sysdeps/riscv/preconfigure b/sysdeps/riscv/preconfigure
index d9adb31..1ab5d20 100644
--- a/sysdeps/riscv/preconfigure
+++ b/sysdeps/riscv/preconfigure
@@ -6,11 +6,7 @@ riscv*)
atomic=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | grep '#define __riscv_atomic' | cut -d' ' -f2`
case "$xlen" in
- 32)
- echo "glibc does not yet support 32-bit systems" >&2
- exit 1
- ;;
- 64)
+ 64 | 32)
;;
*)
echo "Unable to determine XLEN" >&2
diff --git a/sysdeps/riscv/rv32/Implies-after b/sysdeps/riscv/rv32/Implies-after
new file mode 100644
index 0000000..39a34c5
--- /dev/null
+++ b/sysdeps/riscv/rv32/Implies-after
@@ -0,0 +1 @@
+wordsize-32
diff --git a/sysdeps/riscv/rv32/rvd/Implies b/sysdeps/riscv/rv32/rvd/Implies
new file mode 100644
index 0000000..1151214
--- /dev/null
+++ b/sysdeps/riscv/rv32/rvd/Implies
@@ -0,0 +1,3 @@
+riscv/rv32/rvf
+riscv/rvd
+riscv/rvf
diff --git a/sysdeps/riscv/rv32/rvf/Implies b/sysdeps/riscv/rv32/rvf/Implies
new file mode 100644
index 0000000..66c4014
--- /dev/null
+++ b/sysdeps/riscv/rv32/rvf/Implies
@@ -0,0 +1 @@
+riscv/rvf
diff --git a/sysdeps/unix/sysv/linux/riscv/Makefile b/sysdeps/unix/sysv/linux/riscv/Makefile
index b478587..bf9c24a 100644
--- a/sysdeps/unix/sysv/linux/riscv/Makefile
+++ b/sysdeps/unix/sysv/linux/riscv/Makefile
@@ -15,11 +15,13 @@ ifeq ($(subdir),stdlib)
gen-as-const-headers += ucontext_i.sym
endif
-abi-variants := lp64 lp64d
+abi-variants := ilp32 ilp32d lp64 lp64d
ifeq (,$(filter $(default-abi),$(abi-variants)))
$(error Unknown ABI $(default-abi), must be one of $(abi-variants))
endif
+abi-ilp32-condition := !defined __LP64__ && defined __riscv_float_abi_soft
+abi-ilp32d-condition := !defined __LP64__ && defined __riscv_float_abi_double
abi-lp64-condition := defined __LP64__ && defined __riscv_float_abi_soft
abi-lp64d-condition := defined __LP64__ && defined __riscv_float_abi_double
diff --git a/sysdeps/unix/sysv/linux/riscv/configure b/sysdeps/unix/sysv/linux/riscv/configure
index 816e9145..3edd5f2 100755
--- a/sysdeps/unix/sysv/linux/riscv/configure
+++ b/sysdeps/unix/sysv/linux/riscv/configure
@@ -147,6 +147,17 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
fi
rm -f conftest*
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+__SIZEOF_INT__ __SIZEOF_LONG__ __SIZEOF_POINTER__
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "4 4 4" >/dev/null 2>&1; then :
+ libc_cv_riscv_int_abi=ilp32
+fi
+rm -f conftest*
+
if test $libc_cv_riscv_int_abi = no; then
as_fn_error $? "Unable to determine integer ABI" "$LINENO" 5
fi
@@ -214,6 +225,34 @@ case "$prefix" in
;;
esac
;;
+ilp32-riscv/rv32/*)
+ test -n "$libc_cv_slibdir" ||
+case "$prefix" in
+/usr | /usr/)
+ libc_cv_slibdir='/lib32/ilp32'
+ libc_cv_rtlddir='/lib'
+ if test "$libdir" = '${exec_prefix}/lib'; then
+ libdir='${exec_prefix}/lib32/ilp32';
+ # Locale data can be shared between 32-bit and 64-bit libraries.
+ libc_cv_complocaledir='${exec_prefix}/lib/locale'
+ fi
+ ;;
+esac
+ ;;
+ilp32d-riscv/rv32/*)
+ test -n "$libc_cv_slibdir" ||
+case "$prefix" in
+/usr | /usr/)
+ libc_cv_slibdir='/lib32/ilp32d'
+ libc_cv_rtlddir='/lib'
+ if test "$libdir" = '${exec_prefix}/lib'; then
+ libdir='${exec_prefix}/lib32/ilp32d';
+ # Locale data can be shared between 32-bit and 64-bit libraries.
+ libc_cv_complocaledir='${exec_prefix}/lib/locale'
+ fi
+ ;;
+esac
+ ;;
esac
ldd_rewrite_script=sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/riscv/configure.ac b/sysdeps/unix/sysv/linux/riscv/configure.ac
index 4fae013..d4682fc 100644
--- a/sysdeps/unix/sysv/linux/riscv/configure.ac
+++ b/sysdeps/unix/sysv/linux/riscv/configure.ac
@@ -7,6 +7,8 @@ arch_minimum_kernel=4.15.0
libc_cv_riscv_int_abi=no
AC_EGREP_CPP(4 8 8, [__SIZEOF_INT__ __SIZEOF_LONG__ __SIZEOF_POINTER__
], libc_cv_riscv_int_abi=lp64)
+AC_EGREP_CPP(4 4 4, [__SIZEOF_INT__ __SIZEOF_LONG__ __SIZEOF_POINTER__
+ ], libc_cv_riscv_int_abi=ilp32)
if test $libc_cv_riscv_int_abi = no; then
AC_MSG_ERROR([Unable to determine integer ABI])
fi
@@ -33,6 +35,12 @@ lp64-riscv/rv64/*)
lp64d-riscv/rv64/*)
LIBC_SLIBDIR_RTLDDIR([lib64/lp64d], [lib])
;;
+ilp32-riscv/rv32/*)
+ LIBC_SLIBDIR_RTLDDIR([lib32/ilp32], [lib])
+ ;;
+ilp32d-riscv/rv32/*)
+ LIBC_SLIBDIR_RTLDDIR([lib32/ilp32d], [lib])
+ ;;
esac
ldd_rewrite_script=sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/Implies b/sysdeps/unix/sysv/linux/riscv/rv32/Implies
new file mode 100644
index 0000000..8b7deb3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/Implies
@@ -0,0 +1,3 @@
+unix/sysv/linux/riscv
+unix/sysv/linux/generic/wordsize-32
+unix/sysv/linux/generic
diff --git a/sysdeps/unix/sysv/linux/riscv/shlib-versions b/sysdeps/unix/sysv/linux/riscv/shlib-versions
index 98c9b29..1d2561e 100644
--- a/sysdeps/unix/sysv/linux/riscv/shlib-versions
+++ b/sysdeps/unix/sysv/linux/riscv/shlib-versions
@@ -4,6 +4,10 @@ DEFAULT GLIBC_2.27
ld=ld-linux-riscv64-lp64d.so.1
%elif RISCV_ABI_XLEN == 64 && RISCV_ABI_FLEN == 0
ld=ld-linux-riscv64-lp64.so.1
+%elif RISCV_ABI_XLEN == 32 && RISCV_ABI_FLEN == 64
+ld=ld-linux-riscv32-ilp32d.so.1
+%elif RISCV_ABI_XLEN == 32 && RISCV_ABI_FLEN == 0
+ld=ld-linux-riscv32-ilp32.so.1
%else
%error cannot determine ABI
%endif
--
2.7.4
next prev parent reply other threads:[~2018-07-12 10:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-12 10:27 [PATCH 0/9] RISC-V glibc port " Zong Li
2018-07-12 10:27 ` Zong Li [this message]
2018-07-12 10:27 ` [PATCH 9/9] Add 32 bit RISC-V to build-many-glibcs.py Zong Li
2018-07-12 10:27 ` [PATCH 5/9] RISC-V: Hard float support for the 32 bit Zong Li
2018-07-12 10:27 ` [PATCH 1/9] Documentation for the 32 bit RISC-V port Zong Li
2018-07-12 10:27 ` [PATCH 4/9] RISC-V: The ABI implementation for the 32-bit Zong Li
2018-07-12 10:27 ` [PATCH 2/9] RISC-V: Add dynamic loader for the 32 bit Zong Li
2018-07-12 10:27 ` [PATCH 6/9] RISC-V: Split the soft-fp into rv32 and rv64 Zong Li
2018-07-12 17:46 ` Richard Henderson
2018-07-13 1:00 ` Zong Li
2018-07-13 10:34 ` Richard Henderson
2018-07-13 13:19 ` Zong Li
2018-07-13 13:49 ` Richard Henderson
2018-07-13 13:55 ` Zong Li
2018-07-12 10:27 ` [PATCH 3/9] RISC-V: Add path of library directories for the 32 bit Zong Li
2018-07-12 10:28 ` [PATCH 7/9] RISC-V: Add ABI lists Zong Li
2018-07-31 18:49 ` [PATCH 0/9] RISC-V glibc port for the 32 bit Jim Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b86a591054c6316d5cebb934ddd75d11fea0fa5a.1531384754.git.zong@andestech.com \
--to=zong@andestech.com \
--cc=andrew@sifive.com \
--cc=darius@bluespec.com \
--cc=dj@redhat.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=palmer@dabbelt.com \
--cc=zongbox@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).