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 <[email protected]>
This commit is contained in:
Alexander von Gluck IV
2019-04-10 17:35:13 +00:00
committed by Alex von Gluck IV
parent f481aba1a6
commit 51ab221fc7
19 changed files with 862 additions and 116 deletions
@@ -5,6 +5,8 @@ for architectureObject in [ MultiArchSubDirSetup riscv64 ] {
on $(architectureObject) { on $(architectureObject) {
local architecture = $(TARGET_PACKAGING_ARCH) ; local architecture = $(TARGET_PACKAGING_ARCH) ;
UsePrivateHeaders [ FDirName system arch $(TARGET_ARCH) ] ;
local genericSources = local genericSources =
setjmp_save_sigs.c setjmp_save_sigs.c
longjmp_return.c longjmp_return.c
@@ -1,139 +1,114 @@
SubDir HAIKU_TOP src system libroot posix glibc arch riscv64 ; 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 arch generic ;
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include ; 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 stdlib ;
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc math ; 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 ; SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ;
SubDirHdrs $(HAIKU_TOP) src system libroot posix glibc arch generic ; SubDirHdrs $(HAIKU_TOP) src system libroot posix glibc arch generic ;
UsePrivateHeaders libroot ; UsePrivateHeaders libroot ;
if $(OPTIM) = -O0 {
OPTIM = -O ;
}
# don't compile with debugging
DEBUG = 0 ;
SubDirCcFlags -D_GNU_SOURCE -D_IEEE_LIBM ; SubDirCcFlags -D_GNU_SOURCE -D_IEEE_LIBM ;
local genericSources = local genericSources =
branred.c lshift.c rshift.c submul_1.c
cmp.c dbl2mpn.c divrem.c s_finite.c s_finitef.c
dosincos.c add_n.c sub_n.c
halfulp.c addmul_1.c mul_1.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 cmp.c dbl2mpn.c divrem.c
e_atan2.c e_atan2f.c # e_atan2l.c mpn2dbl.c mpn2flt.c mpn2ldbl.c
e_atanh.c e_atanhf.c # e_atanhl.c mul.c mul_n.c
e_cosh.c e_coshf.c # e_coshl.c s_isinf.c s_isinff.c
e_exp.c e_expf.c s_isnan.c s_isnanf.c
e_fmod.c e_fmodf.c # e_fmodl.c s_signbit.c s_signbitf.c #s_signbitl.c
e_gamma_r.c e_gammaf_r.c
e_hypot.c e_hypotf.c # e_hypotl.c s_nan.c s_nanf.c s_nanl.c
e_j0.c e_j0f.c e_hypot.c e_hypotf.c #e_hypotl.c
e_j1.c e_j1f.c w_hypot.c w_hypotf.c w_hypotl.c
e_jn.c e_jnf.c s_fpclassify.c s_fpclassifyf.c
e_lgamma_r.c e_lgammaf_r.c s_clog.c s_clogf.c s_clogl.c
e_log.c e_logf.c s_log1p.c s_log1pf.c s_log1pl.c
e_log10.c e_log10f.c s_csqrt.c s_csqrtf.c s_csqrtl.c
e_pow.c e_powf.c # e_powl.c s_floor.c s_floorf.c
e_rem_pio2f.c s_ceil.c s_ceilf.c
e_remainder.c e_remainderf.c # e_remainderl.c s_modf.c
e_scalb.c e_scalbf.c # e_scalbl.c w_powf.c e_powf.c
e_sinh.c e_sinhf.c # e_sinhl.c w_pow.c e_pow.c slowpow.c
k_cos.c k_cosf.c w_exp.c e_exp.c slowexp.c
k_sin.c k_sinf.c s_frexp.c s_expm1.c
k_rem_pio2.c k_rem_pio2f.c # k_rem_pio2l.c dosincos.c
k_tan.c k_tanf.c doasin.c
s_asinh.c s_asinhf.c # s_asinhl.c sincos32.c
s_atan.c s_atanf.c # s_atanl.c branred.c
s_cbrt.c s_cbrtf.c # s_cbrtl.c halfulp.c
s_ceil.c s_ceilf.c # s_ceill.c mpa.c mplog.c mpexp.c
s_copysign.c s_copysignf.c # s_copysignl.c s_sin.c
s_cos.c s_cosf.c s_atan.c s_atanf.c #s_atanl.c
s_erf.c s_erff.c # s_erfl.c s_tan.c
s_expm1f.c s_expm1.c e_asin.c e_asinl.c
s_fabs.c s_fabsf.c # s_fabsl.S w_asin.c w_asinl.c
s_finite.c s_finitef.c # s_finitel.c e_log10.c w_log10.c
s_floor.c s_floorf.c # s_floorl.c e_logf.c e_logl.c
s_fma.c s_fmaf.c # s_fmal.c e_acos.c w_acos.c
s_fmax.c s_fmaxf.c # s_fmaxl.c e_atan2.c #e_atan2l.c
s_fmin.c s_fminf.c # s_fminl.c w_atan2.c w_atan2l.c mpatan2.c mpatan.c mptan.c mpsqrt.c w_sqrt.c w_sqrtf.c
s_fpclassify.c s_fpclassifyf.c # s_fpclassifyl.c e_sqrtl.c
s_frexp.c s_frexpf.c # s_frexpl.c e_fmod.c w_fmod.c
s_ilogb.c s_ilogbf.c e_log.c w_log.c
s_isinf.c s_isinff.c # s_isinfl.c e_cosh.c w_cosh.c
s_ldexp.c s_ldexpf.c # s_ldexpl.c e_sinh.c w_sinh.c
s_llrint.c s_llrintf.c # s_llrintl.c s_cosf.c k_cosf.c
s_log1p.c s_log1pf.c s_sinf.c k_sinf.c
s_logb.c s_logbf.c # s_logbl.c s_ldexp.c s_ldexpf.c
s_lrint.c s_lrintf.c # s_lrintl.c s_scalbnf.c s_scalbn.c
s_lround.c s_lroundf.c s_copysign.c s_copysignf.c #s_copysignl.c
s_modf.c s_modff.c # s_modfl.c s_tanh.c s_tanf.c k_tanf.c
s_nan.c s_nanf.c # s_nanl.c s_lround.c s_lroundf.c s_round.c s_roundf.c
s_nextafter.c s_nextafterf.c # s_nextafterl.c s_rint.c s_rintf.c s_lrintf.c
s_nexttoward.c # s_nexttowardf.c s_nexttowardl.c e_fmodf.c w_fmodf.c
s_round.c s_roundf.c # s_roundl.c e_atan2f.c w_atan2f.c
s_scalbn.c s_scalbnf.c # s_scalbnl.c e_rem_pio2f.c k_rem_pio2f.c
s_signbit.c s_signbitf.c # s_signbitl.c
s_significand.c s_significandf.c memrchr.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 : MergeObject <$(architecture)>posix_gnu_arch_$(TARGET_ARCH)_generic.o :
$(genericSources) $(genericSources)
; ;
MergeObject <$(architecture)>posix_gnu_arch_$(TARGET_ARCH)_others.o :
e_sqrt.c
e_sqrtf.c
;
#MergeObject <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH)_other.o : 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) ]
MergeObjectFromObjects <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH).o = [ FDirName $(HAIKU_TOP) src system libroot posix
: : glibc arch generic ]
<$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH)_generic.o [ FDirName $(HAIKU_TOP) src system libroot posix
# <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH)_other.o glibc arch generic longdouble 128bit ] ;
; }
}
SEARCH on [ FGristFiles $(genericSources) ]
= [ FDirName $(HAIKU_TOP) src system libroot posix glibc arch
generic ] ;
@@ -0,0 +1,5 @@
#ifndef _ENDIAN_H
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
#endif
#define __BYTE_ORDER __LITTLE_ENDIAN
@@ -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
@@ -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
@@ -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 */
@@ -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())
@@ -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
@@ -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
@@ -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. */
@@ -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 */
@@ -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
@@ -0,0 +1,5 @@
#ifndef _MATH_H
# error "Never use <bits/nan.h> directly; include <math.h> instead."
#endif
# define NAN (__builtin_nanf (""))
@@ -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 */
@@ -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
@@ -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
@@ -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)
@@ -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 */