public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
To: libc-alpha@sourceware.org, joseph@codesourcery.com
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Subject: [PATCH v7 15/17] RISC-V: Build Infastructure
Date: Sat, 27 Jan 2018 09:05:00 -0000	[thread overview]
Message-ID: <20180127035744.10058-16-palmer@dabbelt.com> (raw)
In-Reply-To: <20180127035744.10058-1-palmer@dabbelt.com>

This patch lays out the top-level orginazition of the RISC-V port.  It
contains all the Implies files as well as various other fragments of
build infastructure for the RISC-V port.  This contains the only change
to a shared file: config.h.in.

RISC-V is a family of base ISAs with optional extensions.  The base ISAs
are RV32I and RV64I, which are 32-bit and 64-bit integer-only ISAs, but
this port currently only supports RV64I based systems.  Support for
RISC-V lives in in sysdeps/riscv.  In addition to these ISAs, our glibc
port supports most of the currently-defined extensions: the A extension
for atomics, the M extension for multiplication, the C extension for
compressed instructions, and the F/D extensions for single/double
precision IEEE floating-point.  Most of these extensions are handled by
GCC, but glibc defines various floating-point wrappers and emulation
routines as well as some atomic wrappers.

We support running glibc-based programs on Linux, the support for which
lives in sysdeps/unix/sysv/linux/riscv.

2018-01-26  Palmer Dabbelt  <palmer@sifive.com>

        * sysdeps/riscv/Implies: New file.
        * sysdeps/riscv/Makefile: Likewise.
        * sysdeps/riscv/configure: Likewise.
        * sysdeps/riscv/configure.ac: Likewise.
        * sysdeps/riscv/nptl/Makefile: Likewise.
        * sysdeps/riscv/preconfigure: Likewise.
        * sysdeps/riscv/rv64/Implies-after: Likewise.
        * sysdeps/riscv/rv64/rvd/Implies: Likewise.
        * sysdeps/riscv/rv64/rvf/Implies: Likewise.
        * sysdeps/unix/sysv/linux/riscv/Implies: Likewise.
        * sysdeps/unix/sysv/linux/riscv/Makefile: Likewise.
        * sysdeps/unix/sysv/linux/riscv/Versions: Likewise.
        * sysdeps/unix/sysv/linux/riscv/configure: Likewise.
        * sysdeps/unix/sysv/linux/riscv/configure.ac: Likewise.
        * sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed: Likewise.
        * sysdeps/unix/sysv/linux/riscv/rv64/Implies: Likewise.
        * sysdeps/unix/sysv/linux/riscv/rv64/Makefile: Likewise.
        * sysdeps/unix/sysv/linux/riscv/shlib-versions: Likewise.
---
 sysdeps/riscv/Implies                         |   5 +
 sysdeps/riscv/Makefile                        |   7 +
 sysdeps/riscv/configure                       |   4 +
 sysdeps/riscv/configure.ac                    |   4 +
 sysdeps/riscv/nptl/Makefile                   |  26 +++
 sysdeps/riscv/preconfigure                    |  71 +++++++++
 sysdeps/riscv/rv64/Implies-after              |   1 +
 sysdeps/riscv/rv64/rvd/Implies                |   3 +
 sysdeps/riscv/rv64/rvf/Implies                |   1 +
 sysdeps/unix/sysv/linux/riscv/Implies         |   1 +
 sysdeps/unix/sysv/linux/riscv/Makefile        |  25 +++
 sysdeps/unix/sysv/linux/riscv/Versions        |  11 ++
 sysdeps/unix/sysv/linux/riscv/configure       | 219 ++++++++++++++++++++++++++
 sysdeps/unix/sysv/linux/riscv/configure.ac    |  38 +++++
 sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed |   1 +
 sysdeps/unix/sysv/linux/riscv/rv64/Implies    |   3 +
 sysdeps/unix/sysv/linux/riscv/rv64/Makefile   |   4 +
 sysdeps/unix/sysv/linux/riscv/shlib-versions  |   9 ++
 18 files changed, 433 insertions(+)
 create mode 100644 sysdeps/riscv/Implies
 create mode 100644 sysdeps/riscv/Makefile
 create mode 100644 sysdeps/riscv/configure
 create mode 100644 sysdeps/riscv/configure.ac
 create mode 100644 sysdeps/riscv/nptl/Makefile
 create mode 100644 sysdeps/riscv/preconfigure
 create mode 100644 sysdeps/riscv/rv64/Implies-after
 create mode 100644 sysdeps/riscv/rv64/rvd/Implies
 create mode 100644 sysdeps/riscv/rv64/rvf/Implies
 create mode 100644 sysdeps/unix/sysv/linux/riscv/Implies
 create mode 100644 sysdeps/unix/sysv/linux/riscv/Makefile
 create mode 100644 sysdeps/unix/sysv/linux/riscv/Versions
 create mode 100755 sysdeps/unix/sysv/linux/riscv/configure
 create mode 100644 sysdeps/unix/sysv/linux/riscv/configure.ac
 create mode 100644 sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv64/Implies
 create mode 100644 sysdeps/unix/sysv/linux/riscv/rv64/Makefile
 create mode 100644 sysdeps/unix/sysv/linux/riscv/shlib-versions

diff --git a/sysdeps/riscv/Implies b/sysdeps/riscv/Implies
new file mode 100644
index 000000000000..c88325b8be16
--- /dev/null
+++ b/sysdeps/riscv/Implies
@@ -0,0 +1,5 @@
+init_array
+
+ieee754/ldbl-128
+ieee754/dbl-64
+ieee754/flt-32
diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
new file mode 100644
index 000000000000..20a996810611
--- /dev/null
+++ b/sysdeps/riscv/Makefile
@@ -0,0 +1,7 @@
+ifeq ($(subdir),misc)
+sysdep_headers += sys/asm.h
+endif
+
+# RISC-V's assembler also needs to know about PIC as it changes the definition
+# of some assembler macros.
+ASFLAGS-.os += $(pic-ccflag)
diff --git a/sysdeps/riscv/configure b/sysdeps/riscv/configure
new file mode 100644
index 000000000000..53f5f1b5f113
--- /dev/null
+++ b/sysdeps/riscv/configure
@@ -0,0 +1,4 @@
+# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/riscv/elf.
+
+$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
diff --git a/sysdeps/riscv/configure.ac b/sysdeps/riscv/configure.ac
new file mode 100644
index 000000000000..34f62d4b4b82
--- /dev/null
+++ b/sysdeps/riscv/configure.ac
@@ -0,0 +1,4 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/riscv/elf.
+
+AC_DEFINE(PI_STATIC_AND_HIDDEN)
diff --git a/sysdeps/riscv/nptl/Makefile b/sysdeps/riscv/nptl/Makefile
new file mode 100644
index 000000000000..c3cc7f36da7e
--- /dev/null
+++ b/sysdeps/riscv/nptl/Makefile
@@ -0,0 +1,26 @@
+# Makefile for sysdeps/riscv/nptl.
+# Copyright (C) 2005-2018 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+#
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+ifeq ($(subdir),csu)
+gen-as-const-headers += tcb-offsets.sym
+endif
+
+ifeq ($(subdir),nptl)
+libpthread-sysdep_routines += nptl-sysdep
+libpthread-shared-only-routines += nptl-sysdep
+endif
diff --git a/sysdeps/riscv/preconfigure b/sysdeps/riscv/preconfigure
new file mode 100644
index 000000000000..448eaf279422
--- /dev/null
+++ b/sysdeps/riscv/preconfigure
@@ -0,0 +1,71 @@
+case "$machine" in
+riscv*)
+    xlen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_xlen \(.*\)/\1/p'`
+    flen=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_flen \(.*\)/\1/p'`
+    float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_float_abi_\([^ ]*\) .*/\1/p'`
+    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)
+	;;
+    *)
+    	echo "Unable to determine XLEN" >&2
+    	exit 1
+    	;;
+    esac
+    
+    case "$flen" in
+    64)
+    	float_machine=rvd
+	with_fp_cond=1
+    	;;
+    32)
+        echo "glibc does not yet support systems with the F but not D extensions" >&2
+	exit 1
+	;;
+    "")
+	with_fp_cond=0
+    	;;
+    *)
+    	echo "Unable to determine FLEN" >&2
+    	exit 1
+    	;;
+    esac
+    
+    case "$float_abi" in
+    soft)
+    	abi_flen=0
+    	;;
+    single)
+	echo "glibc does not yet support the single floating-point ABI" >&2
+	exit 1
+	;;
+    double)
+    	abi_flen=64
+    	;;
+    *)
+    	echo "Unable to determine floating-point ABI" >&2
+    	exit 1
+    	;;
+    esac
+
+    case "$atomic" in
+    __riscv_atomic)
+        ;;
+    *)
+        echo "glibc requires the A extension" >&2
+	exit 1
+	;;
+    esac
+    
+    base_machine=riscv
+    machine=riscv/rv$xlen/$float_machine
+    
+    $as_echo "#define RISCV_ABI_XLEN $xlen" >>confdefs.h
+    $as_echo "#define RISCV_ABI_FLEN $abi_flen" >>confdefs.h
+    ;;
+esac
diff --git a/sysdeps/riscv/rv64/Implies-after b/sysdeps/riscv/rv64/Implies-after
new file mode 100644
index 000000000000..a8cae95f9d46
--- /dev/null
+++ b/sysdeps/riscv/rv64/Implies-after
@@ -0,0 +1 @@
+wordsize-64
diff --git a/sysdeps/riscv/rv64/rvd/Implies b/sysdeps/riscv/rv64/rvd/Implies
new file mode 100644
index 000000000000..42fb132d12ae
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvd/Implies
@@ -0,0 +1,3 @@
+riscv/rv64/rvf
+riscv/rvd
+riscv/rvf
diff --git a/sysdeps/riscv/rv64/rvf/Implies b/sysdeps/riscv/rv64/rvf/Implies
new file mode 100644
index 000000000000..66c401443b8c
--- /dev/null
+++ b/sysdeps/riscv/rv64/rvf/Implies
@@ -0,0 +1 @@
+riscv/rvf
diff --git a/sysdeps/unix/sysv/linux/riscv/Implies b/sysdeps/unix/sysv/linux/riscv/Implies
new file mode 100644
index 000000000000..6faec7011569
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/Implies
@@ -0,0 +1 @@
+riscv/nptl
diff --git a/sysdeps/unix/sysv/linux/riscv/Makefile b/sysdeps/unix/sysv/linux/riscv/Makefile
new file mode 100644
index 000000000000..b47858769f5e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/Makefile
@@ -0,0 +1,25 @@
+ifeq ($(subdir),elf)
+sysdep_routines	+= dl-vdso
+ifeq ($(build-shared),yes)
+# This is needed for DSO loading from static binaries.
+sysdep-dl-routines += dl-static
+endif
+endif
+
+ifeq ($(subdir),misc)
+sysdep_headers += sys/cachectl.h
+sysdep_routines += flush-icache
+endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
+
+abi-variants := 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
diff --git a/sysdeps/unix/sysv/linux/riscv/Versions b/sysdeps/unix/sysv/linux/riscv/Versions
new file mode 100644
index 000000000000..5625d2a0b8fa
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/Versions
@@ -0,0 +1,11 @@
+ld {
+  GLIBC_PRIVATE {
+    # used for loading by static libraries
+    _dl_var_init;
+  }
+}
+libc {
+  GLIBC_2.27 {
+    __riscv_flush_icache;
+  }
+}
diff --git a/sysdeps/unix/sysv/linux/riscv/configure b/sysdeps/unix/sysv/linux/riscv/configure
new file mode 100755
index 000000000000..816e9145ebb2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/configure
@@ -0,0 +1,219 @@
+# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/unix/sysv/linux/riscv.
+
+arch_minimum_kernel=4.15.0
+
+libc_cv_riscv_int_abi=no
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+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 8 8" >/dev/null 2>&1; then :
+  libc_cv_riscv_int_abi=lp64
+fi
+rm -f conftest*
+
+if test $libc_cv_riscv_int_abi = no; then
+  as_fn_error $? "Unable to determine integer ABI" "$LINENO" 5
+fi
+
+libc_cv_riscv_float_abi=no
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __riscv_float_abi_double
+		   yes
+		   #endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then :
+  libc_cv_riscv_float_abi=d
+fi
+rm -f conftest*
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __riscv_float_abi_soft
+		   yes
+		   #endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "yes" >/dev/null 2>&1; then :
+  libc_cv_riscv_float_abi=
+fi
+rm -f conftest*
+
+if test $libc_cv_riscv_float_abi = no; then
+  as_fn_error $? "Unable to determine floating-point ABI" "$LINENO" 5
+fi
+
+config_vars="$config_vars
+default-abi = $libc_cv_riscv_int_abi$libc_cv_riscv_float_abi"
+
+case $libc_cv_riscv_int_abi$libc_cv_riscv_float_abi-$machine in
+lp64-riscv/rv64/*)
+  test -n "$libc_cv_slibdir" ||
+case "$prefix" in
+/usr | /usr/)
+  libc_cv_slibdir='/lib64/lp64'
+  libc_cv_rtlddir='/lib'
+  if test "$libdir" = '${exec_prefix}/lib'; then
+    libdir='${exec_prefix}/lib64/lp64';
+    # Locale data can be shared between 32-bit and 64-bit libraries.
+    libc_cv_complocaledir='${exec_prefix}/lib/locale'
+  fi
+  ;;
+esac
+  ;;
+lp64d-riscv/rv64/*)
+  test -n "$libc_cv_slibdir" ||
+case "$prefix" in
+/usr | /usr/)
+  libc_cv_slibdir='/lib64/lp64d'
+  libc_cv_rtlddir='/lib'
+  if test "$libdir" = '${exec_prefix}/lib'; then
+    libdir='${exec_prefix}/lib64/lp64d';
+    # 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
new file mode 100644
index 000000000000..4fae013ec914
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/configure.ac
@@ -0,0 +1,38 @@
+sinclude(./aclocal.m4)dnl Autoconf lossage
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/unix/sysv/linux/riscv.
+
+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)
+if test $libc_cv_riscv_int_abi = no; then
+  AC_MSG_ERROR([Unable to determine integer ABI])
+fi
+
+libc_cv_riscv_float_abi=no
+AC_EGREP_CPP(yes, [#ifdef __riscv_float_abi_double
+		   yes
+		   #endif
+  ],libc_cv_riscv_float_abi=d)
+AC_EGREP_CPP(yes, [#ifdef __riscv_float_abi_soft
+		   yes
+		   #endif
+  ],libc_cv_riscv_float_abi=)
+if test $libc_cv_riscv_float_abi = no; then
+  AC_MSG_ERROR([Unable to determine floating-point ABI])
+fi
+
+LIBC_CONFIG_VAR([default-abi], [$libc_cv_riscv_int_abi$libc_cv_riscv_float_abi])
+
+case $libc_cv_riscv_int_abi$libc_cv_riscv_float_abi-$machine in
+lp64-riscv/rv64/*)
+  LIBC_SLIBDIR_RTLDDIR([lib64/lp64], [lib])
+  ;;
+lp64d-riscv/rv64/*)
+  LIBC_SLIBDIR_RTLDDIR([lib64/lp64d], [lib])
+  ;;
+esac
+
+ldd_rewrite_script=sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed
new file mode 100644
index 000000000000..377a9c6ef43d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed
@@ -0,0 +1 @@
+s_^\(RTLDLIST=\)\(.*lib/\)\(ld-linux\)-\(riscv64\)-\(lp64\)\(d*\)\(\.so\.[0-9.]*\)_\1"\2\3-\4-\5\7 \2\3-\4-\5d\7"_
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/Implies b/sysdeps/unix/sysv/linux/riscv/rv64/Implies
new file mode 100644
index 000000000000..f042343bf7b4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/Implies
@@ -0,0 +1,3 @@
+unix/sysv/linux/riscv
+unix/sysv/linux/generic
+unix/sysv/linux/wordsize-64
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/Makefile b/sysdeps/unix/sysv/linux/riscv/rv64/Makefile
new file mode 100644
index 000000000000..cb60d740476d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/Makefile
@@ -0,0 +1,4 @@
+ifeq ($(subdir),socket)
+CFLAGS-recv.c += -fexceptions
+CFLAGS-send.c += -fexceptions
+endif
diff --git a/sysdeps/unix/sysv/linux/riscv/shlib-versions b/sysdeps/unix/sysv/linux/riscv/shlib-versions
new file mode 100644
index 000000000000..98c9b29cc4d6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/riscv/shlib-versions
@@ -0,0 +1,9 @@
+DEFAULT		GLIBC_2.27
+
+%if RISCV_ABI_XLEN == 64 && RISCV_ABI_FLEN == 64
+ld=ld-linux-riscv64-lp64d.so.1
+%elif RISCV_ABI_XLEN == 64 && RISCV_ABI_FLEN == 0
+ld=ld-linux-riscv64-lp64.so.1
+%else
+%error cannot determine ABI
+%endif
-- 
2.13.6

  parent reply	other threads:[~2018-01-27  3:58 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-27  3:58 RISC-V glibc port, v7 Palmer Dabbelt
2018-01-27  3:58 ` [PATCH v7 03/17] Add RISC-V entries to config.h.in Palmer Dabbelt
2018-01-27  3:58 ` [PATCH v7 02/17] Skeleton documentation for the RISC-V port Palmer Dabbelt
2018-02-05  9:19   ` Andreas Schwab
2018-02-08 21:13     ` Palmer Dabbelt
2018-02-08 21:33       ` Jim Wilson
2018-02-12 10:09         ` Andreas Schwab
2018-01-27  3:58 ` [PATCH v7 05/17] RISC-V: ABI Implementation Palmer Dabbelt
2018-01-29 16:35   ` Joseph Myers
2018-01-29 16:39     ` Palmer Dabbelt
2018-01-27  8:08 ` [PATCH v7 16/17] Add RISC-V to build-many-glibcs.py Palmer Dabbelt
2018-01-27  8:12 ` [PATCH v7 09/17] RISC-V: Hard Float Support Palmer Dabbelt
2018-01-27  8:13 ` [PATCH v7 17/17] RISC-V: Add ipc_priv.h Palmer Dabbelt
2018-01-27  8:40 ` [PATCH v7 07/17] RISC-V: Thread-Local Storage Support Palmer Dabbelt
2018-07-11 15:28   ` Andreas Schwab
2018-01-27  8:59 ` [PATCH v7 04/17] Add documentation for __riscv_flush_icache Palmer Dabbelt
2018-01-27  9:04 ` [PATCH v7 13/17] RISC-V: Linux Startup and Dynamic Loading Code Palmer Dabbelt
2018-01-27  9:05 ` Palmer Dabbelt [this message]
2018-01-27  9:07 ` [PATCH v7 01/17] sysdeps/init_array: Add PREINIT_FUNCTION to crti.S Palmer Dabbelt
2018-01-27  9:20 ` [PATCH v7 06/17] RISC-V: Startup and Dynamic Loading Code Palmer Dabbelt
2018-01-29 16:36   ` Joseph Myers
2018-01-29 16:56     ` Palmer Dabbelt
2018-01-27 12:12 ` [PATCH v7 08/17] RISC-V: Generic <math.h> and soft-fp Routines Palmer Dabbelt
2018-01-27 12:19 ` [PATCH v7 14/17] RISC-V: Add ABI Lists Palmer Dabbelt
2018-01-27 12:34 ` [PATCH v7 10/17] RISC-V: Atomic and Locking Routines Palmer Dabbelt
2018-01-27 12:34 ` [PATCH v7 11/17] RISC-V: Linux Syscall Interface Palmer Dabbelt
2018-01-27 15:07 ` [PATCH v7 12/17] RISC-V: Linux ABI Palmer Dabbelt
2018-01-27 21:28 ` RISC-V glibc port, v7 Darius Rad
2018-01-29 16:43 ` Joseph Myers
2018-01-29 22:01   ` Palmer Dabbelt
2018-01-29 22:01     ` Andrew Waterman
2018-01-29 22:09       ` Joseph Myers
2018-01-29 22:09         ` Andrew Waterman
2018-01-29 22:01 ` Palmer Dabbelt

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=20180127035744.10058-16-palmer@dabbelt.com \
    --to=palmer@dabbelt.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    /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).