diff options
author | Zong Li <zongbox@gmail.com> | 2018-11-30 17:18:00 +0800 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2020-08-27 08:17:43 -0700 |
commit | 72dfddeffcc993a726bdcbe5e515afa1180095e8 (patch) | |
tree | c164b32b945df48e74ad88e1f4e539bd44a4b5de /sysdeps/unix/sysv | |
parent | 30b963c143eaa07f09567f2e0649edb7525c43fd (diff) | |
download | glibc-72dfddeffcc993a726bdcbe5e515afa1180095e8.tar.gz glibc-72dfddeffcc993a726bdcbe5e515afa1180095e8.tar.xz glibc-72dfddeffcc993a726bdcbe5e515afa1180095e8.zip |
RISC-V: Build infrastructure for 32-bit port
This patch lays out the top-level organisation of the RISC-V 32-bit port. It provides all the Implies files as well as various other fragments of the build infrastructure. Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r-- | sysdeps/unix/sysv/linux/riscv/Makefile | 8 | ||||
-rwxr-xr-x | sysdeps/unix/sysv/linux/riscv/configure | 39 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/riscv/configure.ac | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/riscv/rv32/Implies | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/riscv/shlib-versions | 10 |
5 files changed, 63 insertions, 5 deletions
diff --git a/sysdeps/unix/sysv/linux/riscv/Makefile b/sysdeps/unix/sysv/linux/riscv/Makefile index 301b082398..4b6eacb32f 100644 --- a/sysdeps/unix/sysv/linux/riscv/Makefile +++ b/sysdeps/unix/sysv/linux/riscv/Makefile @@ -7,11 +7,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-lp64-condition := defined __LP64__ && defined __riscv_float_abi_soft -abi-lp64d-condition := defined __LP64__ && defined __riscv_float_abi_double +abi-ilp32-condition := __WORDSIZE == 32 && defined __riscv_float_abi_soft +abi-ilp32d-condition := __WORDSIZE == 32 && defined __riscv_float_abi_double +abi-lp64-condition := __WORDSIZE == 64 && defined __riscv_float_abi_soft +abi-lp64d-condition := __WORDSIZE == 64 && defined __riscv_float_abi_double diff --git a/sysdeps/unix/sysv/linux/riscv/configure b/sysdeps/unix/sysv/linux/riscv/configure index de3bb62003..33139618e7 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 @@ -218,6 +229,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 0f7596502b..9c736415f7 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 @@ -37,6 +39,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 0000000000..8b7deb33cd --- /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 98c9b29cc4..e8a7be7313 100644 --- a/sysdeps/unix/sysv/linux/riscv/shlib-versions +++ b/sysdeps/unix/sysv/linux/riscv/shlib-versions @@ -1,9 +1,15 @@ -DEFAULT GLIBC_2.27 - %if RISCV_ABI_XLEN == 64 && RISCV_ABI_FLEN == 64 +DEFAULT GLIBC_2.27 ld=ld-linux-riscv64-lp64d.so.1 %elif RISCV_ABI_XLEN == 64 && RISCV_ABI_FLEN == 0 +DEFAULT GLIBC_2.27 ld=ld-linux-riscv64-lp64.so.1 +%elif RISCV_ABI_XLEN == 32 && RISCV_ABI_FLEN == 64 +DEFAULT GLIBC_2.33 +ld=ld-linux-riscv32-ilp32d.so.1 +%elif RISCV_ABI_XLEN == 32 && RISCV_ABI_FLEN == 0 +DEFAULT GLIBC_2.33 +ld=ld-linux-riscv32-ilp32.so.1 %else %error cannot determine ABI %endif |