From patchwork Thu Aug 29 16:50:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 34345 Received: (qmail 5860 invoked by alias); 29 Aug 2019 16:55:01 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 5713 invoked by uid 89); 29 Aug 2019 16:55:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=exec_prefix X-HELO: esa4.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1567097699; x=1598633699; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zzorcxKqcwkBiGCFvo7r9CAPx9o4r329vLlRd/YmQcQ=; b=PUPkh30mpbLWsYS6kqzP+6kJ4w3f8VkkVnxIOSjMvsHPJlkAgvJkWQZy 0KsHMrbxhJ7lDAi7ATvLttI5EY+RSWwkcg9YCnFu5hrOX9YSzyBpcp0cB 33XpFwwiwCS4SJFiLjt/8YrRNXgujRT8A+z7qmIxXJ7f9eiv08HEiltx/ +Gga58uX7Mh25PP1fS2SRk70g9OlPczGLjYXVDb2cK1GfLAi1mQ/LSqp9 wx3y1gB5A0lYjuBvjg/+1DAECfIrY/eZnaIqkcnJZRDz+BZmgoF7g1NCt lUKbk9gjLr3E1vEFJReM96WjQ6CQx9IdlZTw28jTzPCspa4VZTBbm+K7g w==; IronPort-SDR: HXSrYpQBKwzt5LAdRLVGXAniatD5P5xTnIfkRowLjRu5/n4ATb3B5xk+aV24ru0JAz+girqAGf 9MMJAJSggJm5QCPi8kee+rLa6NoMs86N+k+lWHNEz+bzpOxy6B+3GC+z2cW2/toCdZnWLeTAqF CuZwN4T8TE+ZeTrPAfpaaZUf8aEgj0poPUtUpC259UK3QIwZXIy5C6UccyQin/QOCzbvPwkdis TFBPNqcYftMihwG0IgKuaZi/nTtXMppH+YeDXgpGiMi/NhB7UhAVTBmEhMmwPRZZwMytBHu4km spk= IronPort-SDR: fQKktqEBmhpnRCLCbcZzLHK46xX0IhOB54FWv0Pbc/lRpi2AflIXxSb46l3CHE4JU5HRJLy0Lk hzT1ixzTo5EvgTaOyW1+OTyyXQPv9SVxKrysJA9ruBkIPjNaAXZMulnGj1duGQ/2jl99J7YhJg YEF1tErAanQzezKGqCrSwAuKwWvqBakpeEpaULbjkqJBiX5r52VKn6gbuXUvG/4ANyDeg4/6KM iXiGFRJq7JGVlcgwBejGqwJunAdfwzukSWBsrmK5pa3ecp3kNzC27OFz062F4xvWM2B4jybSZF R1r/0Mhti2MCRfGSpbuA3iYX IronPort-SDR: uduCMkmpuw90H+GpZBdCb6sB2RAmSwNv2FqrSD0d1QXtjz3IkWx7CymYzhVWgXk+hwNEuWJbmz 7S/taUVKCj4g9OHFMNrWyXyvR64ZZQs95aNYoRyfLVFbqwYz8Bv75VgN8lSmDsZmWgLDH1PX3v rt3tmQnCjVpmQ4jbzH7QuWXVj81HzfB4leLXOGn4AnT/VovZcEDTedT70qBr8BirsPGMhk+zqZ qE8ORRTN21LwtUcAajWlnuYvpoco6XiRhLtit6jl+dTGLdBU0gMul40SsUAU3II7hs9Voc6xfW RMM= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: arnd@arndb.de, adhemerval.zanella@linaro.org, fweimer@redhat.com, palmer@sifive.com, macro@wdc.com, zongbox@gmail.com, alistair.francis@wdc.com, alistair23@gmail.com Subject: [RFC v5 18/21] RISC-V: Build Infastructure for the 32-bit Date: Thu, 29 Aug 2019 09:50:49 -0700 Message-Id: In-Reply-To: References: MIME-Version: 1.0 From: Zong Li This patch lays out the top-level orginazition of the RISC-V 32-bit port. It contains all the Implies files as well as various other fragments of build infastructure for the RISC-V 32-bit port. 2018-11-29 Zong Li * sysdeps/riscv/rv32/Implies-after: New file. * sysdeps/riscv/rv32/rvd/Implies: Likewise. * sysdeps/riscv/rv32/rvf/Implies: Likewise. * sysdeps/unix/sysv/linux/riscv/rv32/Implies: Likewise. * sysdeps/unix/sysv/linux/riscv/Makefile: Support rv32. * sysdeps/unix/sysv/linux/riscv/configure: Likewise. * sysdeps/unix/sysv/linux/riscv/configure.ac: Likewise. * sysdeps/unix/sysv/linux/riscv/shlib-versions: Likewise. * sysdeps/riscv/preconfigure: Likewise. --- 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 | 10 ++++- 9 files changed, 67 insertions(+), 8 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 d9adb31b649..1ab5d20f0ec 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 00000000000..39a34c5f574 --- /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 00000000000..1151214e8f4 --- /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 00000000000..66c401443b8 --- /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 b47858769f5..bf9c24ad77d 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 3018ca8f1b8..2b3c77f18cb 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 d4819931ca3..710d46afcd3 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 00000000000..8b7deb33cd5 --- /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 98c9b29cc4d..0f9552a1dd5 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.31 +ld=ld-linux-riscv32-ilp32d.so.1 +%elif RISCV_ABI_XLEN == 32 && RISCV_ABI_FLEN == 0 +DEFAULT GLIBC_2.31 +ld=ld-linux-riscv32-ilp32.so.1 %else %error cannot determine ABI %endif