[haiku-commits] haiku: hrev53060 - in src/system/libroot/posix/glibc: include/arch/riscv64/bits include/arch/riscv64 arch/riscv64 include/arch/sparc include/arch/generic

  • From: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 10 Apr 2019 13:35:16 -0400 (EDT)

hrev53060 adds 1 changeset to branch 'master'
old head: f481aba1a636f8c420b3fda2b70cc3d017a5f17e
new head: 51ab221fc753c6755e47a83abee10fbba5918131
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=51ab221fc753+%5Ef481aba1a636

----------------------------------------------------------------------------

51ab221fc753: glibc: Hack and slash in riscv64
  
  * This isn't perfect, but should be a solid start.
  
  Change-Id: Icb3f8c57b2bc4148d2ac14a71375d3f36c15e13b
  Reviewed-on: https://review.haiku-os.org/c/1403
  Reviewed-by: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53060
Commit:      51ab221fc753c6755e47a83abee10fbba5918131
URL:         https://git.haiku-os.org/haiku/commit/?id=51ab221fc753
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Wed Apr 10 15:46:12 2019 UTC
Committer:   Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
Commit-Date: Wed Apr 10 17:35:13 2019 UTC

----------------------------------------------------------------------------

19 files changed, 859 insertions(+), 113 deletions(-)
src/system/libroot/posix/arch/riscv64/Jamfile    |   2 +
.../libroot/posix/glibc/arch/riscv64/Jamfile     | 201 +++++++---------
.../arch/{sparc => generic}/math-underflow.h     |   0
.../glibc/include/arch/riscv64/bits/endian.h     |   5 +
.../posix/glibc/include/arch/riscv64/bits/fenv.h |  75 ++++++
.../glibc/include/arch/riscv64/bits/fenvinline.h |   9 +
.../glibc/include/arch/riscv64/bits/floatn.h     |  97 ++++++++
.../glibc/include/arch/riscv64/bits/huge_val.h   |   8 +
.../glibc/include/arch/riscv64/bits/hwcap.h      |  51 ++++
.../posix/glibc/include/arch/riscv64/bits/link.h |  56 +++++
.../include/arch/riscv64/bits/long-double.h      |  20 ++
.../glibc/include/arch/riscv64/bits/mathdef.h    |  31 +++
.../glibc/include/arch/riscv64/bits/mathinline.h |  22 ++
.../posix/glibc/include/arch/riscv64/bits/nan.h  |   5 +
.../glibc/include/arch/riscv64/bits/setjmp.h     |  39 +++
.../glibc/include/arch/riscv64/bits/wordsize.h   |  29 +++
.../posix/glibc/include/arch/riscv64/config.h    | 235 +++++++++++++++++++
.../posix/glibc/include/arch/riscv64/math_ldbl.h |  79 +++++++
.../posix/glibc/include/arch/riscv64/stackinfo.h |   8 +

----------------------------------------------------------------------------

diff --git a/src/system/libroot/posix/arch/riscv64/Jamfile 
b/src/system/libroot/posix/arch/riscv64/Jamfile
index 7ee7d1ba29..124eace65a 100644
--- a/src/system/libroot/posix/arch/riscv64/Jamfile
+++ b/src/system/libroot/posix/arch/riscv64/Jamfile
@@ -5,6 +5,8 @@ for architectureObject in [ MultiArchSubDirSetup riscv64 ] {
        on $(architectureObject) {
                local architecture = $(TARGET_PACKAGING_ARCH) ;
 
+               UsePrivateHeaders [ FDirName system arch $(TARGET_ARCH) ] ;
+
                local genericSources =
                        setjmp_save_sigs.c
                        longjmp_return.c
diff --git a/src/system/libroot/posix/glibc/arch/riscv64/Jamfile 
b/src/system/libroot/posix/glibc/arch/riscv64/Jamfile
index ba38192712..027bcaf842 100644
--- a/src/system/libroot/posix/glibc/arch/riscv64/Jamfile
+++ b/src/system/libroot/posix/glibc/arch/riscv64/Jamfile
@@ -1,139 +1,114 @@
 SubDir HAIKU_TOP src system libroot posix glibc arch riscv64 ;
 
-SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc arch $(TARGET_ARCH) ;
-SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch
-       $(TARGET_ARCH) ;
+SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch 
$(TARGET_ARCH) ;
 SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch generic 
;
 SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include ;
+SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc libio ;
 SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc stdlib ;
 SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc math ;
-SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc libio ;
 SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
 
 SubDirHdrs $(HAIKU_TOP) src system libroot posix glibc arch generic ;
 
 UsePrivateHeaders libroot ;
 
+if $(OPTIM) = -O0 {
+       OPTIM = -O ;
+}
+
+# don't compile with debugging
+DEBUG = 0 ;
+
 SubDirCcFlags -D_GNU_SOURCE -D_IEEE_LIBM ;
 
 local genericSources =
-       branred.c
+       lshift.c rshift.c submul_1.c
+       s_finite.c s_finitef.c
+       add_n.c sub_n.c
+       addmul_1.c mul_1.c
+
        cmp.c dbl2mpn.c divrem.c
+       mpn2dbl.c mpn2flt.c mpn2ldbl.c
+       mul.c mul_n.c
+       s_isinf.c s_isinff.c
+       s_isnan.c s_isnanf.c
+       s_signbit.c s_signbitf.c #s_signbitl.c
+
+       s_nan.c s_nanf.c s_nanl.c
+       e_hypot.c e_hypotf.c #e_hypotl.c
+       w_hypot.c w_hypotf.c w_hypotl.c
+       s_fpclassify.c s_fpclassifyf.c
+       s_clog.c s_clogf.c s_clogl.c
+       s_log1p.c s_log1pf.c s_log1pl.c
+       s_csqrt.c s_csqrtf.c s_csqrtl.c
+       s_floor.c s_floorf.c
+       s_ceil.c s_ceilf.c
+       s_modf.c
+       w_powf.c e_powf.c
+       w_pow.c e_pow.c slowpow.c
+       w_exp.c e_exp.c slowexp.c
+       s_frexp.c s_expm1.c
        dosincos.c
+       doasin.c
+       sincos32.c
+       branred.c
        halfulp.c
+       mpa.c mplog.c mpexp.c
+       s_sin.c
+       s_atan.c s_atanf.c #s_atanl.c
+       s_tan.c
+       e_asin.c e_asinl.c
+       w_asin.c w_asinl.c
+       e_log10.c w_log10.c
+       e_logf.c e_logl.c
+       e_acos.c w_acos.c
+       e_atan2.c #e_atan2l.c
+       w_atan2.c w_atan2l.c mpatan2.c mpatan.c mptan.c mpsqrt.c w_sqrt.c 
w_sqrtf.c
+       e_sqrtl.c
+       e_fmod.c w_fmod.c
+       e_log.c w_log.c
+       e_cosh.c w_cosh.c
+       e_sinh.c w_sinh.c
+       s_cosf.c k_cosf.c
+       s_sinf.c k_sinf.c
+       s_ldexp.c s_ldexpf.c
+       s_scalbnf.c s_scalbn.c
+       s_copysign.c s_copysignf.c #s_copysignl.c
+       s_tanh.c s_tanf.c k_tanf.c
+       s_lround.c s_lroundf.c s_round.c s_roundf.c
+       s_rint.c s_rintf.c s_lrintf.c
+       e_fmodf.c w_fmodf.c
+       e_atan2f.c w_atan2f.c
+       e_rem_pio2f.c k_rem_pio2f.c
+
        memrchr.c
-       mpa.c mpatan.c mpatan2.c mpexp.c mplog.c mpn2dbl.c
-       mpn2flt.c mpn2ldbl.c mpsqrt.c mptan.c
-       mul.c mul_n.c
-       sincos32.c
-       slowexp.c
-       slowpow.c
-
-       e_acosh.c e_acoshf.c # e_acoshl.c
-       e_atan2.c e_atan2f.c # e_atan2l.c
-       e_atanh.c e_atanhf.c # e_atanhl.c
-       e_cosh.c e_coshf.c # e_coshl.c
-       e_exp.c e_expf.c
-       e_fmod.c e_fmodf.c # e_fmodl.c
-       e_gamma_r.c e_gammaf_r.c
-       e_hypot.c e_hypotf.c # e_hypotl.c
-       e_j0.c e_j0f.c
-       e_j1.c e_j1f.c
-       e_jn.c e_jnf.c
-       e_lgamma_r.c e_lgammaf_r.c
-       e_log.c e_logf.c
-       e_log10.c e_log10f.c
-       e_pow.c e_powf.c # e_powl.c
-       e_rem_pio2f.c
-       e_remainder.c e_remainderf.c # e_remainderl.c
-       e_scalb.c e_scalbf.c # e_scalbl.c
-       e_sinh.c e_sinhf.c # e_sinhl.c
-       k_cos.c k_cosf.c
-       k_sin.c k_sinf.c
-       k_rem_pio2.c k_rem_pio2f.c # k_rem_pio2l.c
-       k_tan.c k_tanf.c
-       s_asinh.c s_asinhf.c # s_asinhl.c
-       s_atan.c s_atanf.c # s_atanl.c
-       s_cbrt.c s_cbrtf.c # s_cbrtl.c
-       s_ceil.c s_ceilf.c # s_ceill.c
-       s_copysign.c s_copysignf.c # s_copysignl.c
-       s_cos.c s_cosf.c
-       s_erf.c s_erff.c # s_erfl.c
-       s_expm1f.c s_expm1.c
-       s_fabs.c s_fabsf.c # s_fabsl.S
-       s_finite.c s_finitef.c # s_finitel.c
-       s_floor.c s_floorf.c # s_floorl.c
-       s_fma.c s_fmaf.c # s_fmal.c
-       s_fmax.c s_fmaxf.c # s_fmaxl.c
-       s_fmin.c s_fminf.c # s_fminl.c
-       s_fpclassify.c s_fpclassifyf.c # s_fpclassifyl.c
-       s_frexp.c s_frexpf.c # s_frexpl.c
-       s_ilogb.c s_ilogbf.c
-       s_isinf.c s_isinff.c # s_isinfl.c
-       s_ldexp.c s_ldexpf.c # s_ldexpl.c
-       s_llrint.c s_llrintf.c # s_llrintl.c
-       s_log1p.c s_log1pf.c
-       s_logb.c s_logbf.c # s_logbl.c
-       s_lrint.c s_lrintf.c # s_lrintl.c
-       s_lround.c s_lroundf.c
-       s_modf.c s_modff.c # s_modfl.c
-       s_nan.c s_nanf.c # s_nanl.c
-       s_nextafter.c s_nextafterf.c # s_nextafterl.c
-       s_nexttoward.c # s_nexttowardf.c s_nexttowardl.c
-       s_round.c s_roundf.c # s_roundl.c
-       s_scalbn.c s_scalbnf.c # s_scalbnl.c
-       s_signbit.c s_signbitf.c # s_signbitl.c
-       s_significand.c s_significandf.c
-       s_signgam.c
-       s_sin.c s_sinf.c # s_sinl.c
-       s_sincos.c s_sincosf.c
-       s_tan.c s_tanf.c
-       s_tanh.c s_tanhf.c
-       s_trunc.c s_truncf.c
-       t_exp.c
-       w_acos.c w_acosf.c # w_acosl.c
-       w_acosh.c w_acoshf.c # w_acoshl.c
-       w_atan2.c w_atan2f.c # w_atan2l.c
-       w_asin.c w_asinf.c # w_asinl.c
-       w_atanh.c w_atanhf.c # w_atanhl.c
-       w_cosh.c w_coshf.c # w_coshl.c
-       w_drem.c w_dremf.c # w_dreml.c
-       w_exp.c w_expf.c # w_expl.c
-       w_fmod.c w_fmodf.c # w_fmodl.c
-       w_hypot.c w_hypotf.c # w_hypotl.c
-       w_j0.c w_j0f.c
-       w_j1.c w_j1f.c
-       w_jn.c w_jnf.c
-       w_lgamma.c w_lgammaf.c
-       w_lgamma_r.c w_lgammaf_r.c 
-       w_log.c w_logf.c # w_logl.c
-       w_log10.c w_log10f.c # w_log10l.c
-       w_pow.c w_powf.c # w_powl.c
-       w_remainder.c w_remainderf.c # w_remainderl.c
-       w_scalb.c w_scalbf.c # w_scalbl.c
-       w_sinh.c w_sinhf.c # w_sinhl.c
-       # no asm for m68k in glibc
-       w_sqrt.c w_sqrtf.c # w_sqrtl.c
        ;
 
+local architectureObject ;
+for architectureObject in [ MultiArchSubDirSetup riscv64 ] {
+       on $(architectureObject) {
+               local architecture = $(TARGET_PACKAGING_ARCH) ;
 
-MergeObject <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH)_generic.o :
-       $(genericSources)
-;
-
-
-#MergeObject <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH)_other.o :
-#      ;
-
+               MergeObject 
<$(architecture)>posix_gnu_arch_$(TARGET_ARCH)_generic.o :
+                       $(genericSources)
+                       ;
 
-MergeObjectFromObjects <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH).o
-       : :
-       <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH)_generic.o
-       # <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH)_other.o
-;
+               MergeObject 
<$(architecture)>posix_gnu_arch_$(TARGET_ARCH)_others.o :
+                       e_sqrt.c
+                       e_sqrtf.c
+                       ;
 
+               MergeObjectFromObjects 
<$(architecture)>posix_gnu_arch_$(TARGET_ARCH).o
+                       : :
+                       <$(architecture)>posix_gnu_arch_$(TARGET_ARCH)_generic.o
+                       <$(architecture)>posix_gnu_arch_$(TARGET_ARCH)_others.o
+                       ;
 
-SEARCH on [ FGristFiles $(genericSources) ]
-       = [ FDirName $(HAIKU_TOP) src system libroot posix glibc arch
-               generic ] ;
+               SEARCH on [ FGristFiles $(genericSources) ]
+                       = [ FDirName $(HAIKU_TOP) src system libroot posix
+                               glibc arch generic ]
+                         [ FDirName $(HAIKU_TOP) src system libroot posix
+                               glibc arch generic longdouble 128bit ] ;
+       }
+}
 
diff --git a/src/system/libroot/posix/glibc/include/arch/sparc/math-underflow.h 
b/src/system/libroot/posix/glibc/include/arch/generic/math-underflow.h
similarity index 100%
rename from src/system/libroot/posix/glibc/include/arch/sparc/math-underflow.h
rename to src/system/libroot/posix/glibc/include/arch/generic/math-underflow.h
diff --git a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/endian.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/endian.h
new file mode 100644
index 0000000000..4aaf559d4f
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/endian.h
@@ -0,0 +1,5 @@
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/fenv.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/fenv.h
new file mode 100644
index 0000000000..d7a01d8c57
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/fenv.h
@@ -0,0 +1,75 @@
+/* Floating point environment, RISC-V version.
+   Copyright (C) 1998-2019 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/>.  */
+
+#ifndef _FENV_H
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
+
+enum
+  {
+    FE_INEXACT   =
+#define FE_INEXACT     (0x01)
+      FE_INEXACT,
+    FE_UNDERFLOW =
+#define FE_UNDERFLOW   (0x02)
+      FE_UNDERFLOW,
+    FE_OVERFLOW  =
+#define FE_OVERFLOW    (0x04)
+      FE_OVERFLOW,
+    FE_DIVBYZERO =
+#define FE_DIVBYZERO   (0x08)
+      FE_DIVBYZERO,
+    FE_INVALID   =
+#define FE_INVALID     (0x10)
+      FE_INVALID
+  };
+
+#define FE_ALL_EXCEPT \
+       (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
+
+enum
+  {
+    FE_TONEAREST  =
+#define FE_TONEAREST   (0x0)
+      FE_TONEAREST,
+    FE_TOWARDZERO =
+#define FE_TOWARDZERO  (0x1)
+      FE_TOWARDZERO,
+    FE_DOWNWARD   =
+#define FE_DOWNWARD    (0x2)
+      FE_DOWNWARD,
+    FE_UPWARD     =
+#define FE_UPWARD      (0x3)
+      FE_UPWARD
+  };
+
+
+typedef unsigned int fexcept_t;
+typedef unsigned int fenv_t;
+
+/* If the default argument is used we use this value.  */
+#define FE_DFL_ENV     ((__const fenv_t *) -1)
+
+// #if __GLIBC_USE (IEC_60559_BFP_EXT)
+#if 0
+/* Type representing floating-point control modes.  */
+typedef unsigned int femode_t;
+
+/* Default floating-point control modes.  */
+# define FE_DFL_MODE   ((const femode_t *) -1L)
+#endif
diff --git 
a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/fenvinline.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/fenvinline.h
new file mode 100644
index 0000000000..bd1a30dfa2
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/fenvinline.h
@@ -0,0 +1,9 @@
+/* This file provides inline versions of floating-pint environment
+   handling functions.  If there were any.  */
+
+#ifndef __NO_MATH_INLINES
+
+/* Here is where the code would go.  */
+
+#endif
+
diff --git a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/floatn.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/floatn.h
new file mode 100644
index 0000000000..fb31be29e6
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/floatn.h
@@ -0,0 +1,97 @@
+/* Macros to control TS 18661-3 glibc features on ldbl-128 platforms.
+   Copyright (C) 2017-2019 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/>.  */
+
+#ifndef _BITS_FLOATN_H
+#define _BITS_FLOATN_H
+
+#include <features.h>
+#include <bits/long-double.h>
+
+/* Defined to 1 if the current compiler invocation provides a
+   floating-point type with the IEEE 754 binary128 format, and this
+   glibc includes corresponding *f128 interfaces for it.  */
+#ifndef __NO_LONG_DOUBLE_MATH
+# define __HAVE_FLOAT128 1
+#else
+/* glibc does not support _Float128 for platforms where long double is
+   normally binary128 when building with long double as binary64.
+   GCC's default for supported scalar modes does not support it either
+   in that case.  */
+# define __HAVE_FLOAT128 0
+#endif
+
+/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct
+   from the default float, double and long double types in this glibc.  */
+#define __HAVE_DISTINCT_FLOAT128 0
+
+/* Defined to 1 if the current compiler invocation provides a
+   floating-point type with the right format for _Float64x, and this
+   glibc includes corresponding *f64x interfaces for it.  */
+#define __HAVE_FLOAT64X __HAVE_FLOAT128
+
+/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format
+   of long double.  Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has
+   the format of _Float128, which must be different from that of long
+   double.  */
+#define __HAVE_FLOAT64X_LONG_DOUBLE __HAVE_FLOAT128
+
+#ifndef __ASSEMBLER__
+
+/* Defined to concatenate the literal suffix to be used with _Float128
+   types, if __HAVE_FLOAT128 is 1. */
+# if __HAVE_FLOAT128
+#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+/* The literal suffix f128 exists only since GCC 7.0.  */
+#   define __f128(x) x##l
+#  else
+#   define __f128(x) x##f128
+#  endif
+# endif
+
+/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1.  */
+# if __HAVE_FLOAT128
+#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+#   define __CFLOAT128 _Complex long double
+#  else
+#   define __CFLOAT128 _Complex _Float128
+#  endif
+# endif
+
+/* The remaining of this file provides support for older compilers.  */
+# if __HAVE_FLOAT128
+
+/* The type _Float128 exists only since GCC 7.0.  */
+#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+typedef long double _Float128;
+#  endif
+
+/* Various built-in functions do not exist before GCC 7.0.  */
+#  if !__GNUC_PREREQ (7, 0)
+#   define __builtin_huge_valf128() (__builtin_huge_vall ())
+#   define __builtin_inff128() (__builtin_infl ())
+#   define __builtin_nanf128(x) (__builtin_nanl (x))
+#   define __builtin_nansf128(x) (__builtin_nansl (x))
+#  endif
+
+# endif
+
+#endif /* !__ASSEMBLER__.  */
+
+#include <bits/floatn-common.h>
+
+#endif /* _BITS_FLOATN_H */
diff --git 
a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/huge_val.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/huge_val.h
new file mode 100644
index 0000000000..4870e3c4ff
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/huge_val.h
@@ -0,0 +1,8 @@
+#ifndef _MATH_H
+# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+#endif
+
+
+# define HUGE_VAL      (__builtin_huge_val())
+# define HUGE_VALF  (__builtin_huge_valf())
+# define HUGE_VALL  (__builtin_huge_vall())
diff --git a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/hwcap.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/hwcap.h
new file mode 100644
index 0000000000..a991029f02
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/hwcap.h
@@ -0,0 +1,51 @@
+/* Defines for bits in AT_HWCAP.
+   Copyright (C) 2011-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/>.  */
+
+#if !defined(_SYS_AUXV_H) && !defined(_SYSDEPS_SYSDEP_H)
+# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
+#endif
+
+#define HWCAP_SPARC_FLUSH      0x00000001
+#define HWCAP_SPARC_STBAR      0x00000002
+#define HWCAP_SPARC_SWAP       0x00000004
+#define HWCAP_SPARC_MULDIV     0x00000008
+#define HWCAP_SPARC_V9         0x00000010
+#define HWCAP_SPARC_ULTRA3     0x00000020
+#define HWCAP_SPARC_BLKINIT    0x00000040
+#define HWCAP_SPARC_N2         0x00000080
+#define HWCAP_SPARC_MUL32      0x00000100
+#define HWCAP_SPARC_DIV32      0x00000200
+#define HWCAP_SPARC_FSMULD     0x00000400
+#define HWCAP_SPARC_V8PLUS     0x00000800
+#define HWCAP_SPARC_POPC       0x00001000
+#define HWCAP_SPARC_VIS                0x00002000
+#define HWCAP_SPARC_VIS2       0x00004000
+#define HWCAP_SPARC_ASI_BLK_INIT 0x00008000
+#define HWCAP_SPARC_FMAF       0x00010000
+#define HWCAP_SPARC_VIS3       0x00020000
+#define HWCAP_SPARC_HPC                0x00040000
+#define HWCAP_SPARC_RANDOM     0x00080000
+#define HWCAP_SPARC_TRANS      0x00100000
+#define HWCAP_SPARC_FJFMAU     0x00200000
+#define HWCAP_SPARC_IMA                0x00400000
+#define HWCAP_SPARC_ASI_CACHE_SPARING \
+                               0x00800000
+#define HWCAP_SPARC_PAUSE      0x01000000
+#define HWCAP_SPARC_CBCOND     0x02000000
+#define HWCAP_SPARC_CRYPTO     0x04000000
+#define HWCAP_SPARC_ADP                0x08000000
diff --git a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/link.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/link.h
new file mode 100644
index 0000000000..124d9573aa
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/link.h
@@ -0,0 +1,56 @@
+/* Machine-specific declarations for dynamic linker interface.  RISC-V version.
+   Copyright (C) 2005-2019 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/>.  */
+
+#ifndef        _LINK_H
+# error "Never include <bits/link.h> directly; use <link.h> instead."
+#endif
+
+typedef struct La_riscv_regs
+{
+  unsigned long int lr_reg[8]; /* a0 - a7 */
+  double lr_fpreg[8]; /* fa0 - fa7 */
+  unsigned long int lr_ra;
+  unsigned long int lr_sp;
+} La_riscv_regs;
+
+/* Return values for calls from PLT on RISC-V.  */
+typedef struct La_riscv_retval
+{
+  unsigned long int lrv_a0;
+  unsigned long int lrv_a1;
+  double lrv_fa0;
+  double lrv_fa1;
+} La_riscv_retval;
+
+__BEGIN_DECLS
+
+extern ElfW(Addr) la_riscv_gnu_pltenter (ElfW(Sym) *__sym, unsigned int __ndx,
+                                        uintptr_t *__refcook,
+                                        uintptr_t *__defcook,
+                                        La_riscv_regs *__regs,
+                                        unsigned int *__flags,
+                                        const char *__symname,
+                                        long int *__framesizep);
+extern unsigned int la_riscv_gnu_pltexit (ElfW(Sym) *__sym, unsigned int __ndx,
+                                         uintptr_t *__refcook,
+                                         uintptr_t *__defcook,
+                                         const La_riscv_regs *__inregs,
+                                         La_riscv_retval *__outregs,
+                                         const char *__symname);
+
+__END_DECLS
diff --git 
a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/long-double.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/long-double.h
new file mode 100644
index 0000000000..df9d588df5
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/long-double.h
@@ -0,0 +1,20 @@
+/* Properties of long double type.  ldbl-128 version.
+   Copyright (C) 2016-2019 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  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/>.  */
+
+/* long double is distinct from double, so there is nothing to
+   define here.  */
diff --git a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/mathdef.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/mathdef.h
new file mode 100644
index 0000000000..13b271dec2
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/mathdef.h
@@ -0,0 +1,31 @@
+#if !defined _MATH_H && !defined _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
+# define _MATH_H_MATHDEF       1
+
+typedef float float_t;
+typedef double double_t;
+
+/* The values returned by `ilogb' for 0 and NaN respectively.  */
+# define FP_ILOGB0       (-2147483647)
+# define FP_ILOGBNAN     (2147483647)
+
+# define INFINITY   (__builtin_inff())
+
+/* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l}
+   builtins are supported.  */
+# if __FP_FAST_FMA
+#  define FP_FAST_FMA 1
+# endif
+
+# if __FP_FAST_FMAF
+#  define FP_FAST_FMAF 1
+# endif
+
+# if __FP_FAST_FMAL
+#  define FP_FAST_FMAL 1
+# endif
+
+#endif /* ISO C99 */
diff --git 
a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/mathinline.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/mathinline.h
new file mode 100644
index 0000000000..b9b3f6efab
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/mathinline.h
@@ -0,0 +1,22 @@
+#ifndef _MATH_H
+# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
+#endif
+
+#define __NTH(fct)    __attribute__ ((__nothrow__)) fct
+
+#ifndef __extern_always_inline
+# define __MATH_INLINE __inline
+#else
+# define __MATH_INLINE __extern_always_inline
+#endif
+
+#if defined __USE_ISOC99
+
+#  define isgreater(x, y) __builtin_isgreater (x, y)
+#  define isgreaterequal(x, y) __builtin_isgreaterequal (x, y)
+#  define isless(x, y) __builtin_isless (x, y)
+#  define islessequal(x, y) __builtin_islessequal (x, y)
+#  define islessgreater(x, y) __builtin_islessgreater (x, y)
+#  define isunordered(x, y) __builtin_isunordered (x, y)
+
+#endif
diff --git a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/nan.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/nan.h
new file mode 100644
index 0000000000..c17012bcaa
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/nan.h
@@ -0,0 +1,5 @@
+#ifndef _MATH_H
+# error "Never use <bits/nan.h> directly; include <math.h> instead."
+#endif
+
+# define NAN   (__builtin_nanf (""))
diff --git a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/setjmp.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/setjmp.h
new file mode 100644
index 0000000000..3d37b73689
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/setjmp.h
@@ -0,0 +1,39 @@
+/* Define the machine-dependent type `jmp_buf'.  RISC-V version.
+   Copyright (C) 2011-2019 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/>.  */
+
+#ifndef _RISCV_BITS_SETJMP_H
+#define _RISCV_BITS_SETJMP_H
+
+typedef struct __jmp_buf_internal_tag
+  {
+    /* Program counter.  */
+    long int __pc;
+    /* Callee-saved registers.  */
+    long int __regs[12];
+    /* Stack pointer.  */
+    long int __sp;
+
+    /* Callee-saved floating point registers.  */
+#if defined __riscv_float_abi_double
+   double __fpregs[12];
+#elif !defined __riscv_float_abi_soft
+# error unsupported FLEN
+#endif
+  } __jmp_buf[1];
+
+#endif /* _RISCV_BITS_SETJMP_H */
diff --git 
a/src/system/libroot/posix/glibc/include/arch/riscv64/bits/wordsize.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/wordsize.h
new file mode 100644
index 0000000000..0b8cd8fefd
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/bits/wordsize.h
@@ -0,0 +1,29 @@
+/* Determine the wordsize from the preprocessor defines.  RISC-V version.
+   Copyright (C) 2002-2019 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/>.  */
+
+#if __riscv_xlen == (__SIZEOF_POINTER__ * 8)
+# define __WORDSIZE __riscv_xlen
+#else
+# error unsupported ABI
+#endif
+
+#if __riscv_xlen == 64
+# define __WORDSIZE_TIME64_COMPAT32 1
+#else
+# error "rv32i-based targets are not supported"
+#endif
diff --git a/src/system/libroot/posix/glibc/include/arch/riscv64/config.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/config.h
new file mode 100644
index 0000000000..557c4695ed
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/config.h
@@ -0,0 +1,235 @@
+//#if !defined __ASSEMBLER__ && !defined _ISOMAC && !defined __OPTIMIZE__
+//# error "glibc cannot be compiled without optimization"
+//#endif
+
+/* Another evil option when it comes to compiling the C library is
+   --ffast-math since it alters the ABI.  */
+#if defined __FAST_MATH__ && !defined TEST_FAST_MATH
+# error "glibc must not be compiled with -ffast-math"
+#endif
+
+/* Define if using GNU ld, with support for weak symbols in a.out,
+   and for symbol set and warning messages extensions in a.out and ELF.
+   This implies HAVE_WEAK_SYMBOLS; set by --with-gnu-ld.  */
+#define        HAVE_GNU_LD 1
+
+/* Define if using ELF, which supports weak symbols.
+   This implies HAVE_ASM_WEAK_DIRECTIVE set by --with-elf.  */
+#define        HAVE_ELF 1
+
+/* Define if using XCOFF. Set by --with-xcoff.  */
+#undef HAVE_XCOFF
+
+/* Define if weak symbols are available via the `.weak' directive.  */
+#define        HAVE_ASM_WEAK_DIRECTIVE 1
+
+/* Define if weak symbols are available via the `.weakext' directive.  */
+#undef HAVE_ASM_WEAKEXT_DIRECTIVE
+
+/* Define to the assembler line separator character for multiple
+   assembler instructions per line.  Default is `;'  */
+#undef ASM_LINE_SEP
+
+/* Define if not using ELF, but `.init' and `.fini' sections are available.  */
+#undef HAVE_INITFINI
+
+/* Define if __attribute__((section("foo"))) puts quotes around foo.  */
+/*#define      HAVE_SECTION_QUOTES 1
+ [zooey]: defining this causes assembler errors, and I don't think
+          that any BeOS-gcc actually produces quotes in sections...
+*/
+#undef HAVE_SECTION_QUOTES
+
+/* Define if using the GNU assembler, gas.  */
+#define        HAVE_GNU_AS 1
+
+/* Define if the assembler supports the `.set' directive.  */
+#define        HAVE_ASM_SET_DIRECTIVE 1
+
+/* Define to the name of the assembler's directive for
+   declaring a symbol global (default `.globl').  */
+#define        ASM_GLOBAL_DIRECTIVE .globl
+
+/* Define to the prefix before `object' or `function' in the
+   assembler's `.type' directive, if it has one.  */
+#undef ASM_TYPE_DIRECTIVE_PREFIX
+
+/* Define a symbol_name as a global .symbol_name for ld.  */
+#undef HAVE_ASM_GLOBAL_DOT_NAME
+
+/* Define if the assembler generates debugging information directly.  */
+#undef HAVE_CPP_ASM_DEBUGINFO
+
+/* Define if _Unwind_Find_FDE should be exported from glibc.  */
+#undef  EXPORT_UNWIND_FIND_FDE
+
+/* Define to use GNU libio instead of GNU stdio.
+   This is defined by configure under --enable-libio.  */
+#define        USE_IN_LIBIO 1
+
+/* Define if using ELF and the assembler supports the `.previous'
+   directive.  */
+#define        HAVE_ASM_PREVIOUS_DIRECTIVE 1
+
+/* Define if using ELF and the assembler supports the `.popsection'
+   directive.  */
+#undef HAVE_ASM_POPSECTION_DIRECTIVE
+
+/* Define if versioning of the library is wanted.  */
+#undef DO_VERSIONING
+
+/* Defined to the oldest ABI we support, like 2.1.  */
+#undef GLIBC_OLDEST_ABI
+
+/* Define if static NSS modules are wanted.  */
+#undef DO_STATIC_NSS
+
+/* Define if gcc uses DWARF2 unwind information for exception support.  */
+#define        HAVE_DWARF2_UNWIND_INFO 1
+
+/* Define if gcc uses DWARF2 unwind information for exception support
+   with static variable. */
+#define        HAVE_DWARF2_UNWIND_INFO_STATIC 1
+
+/* Define if the compiler supports __builtin_expect.  */
+#undef HAVE_BUILTIN_EXPECT
+
+/* Define if the compiler supports __builtin_memset.  */
+#undef HAVE_BUILTIN_MEMSET
+
+/* Define if the __thread keyword is supported.  */
+#undef HAVE___THREAD
+
+/* Define if the compiler supports __attribute__((tls_model(""))).  */
+#undef HAVE_TLS_MODEL_ATTRIBUTE
+
+/* Define if the regparm attribute shall be used for local functions
+   (gcc on ix86 only).  */
+#define        USE_REGPARMS 0
+
+/* Defined on PowerPC if the GCC being used has a problem with clobbering
+   certain registers (CR0, MQ, CTR, LR) in asm statements.  */
+#undef BROKEN_PPC_ASM_CR0
+
+/* Defined on SPARC if ld doesn't handle R_SPARC_WDISP22 against .hidden
+   symbol.  sysdeps/sparc/sparc32/elf/configure.  */
+#undef BROKEN_SPARC_WDISP22
+
+/* Define if the linker supports the -z combreloc option.  */
+#undef HAVE_Z_COMBRELOC
+
+/* Define if the assembler supported .protected.  */
+#undef HAVE_PROTECTED
+
+/* Define if the assembler supported .hidden.  */
+#undef HAVE_HIDDEN
+
+/* Define if the compiler supports __attribute__ ((visibility (...))).  */
+#undef HAVE_VISIBILITY_ATTRIBUTE
+
+/* Define if the compiler doesn't support __attribute__ ((visibility (...)))
+   together with __asm__ redirection properly.  */
+#undef HAVE_BROKEN_VISIBILITY_ATTRIBUTE
+
+/* Define if the compiler doesn't support __attribute__ ((alias (...)))
+   together with __asm__ redirection properly.  */
+#undef HAVE_BROKEN_ALIAS_ATTRIBUTE
+
+/* Define if _rtld_local structure should be forced into .sdata section.  */
+#undef HAVE_SDATA_SECTION
+
+/* Define if binutils support TLS handling.  */
+#undef HAVE_TLS_SUPPORT
+
+/* Define if the linker supports .preinit_array/.init_array/.fini_array
+   sections.  */
+#undef HAVE_INITFINI_ARRAY
+
+/* Define if the access to static and hidden variables is position independent
+   and does not need relocations.  */
+#undef PI_STATIC_AND_HIDDEN
+
+/* Define this to disable the `hidden_proto' et al macros in
+   include/libc-symbols.h that avoid PLT slots in the shared objects.  */
+#undef NO_HIDDEN
+
+
+/* Defined to some form of __attribute__ ((...)) if the compiler supports
+   a different, more efficient calling convention.  */
+#if USE_REGPARMS && !defined PROF && !defined __BOUNDED_POINTERS__
+# define internal_function __attribute__ ((regparm (3), stdcall))
+#endif
+
+/* Linux specific: minimum supported kernel version.  */
+#undef __LINUX_KERNEL_VERSION
+
+/* Override abi-tags ABI version if necessary.  */
+#undef  __ABI_TAG_VERSION
+
+/* An extension in gcc 2.96 and up allows the subtraction of two
+   local labels.  */
+#undef HAVE_SUBTRACT_LOCAL_LABELS
+
+/* bash 2.0 introduced the _XXX_GNU_nonoption_argv_flags_ variable to help
+   getopt determine whether a parameter is a flag or not.  This features
+   was disabled later since it caused trouble.  We are by default therefore
+   disabling the support as well.  */
+#undef USE_NONOPTION_FLAGS
+
+/* Mach/Hurd specific: define if mig supports the `retcode' keyword.  */
+#undef HAVE_MIG_RETCODE
+
+/* Mach specific: define if the `host_page_size' RPC is available.  */
+#undef HAVE_HOST_PAGE_SIZE
+
+/* Mach/i386 specific: define if the `i386_io_perm_*' RPCs are available.  */
+#undef HAVE_I386_IO_PERM_MODIFY
+
+/* Mach/i386 specific: define if the `i386_set_gdt' RPC is available.  */
+#undef HAVE_I386_SET_GDT
+
+/*
+  */
+
+#ifndef        _LIBC
+
+/* These symbols might be defined by some sysdeps configures.
+   They are used only in miscellaneous generator programs, not
+   in compiling libc itself.   */
+
+/* sysdeps/generic/configure.in */
+#undef HAVE_PSIGNAL
+
+/* sysdeps/unix/configure.in */
+#define        HAVE_STRERROR
+
+/* sysdeps/unix/common/configure.in */
+#undef HAVE_SYS_SIGLIST
+#undef HAVE__SYS_SIGLIST
+#undef HAVE__CTYPE_
+#undef HAVE___CTYPE_
+#undef HAVE___CTYPE
+#undef HAVE__CTYPE__
+#undef HAVE__CTYPE
+#undef HAVE__LOCP
+
+#endif
+
+/*
+  */
+
+#ifdef _LIBC
+
+/* The zic and zdump programs need these definitions.  */
+
+#define        HAVE_STRERROR   1
+
+/* The locale code needs these definitions.  */
+
+#define HAVE_REGEX 1
+
+//#define HAVE_MMAP 1
+#undef HAVE_MMAP
+
+#endif
+
diff --git a/src/system/libroot/posix/glibc/include/arch/riscv64/math_ldbl.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/math_ldbl.h
new file mode 100644
index 0000000000..b9ff8dadaf
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/math_ldbl.h
@@ -0,0 +1,79 @@
+#ifndef _MATH_PRIVATE_H_
+#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
+#endif
+
+/* A union which permits us to convert between a long double and
+   three 32 bit ints.  */
+
+typedef union
+{
+  long double value;
+  struct
+  {
+    u_int32_t lsw;
+    u_int32_t msw;
+    int sign_exponent:16;
+    unsigned int empty1:16;
+    unsigned int empty0:32;
+  } parts;
+} ieee_long_double_shape_type;
+
+/* Get three 32 bit ints from a double.  */
+
+#define GET_LDOUBLE_WORDS(exp,ix0,ix1,d)                       \
+do {                                                           \
+  ieee_long_double_shape_type ew_u;                            \
+  ew_u.value = (d);                                            \
+  (exp) = ew_u.parts.sign_exponent;                            \
+  (ix0) = ew_u.parts.msw;                                      \
+  (ix1) = ew_u.parts.lsw;                                      \
+} while (0)
+
+/* Set a double from two 32 bit ints.  */
+
+#define SET_LDOUBLE_WORDS(d,exp,ix0,ix1)                       \
+do {                                                           \
+  ieee_long_double_shape_type iw_u;                            \
+  iw_u.parts.sign_exponent = (exp);                            \
+  iw_u.parts.msw = (ix0);                                      \
+  iw_u.parts.lsw = (ix1);                                      \
+  (d) = iw_u.value;                                            \
+} while (0)
+
+/* Get the more significant 32 bits of a long double mantissa.  */
+
+#define GET_LDOUBLE_MSW(v,d)                                   \
+do {                                                           \
+  ieee_long_double_shape_type sh_u;                            \
+  sh_u.value = (d);                                            \
+  (v) = sh_u.parts.msw;                                                \
+} while (0)
+
+/* Set the more significant 32 bits of a long double mantissa from an int.  */
+
+#define SET_LDOUBLE_MSW(d,v)                                   \
+do {                                                           \
+  ieee_long_double_shape_type sh_u;                            \
+  sh_u.value = (d);                                            \
+  sh_u.parts.msw = (v);                                                \
+  (d) = sh_u.value;                                            \
+} while (0)
+
+/* Get int from the exponent of a long double.  */
+
+#define GET_LDOUBLE_EXP(exp,d)                                 \
+do {                                                           \
+  ieee_long_double_shape_type ge_u;                            \
+  ge_u.value = (d);                                            \
+  (exp) = ge_u.parts.sign_exponent;                            \
+} while (0)
+
+/* Set exponent of a long double from an int.  */
+
+#define SET_LDOUBLE_EXP(d,exp)                                 \
+do {                                                           \
+  ieee_long_double_shape_type se_u;                            \
+  se_u.value = (d);                                            \
+  se_u.parts.sign_exponent = (exp);                            \
+  (d) = se_u.value;                                            \
+} while (0)
diff --git a/src/system/libroot/posix/glibc/include/arch/riscv64/stackinfo.h 
b/src/system/libroot/posix/glibc/include/arch/riscv64/stackinfo.h
new file mode 100644
index 0000000000..b5f10c6c0b
--- /dev/null
+++ b/src/system/libroot/posix/glibc/include/arch/riscv64/stackinfo.h
@@ -0,0 +1,8 @@
+#ifndef _STACKINFO_H
+#define _STACKINFO_H   1
+
+/* On riscv the stack grows down.  */
+#define _STACK_GROWS_DOWN      1
+
+#endif /* stackinfo.h */
+



Other related posts:

  • » [haiku-commits] haiku: hrev53060 - in src/system/libroot/posix/glibc: include/arch/riscv64/bits include/arch/riscv64 arch/riscv64 include/arch/sparc include/arch/generic - Alex von Gluck IV