summaryrefslogtreecommitdiff
path: root/sysdeps/riscv/preconfigure
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 16:03:01 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 16:03:01 +0000
commit14970231a38310b9561052a67b617138eeaad300 (patch)
tree35c201a651afa5d5e4fff241280081b3f88b9c2c /sysdeps/riscv/preconfigure
parentf08c7420b5e8b017a1a47b880a62b15bdc588f4d (diff)
parent25ead03a3712d57df2208fe82f3d316eb8faeaf6 (diff)
Merge commit 'refs/top-bases/t/extern_inline' into t/extern_inline
Diffstat (limited to 'sysdeps/riscv/preconfigure')
-rw-r--r--sysdeps/riscv/preconfigure71
1 files changed, 71 insertions, 0 deletions
diff --git a/sysdeps/riscv/preconfigure b/sysdeps/riscv/preconfigure
new file mode 100644
index 0000000000..d9adb31b64
--- /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