diff --git a/lib/libc/include/riscv32-linux-gnu/bits/endianness.h b/lib/libc/include/riscv32-linux-gnu/bits/endianness.h new file mode 100644 index 0000000000000000000000000000000000000000..16a1549ca7fd0546f10f2fa46dcac3190ff86b8d --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/endianness.h @@ -0,0 +1,11 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* RISC-V is little-endian. */ +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif /* bits/endianness.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/environments.h b/lib/libc/include/riscv32-linux-gnu/bits/environments.h new file mode 100644 index 0000000000000000000000000000000000000000..d8ab3220e9203eea202799360959d9ecd87a05dd --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/environments.h @@ -0,0 +1,81 @@ +/* Copyright (C) 2020-2024 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 + . */ + +#ifndef _UNISTD_H +# error "Never include this file directly. Use instead" +#endif + +#include + +/* This header should define the following symbols under the described + situations. A value `1' means that the model is always supported, + `-1' means it is never supported. Undefined means it cannot be + statically decided. + + _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type + _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type + + _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type + _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type + + The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, + _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, + _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were + used in previous versions of the Unix standard and are available + only for compatibility. +*/ + +#if __WORDSIZE == 64 + +/* We can never provide environments with 32-bit wide pointers. */ +# define _POSIX_V7_ILP32_OFF32 -1 +# define _POSIX_V7_ILP32_OFFBIG -1 +# define _POSIX_V6_ILP32_OFF32 -1 +# define _POSIX_V6_ILP32_OFFBIG -1 +# define _XBS5_ILP32_OFF32 -1 +# define _XBS5_ILP32_OFFBIG -1 +/* We also have no use (for now) for an environment with bigger pointers + and offsets. */ +# define _POSIX_V7_LPBIG_OFFBIG -1 +# define _POSIX_V6_LPBIG_OFFBIG -1 +# define _XBS5_LPBIG_OFFBIG -1 + +/* By default we have 64-bit wide `long int', pointers and `off_t'. */ +# define _POSIX_V7_LP64_OFF64 1 +# define _POSIX_V6_LP64_OFF64 1 +# define _XBS5_LP64_OFF64 1 + +#else /* __WORDSIZE == 32 */ + +/* RISC-V requires 64-bit off_t */ +# define _POSIX_V7_ILP32_OFF32 -1 +# define _POSIX_V6_ILP32_OFF32 -1 +# define _XBS5_ILP32_OFF32 -1 + +# define _POSIX_V7_ILP32_OFFBIG 1 +# define _POSIX_V6_ILP32_OFFBIG 1 +# define _XBS5_ILP32_OFFBIG 1 + +/* We can never provide environments with 64-bit wide pointers. */ +# define _POSIX_V7_LP64_OFF64 -1 +# define _POSIX_V7_LPBIG_OFFBIG -1 +# define _POSIX_V6_LP64_OFF64 -1 +# define _POSIX_V6_LPBIG_OFFBIG -1 +# define _XBS5_LP64_OFF64 -1 +# define _XBS5_LPBIG_OFFBIG -1 + +#endif /* __WORDSIZE == 32 */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/fcntl.h b/lib/libc/include/riscv32-linux-gnu/bits/fcntl.h new file mode 100644 index 0000000000000000000000000000000000000000..f61875db67ed87033fc6761321357338fabfa0fa --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/fcntl.h @@ -0,0 +1,62 @@ +/* O_*, F_*, FD_* bit values for Linux / RISC-V. + Copyright (C) 2011-2024 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 + . */ + +#ifndef _FCNTL_H +# error "Never use directly; include instead." +#endif + +#include + +/* In 64-bit ISA files are always with 64bit off_t and F_*LK64 are the same as + non-64-bit versions. It will need to be revised for 128-bit. */ +#if __WORDSIZE == 64 +# define __O_LARGEFILE 0 + +# define F_GETLK64 5 /* Get record locking info. */ +# define F_SETLK64 6 /* Set record locking info (non-blocking). */ +# define F_SETLKW64 7 /* Set record locking info (blocking). */ +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Include generic Linux declarations. */ +#include \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/fenv.h b/lib/libc/include/riscv32-linux-gnu/bits/fenv.h new file mode 100644 index 0000000000000000000000000000000000000000..9467134bb3ed66d180f0eba3cc42e94000053af9 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/fenv.h @@ -0,0 +1,74 @@ +/* Floating point environment, RISC-V version. + Copyright (C) 1998-2024 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 + . */ + +#ifndef _FENV_H +# error "Never use directly; include 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_C2X) +/* 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 \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/floatn.h b/lib/libc/include/riscv32-linux-gnu/bits/floatn.h new file mode 100644 index 0000000000000000000000000000000000000000..20c1af5c2e78d63f234f254435ecf0d8d3ee5017 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/floatn.h @@ -0,0 +1,97 @@ +/* Macros to control TS 18661-3 glibc features on ldbl-128 platforms. + Copyright (C) 2017-2024 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 + . */ + +#ifndef _BITS_FLOATN_H +#define _BITS_FLOATN_H + +#include +#include + +/* 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 && !__GNUC_PREREQ (13, 0)) +/* 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 && !__GNUC_PREREQ (13, 0)) +# 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 && !__GNUC_PREREQ (13, 0)) +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 + +#endif /* _BITS_FLOATN_H */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/link.h b/lib/libc/include/riscv32-linux-gnu/bits/link.h new file mode 100644 index 0000000000000000000000000000000000000000..9aa86a7c51041dfe80b497403bfe8220c26eb232 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/link.h @@ -0,0 +1,56 @@ +/* Machine-specific declarations for dynamic linker interface. RISC-V version. + Copyright (C) 2005-2024 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 + . */ + +#ifndef _LINK_H +# error "Never include directly; use 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 \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/long-double.h b/lib/libc/include/riscv32-linux-gnu/bits/long-double.h new file mode 100644 index 0000000000000000000000000000000000000000..a83f6c746f743a9d157cd3c48b2857af7e4da526 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/long-double.h @@ -0,0 +1,21 @@ +/* Properties of long double type. ldbl-128 version. + Copyright (C) 2016-2024 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 + . */ + +/* long double is distinct from double, so there is nothing to + define here. */ +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/procfs.h b/lib/libc/include/riscv32-linux-gnu/bits/procfs.h new file mode 100644 index 0000000000000000000000000000000000000000..4fab0ffd9ca2b57c9e9d05001d31e7247fae0ccb --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/procfs.h @@ -0,0 +1,31 @@ +/* Types for registers for sys/procfs.h. RISC-V version. + Copyright (C) 1996-2024 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 + . */ + +#ifndef _SYS_PROCFS_H +# error "Never include directly; use instead." +#endif + +#include + +/* ELF register definitions */ +#define ELF_NGREG NGREG +#define ELF_NFPREG NFPREG + +typedef unsigned long int elf_greg_t; +typedef unsigned long int elf_gregset_t[32]; +typedef union __riscv_mc_fp_state elf_fpregset_t; \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/riscv32-linux-gnu/bits/pthreadtypes-arch.h new file mode 100644 index 0000000000000000000000000000000000000000..460d0eaf1cef820c746150e9f20635dfbca6e323 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/pthreadtypes-arch.h @@ -0,0 +1,45 @@ +/* Machine-specific pthread type layouts. RISC-V version. + Copyright (C) 2011-2024 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 + . */ + +#ifndef _BITS_PTHREADTYPES_ARCH_H +#define _BITS_PTHREADTYPES_ARCH_H 1 + +#include + +#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 +#define __SIZEOF_PTHREAD_COND_T 48 +#define __SIZEOF_PTHREAD_CONDATTR_T 4 +#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 +#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 + +#if __WORDSIZE == 64 +# define __SIZEOF_PTHREAD_ATTR_T 56 +# define __SIZEOF_PTHREAD_MUTEX_T 40 +# define __SIZEOF_PTHREAD_RWLOCK_T 56 +# define __SIZEOF_PTHREAD_BARRIER_T 32 +#else +# define __SIZEOF_PTHREAD_ATTR_T 32 +# define __SIZEOF_PTHREAD_MUTEX_T 32 +# define __SIZEOF_PTHREAD_RWLOCK_T 48 +# define __SIZEOF_PTHREAD_BARRIER_T 20 +#endif + +#define __LOCK_ALIGNMENT +#define __ONCE_ALIGNMENT + +#endif /* bits/pthreadtypes.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/rseq.h b/lib/libc/include/riscv32-linux-gnu/bits/rseq.h new file mode 100644 index 0000000000000000000000000000000000000000..5ea695ad1c3d4a4eee314fb1d9b3cc9aa46f1a1d --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/rseq.h @@ -0,0 +1,29 @@ +/* Restartable Sequences architecture header. Stub version. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + + 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 + . */ + +#ifndef _SYS_RSEQ_H +# error "Never use directly; include instead." +#endif + +/* RSEQ_SIG is a signature required before each abort handler code. + + It is a 32-bit value that maps to actual architecture code compiled + into applications and libraries. It needs to be defined for each + architecture. When choosing this value, it needs to be taken into + account that generating invalid instructions may have ill effects on + tools like objdump, and may also have impact on the CPU speculative + execution efficiency in some cases. */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/setjmp.h b/lib/libc/include/riscv32-linux-gnu/bits/setjmp.h new file mode 100644 index 0000000000000000000000000000000000000000..7ccaa193d03daf6d433ba8d0f1d2eab1b4ba0983 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/setjmp.h @@ -0,0 +1,39 @@ +/* Define the machine-dependent type `jmp_buf'. RISC-V version. + Copyright (C) 2011-2024 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 + . */ + +#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 */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/sigcontext.h b/lib/libc/include/riscv32-linux-gnu/bits/sigcontext.h new file mode 100644 index 0000000000000000000000000000000000000000..14050da42c9b6cfb67b932f5d8988b360616c14c --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/sigcontext.h @@ -0,0 +1,31 @@ +/* Machine-dependent signal context structure for Linux. RISC-V version. + Copyright (C) 1996-2024 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 + . */ + +#ifndef _BITS_SIGCONTEXT_H +#define _BITS_SIGCONTEXT_H 1 + +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H +# error "Never use directly; include instead." +#endif + +struct sigcontext { + /* gregs[0] holds the program counter. */ + unsigned long int gregs[32]; + unsigned long long int fpregs[66] __attribute__ ((__aligned__ (16))); +}; + +#endif \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/riscv32-linux-gnu/bits/struct_rwlock.h new file mode 100644 index 0000000000000000000000000000000000000000..0b7afa3e006fbc3c069d84f5231fd4add109aa3c --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/struct_rwlock.h @@ -0,0 +1,68 @@ +/* RISC-V internal rwlock struct definitions. + Copyright (C) 2019-2024 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 + . */ + +#ifndef _RWLOCK_INTERNAL_H +#define _RWLOCK_INTERNAL_H + +/* There is a lot of padding in this structure. While it's not strictly + necessary on RISC-V, we're going to leave it in to be on the safe side in + case it's needed in the future. Most other architectures have the padding, + so this gives us the same extensibility as everyone else has. */ +struct __pthread_rwlock_arch_t +{ + unsigned int __readers; + unsigned int __writers; + unsigned int __wrphase_futex; + unsigned int __writers_futex; + unsigned int __pad3; + unsigned int __pad4; +#if __WORDSIZE == 64 + int __cur_writer; + int __shared; + unsigned long int __pad1; + unsigned long int __pad2; + unsigned int __flags; +#else +# if __BYTE_ORDER == __BIG_ENDIAN + unsigned char __pad1; + unsigned char __pad2; + unsigned char __shared; + unsigned char __flags; +# else + unsigned char __flags; + unsigned char __shared; + unsigned char __pad1; + unsigned char __pad2; +# endif + int __cur_writer; +#endif +}; + +#if __WORDSIZE == 64 +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags +#elif __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/struct_stat.h b/lib/libc/include/riscv32-linux-gnu/bits/struct_stat.h new file mode 100644 index 0000000000000000000000000000000000000000..c8e2d78b57f2b1e99f4a3d9217060f3ddc9ec0dd --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/struct_stat.h @@ -0,0 +1,127 @@ +/* Definition for struct stat. + Copyright (C) 2020-2024 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 + . */ + +#if !defined _SYS_STAT_H && !defined _FCNTL_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 + +#include +#include + +#if defined __USE_FILE_OFFSET64 +# define __field64(type, type64, name) type64 name +#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T +# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T +# error "ino_t and off_t must both be the same type" +# endif +# define __field64(type, type64, name) type name +#elif __BYTE_ORDER == __LITTLE_ENDIAN +# define __field64(type, type64, name) \ + type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad +#else +# define __field64(type, type64, name) \ + int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name +#endif + +struct stat + { + __dev_t st_dev; /* Device. */ + __field64(__ino_t, __ino64_t, st_ino); /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + __dev_t __pad1; + __field64(__off_t, __off64_t, st_size); /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + int __pad2; + __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */ +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif + int __glibc_reserved[2]; + }; + +#undef __field64 + +#ifdef __USE_LARGEFILE64 +struct stat64 + { + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + __dev_t __pad1; + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + int __pad2; + __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif + int __glibc_reserved[2]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV +/* Nanosecond resolution time values are supported. */ +#define _STATBUF_ST_NSEC + +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/time64.h b/lib/libc/include/riscv32-linux-gnu/bits/time64.h new file mode 100644 index 0000000000000000000000000000000000000000..8793352fb2a5fd0a6b5e11e1a7adb8948e83b9e2 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/time64.h @@ -0,0 +1,36 @@ +/* bits/time64.h -- underlying types for __time64_t. RISC-V version. + Copyright (C) 2020-2024 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 + . */ + +#ifndef _BITS_TYPES_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_TIME64_H +#define _BITS_TIME64_H 1 + +/* Define __TIME64_T_TYPE so that it is always a 64-bit type. */ + +#if __WORDSIZE == 64 +/* If we already have 64-bit time type then use it. */ +# define __TIME64_T_TYPE __TIME_T_TYPE +#else +/* Define a 64-bit time type alongsize the 32-bit one. */ +# define __TIME64_T_TYPE __SQUAD_TYPE +#endif + +#endif /* bits/time64.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/timesize.h b/lib/libc/include/riscv32-linux-gnu/bits/timesize.h new file mode 100644 index 0000000000000000000000000000000000000000..17f828ecfe923d221f429a252cf23f1d775eb3e5 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/timesize.h @@ -0,0 +1,20 @@ +/* Bit size of the time_t type at glibc build time, general case. + Copyright (C) 2018-2024 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 + . */ + +/* Size in bits of the 'time_t' type of the default ABI. */ +#define __TIMESIZE 64 \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/typesizes.h b/lib/libc/include/riscv32-linux-gnu/bits/typesizes.h new file mode 100644 index 0000000000000000000000000000000000000000..d875caa94e85b23baefbedc926689dd18ddbea4a --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/typesizes.h @@ -0,0 +1,107 @@ +/* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI. + Copyright (C) 2011-2024 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 + . */ + +#ifndef _BITS_TYPES_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_TYPESIZES_H +#define _BITS_TYPESIZES_H 1 + +/* See for the meaning of these macros. This file exists so + that need not vary across different GNU platforms. */ +#if __TIMESIZE == 64 && __WORDSIZE == 32 +/* These are the "new" y2038 types defined for architectures added after + the 5.1 kernel. */ +# define __INO_T_TYPE __UQUAD_TYPE +# define __OFF_T_TYPE __SQUAD_TYPE +# define __RLIM_T_TYPE __UQUAD_TYPE +# define __BLKCNT_T_TYPE __SQUAD_TYPE +# define __FSBLKCNT_T_TYPE __UQUAD_TYPE +# define __FSFILCNT_T_TYPE __UQUAD_TYPE +# define __TIME_T_TYPE __SQUAD_TYPE +# define __SUSECONDS_T_TYPE __SQUAD_TYPE +#else +# define __INO_T_TYPE __ULONGWORD_TYPE +# define __OFF_T_TYPE __SLONGWORD_TYPE +# define __RLIM_T_TYPE __ULONGWORD_TYPE +# define __BLKCNT_T_TYPE __SLONGWORD_TYPE +# define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE +# define __FSFILCNT_T_TYPE __ULONGWORD_TYPE +# define __TIME_T_TYPE __SLONGWORD_TYPE +# define __SUSECONDS_T_TYPE __SLONGWORD_TYPE +#endif + +#define __DEV_T_TYPE __UQUAD_TYPE +#define __UID_T_TYPE __U32_TYPE +#define __GID_T_TYPE __U32_TYPE +#define __INO64_T_TYPE __UQUAD_TYPE +#define __MODE_T_TYPE __U32_TYPE +#define __NLINK_T_TYPE __U32_TYPE +#define __OFF64_T_TYPE __SQUAD_TYPE +#define __PID_T_TYPE __S32_TYPE +#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSWORD_T_TYPE __SWORD_TYPE +#define __ID_T_TYPE __U32_TYPE +#define __CLOCK_T_TYPE __SLONGWORD_TYPE +#define __USECONDS_T_TYPE __U32_TYPE +#define __SUSECONDS64_T_TYPE __SQUAD_TYPE +#define __DADDR_T_TYPE __S32_TYPE +#define __KEY_T_TYPE __S32_TYPE +#define __CLOCKID_T_TYPE __S32_TYPE +#define __TIMER_T_TYPE void * +#define __BLKSIZE_T_TYPE __S32_TYPE +#define __FSID_T_TYPE struct { int __val[2]; } +#define __SSIZE_T_TYPE __SWORD_TYPE +#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE +#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE +#define __CPU_MASK_TYPE __ULONGWORD_TYPE + +#if defined __LP64__ || (__TIMESIZE == 64 && __WORDSIZE == 32) +/* Tell the libc code that off_t and off64_t are actually the same type + for all ABI purposes, even if possibly expressed as different base types + for C type-checking purposes. */ +# define __OFF_T_MATCHES_OFF64_T 1 + +/* Same for ino_t and ino64_t. */ +# define __INO_T_MATCHES_INO64_T 1 + +/* And for __rlim_t and __rlim64_t. */ +# define __RLIM_T_MATCHES_RLIM64_T 1 + +/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ +# define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 (__WORDSIZE == 64) +#else +# define __RLIM_T_MATCHES_RLIM64_T 0 + +# define __STATFS_MATCHES_STATFS64 0 + +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 +#endif + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + + +#endif /* bits/typesizes.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/bits/wordsize.h b/lib/libc/include/riscv32-linux-gnu/bits/wordsize.h new file mode 100644 index 0000000000000000000000000000000000000000..1c655c99e9d3c1621a7a6a3d7aba97cb09d9dc40 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/bits/wordsize.h @@ -0,0 +1,30 @@ +/* Determine the wordsize from the preprocessor defines. RISC-V version. + Copyright (C) 2002-2024 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 + . */ + +#if __riscv_xlen == (__SIZEOF_POINTER__ * 8) +# define __WORDSIZE __riscv_xlen +#else +# error unsupported ABI +#endif + +#define __WORDSIZE_TIME64_COMPAT32 1 + +#if __WORDSIZE == 32 +# define __WORDSIZE32_SIZE_ULONG 0 +# define __WORDSIZE32_PTRDIFF_LONG 0 +#endif \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/fpu_control.h b/lib/libc/include/riscv32-linux-gnu/fpu_control.h new file mode 100644 index 0000000000000000000000000000000000000000..995a96eef0b0c592a74d4f30060d00126a2dd939 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/fpu_control.h @@ -0,0 +1,74 @@ +/* FPU control word bits. RISC-V version. + Copyright (C) 1996-2024 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 + . */ + +#ifndef _FPU_CONTROL_H +#define _FPU_CONTROL_H + +#include + +#ifndef __riscv_flen + +# define _FPU_RESERVED 0xffffffff +# define _FPU_DEFAULT 0x00000000 +typedef unsigned int fpu_control_t; +# define _FPU_GETCW(cw) (cw) = 0 +# define _FPU_SETCW(cw) do { } while (0) +extern fpu_control_t __fpu_control; + +#else /* __riscv_flen */ + +# define _FPU_RESERVED 0 +# define _FPU_DEFAULT 0 +# define _FPU_IEEE _FPU_DEFAULT + +/* Type of the control word. */ +typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__))); + +/* Macros for accessing the hardware control word. */ +# define _FPU_GETCW(cw) __asm__ volatile ("frsr %0" : "=r" (cw)) +# define _FPU_SETCW(cw) __asm__ volatile ("fssr %z0" : : "rJ" (cw)) + +/* Default control word set at startup. */ +extern fpu_control_t __fpu_control; + +# define _FCLASS(x) (__extension__ ({ int __res; \ + if (sizeof (x) * 8 > __riscv_flen) __builtin_trap (); \ + if (sizeof (x) == 4) asm ("fclass.s %0, %1" : "=r" (__res) : "f" (x)); \ + else if (sizeof (x) == 8) asm ("fclass.d %0, %1" : "=r" (__res) : "f" (x)); \ + else __builtin_trap (); \ + __res; })) + +# define _FCLASS_MINF (1 << 0) +# define _FCLASS_MNORM (1 << 1) +# define _FCLASS_MSUBNORM (1 << 2) +# define _FCLASS_MZERO (1 << 3) +# define _FCLASS_PZERO (1 << 4) +# define _FCLASS_PSUBNORM (1 << 5) +# define _FCLASS_PNORM (1 << 6) +# define _FCLASS_PINF (1 << 7) +# define _FCLASS_SNAN (1 << 8) +# define _FCLASS_QNAN (1 << 9) +# define _FCLASS_ZERO (_FCLASS_MZERO | _FCLASS_PZERO) +# define _FCLASS_SUBNORM (_FCLASS_MSUBNORM | _FCLASS_PSUBNORM) +# define _FCLASS_NORM (_FCLASS_MNORM | _FCLASS_PNORM) +# define _FCLASS_INF (_FCLASS_MINF | _FCLASS_PINF) +# define _FCLASS_NAN (_FCLASS_SNAN | _FCLASS_QNAN) + +#endif /* __riscv_flen */ + +#endif /* fpu_control.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/gnu/lib-names-ilp32d.h b/lib/libc/include/riscv32-linux-gnu/gnu/lib-names-ilp32d.h new file mode 100644 index 0000000000000000000000000000000000000000..5d0f5d7d666d891a269537ba2ec9a70caad1cb3a --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/gnu/lib-names-ilp32d.h @@ -0,0 +1,27 @@ +/* This file is automatically generated. */ +#ifndef __GNU_LIB_NAMES_H +# error "Never use directly; include instead." +#endif + +#define LD_LINUX_RISCV32_ILP32D_SO "ld-linux-riscv32-ilp32d.so.1" +#define LD_SO "ld-linux-riscv32-ilp32d.so.1" +#define LIBANL_SO "libanl.so.1" +#define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" +#define LIBC_SO "libc.so.6" +#define LIBDL_SO "libdl.so.2" +#define LIBGCC_S_SO "libgcc_s.so.1" +#define LIBMVEC_SO "libmvec.so.1" +#define LIBM_SO "libm.so.6" +#define LIBNSL_SO "libnsl.so.1" +#define LIBNSS_COMPAT_SO "libnss_compat.so.2" +#define LIBNSS_DB_SO "libnss_db.so.2" +#define LIBNSS_DNS_SO "libnss_dns.so.2" +#define LIBNSS_FILES_SO "libnss_files.so.2" +#define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" +#define LIBNSS_LDAP_SO "libnss_ldap.so.2" +#define LIBPTHREAD_SO "libpthread.so.0" +#define LIBRESOLV_SO "libresolv.so.2" +#define LIBRT_SO "librt.so.1" +#define LIBTHREAD_DB_SO "libthread_db.so.1" +#define LIBUTIL_SO "libutil.so.1" diff --git a/lib/libc/include/riscv32-linux-gnu/gnu/lib-names.h b/lib/libc/include/riscv32-linux-gnu/gnu/lib-names.h new file mode 100644 index 0000000000000000000000000000000000000000..bd22593296d2fd435dc10404edd671917332a5bb --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/gnu/lib-names.h @@ -0,0 +1,22 @@ +/* This file is automatically generated. + It defines macros to allow user program to find the shared + library files which come as part of GNU libc. */ +#ifndef __GNU_LIB_NAMES_H +#define __GNU_LIB_NAMES_H 1 + +#include + +#if __WORDSIZE == 32 && defined __riscv_float_abi_soft +# include +#endif +#if __WORDSIZE == 32 && defined __riscv_float_abi_double +# include +#endif +#if __WORDSIZE == 64 && defined __riscv_float_abi_soft +# include +#endif +#if __WORDSIZE == 64 && defined __riscv_float_abi_double +# include +#endif + +#endif /* gnu/lib-names.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/gnu/stubs-ilp32d.h b/lib/libc/include/riscv32-linux-gnu/gnu/stubs-ilp32d.h new file mode 100644 index 0000000000000000000000000000000000000000..4d4c0d146a4063129577bff6724df15f3a36b84f --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/gnu/stubs-ilp32d.h @@ -0,0 +1,24 @@ +/* This file is automatically generated. + It defines a symbol `__stub_FUNCTION' for each function + in the C library which is a stub, meaning it will fail + every time called, usually setting errno to ENOSYS. */ + +#ifdef _LIBC + #error Applications may not define the macro _LIBC +#endif + +#define __stub___compat_bdflush +#define __stub___compat_create_module +#define __stub___compat_get_kernel_syms +#define __stub___compat_query_module +#define __stub___compat_uselib +#define __stub_chflags +#define __stub_fchflags +#define __stub_fedisableexcept +#define __stub_feenableexcept +#define __stub_fegetexcept +#define __stub_gtty +#define __stub_revoke +#define __stub_setlogin +#define __stub_sigreturn +#define __stub_stty diff --git a/lib/libc/include/riscv32-linux-gnu/gnu/stubs.h b/lib/libc/include/riscv32-linux-gnu/gnu/stubs.h new file mode 100644 index 0000000000000000000000000000000000000000..833e9c36258fd3599ebbb283a70eefeaef2fb06e --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/gnu/stubs.h @@ -0,0 +1,18 @@ +/* This file is automatically generated. + This file selects the right generated file of `__stub_FUNCTION' macros + based on the architecture being compiled for. */ + +#include + +#if __WORDSIZE == 32 && defined __riscv_float_abi_soft +# include +#endif +#if __WORDSIZE == 32 && defined __riscv_float_abi_double +# include +#endif +#if __WORDSIZE == 64 && defined __riscv_float_abi_soft +# include +#endif +#if __WORDSIZE == 64 && defined __riscv_float_abi_double +# include +#endif \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/ieee754.h b/lib/libc/include/riscv32-linux-gnu/ieee754.h new file mode 100644 index 0000000000000000000000000000000000000000..b1e2ec7dc62289feb601b616bd73553a6fd7930d --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/ieee754.h @@ -0,0 +1,170 @@ +/* Copyright (C) 1992-2024 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 + . */ + +#ifndef _IEEE754_H +#define _IEEE754_H 1 + +#include + +#include + +__BEGIN_DECLS + +union ieee754_float + { + float f; + + /* This is the IEEE 754 single-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int mantissa:23; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:23; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int quiet_nan:1; + unsigned int mantissa:22; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:22; + unsigned int quiet_nan:1; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee_nan; + }; + +#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ + + +union ieee754_double + { + double d; + + /* This is the IEEE 754 double-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:20; + unsigned int mantissa1:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:19; + unsigned int mantissa1:32; +#else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; +#endif + } ieee_nan; + }; + +#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ + + +union ieee854_long_double + { + long double d; + + /* This is the IEEE 854 quad-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:16; + unsigned int mantissa1:32; + unsigned int mantissa2:32; + unsigned int mantissa3:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + /* Together these comprise the mantissa. */ + unsigned int mantissa3:32; + unsigned int mantissa2:32; + unsigned int mantissa1:32; + unsigned int mantissa0:16; + unsigned int exponent:15; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:15; + unsigned int mantissa1:32; + unsigned int mantissa2:32; + unsigned int mantissa3:32; +#else + /* Together these comprise the mantissa. */ + unsigned int mantissa3:32; + unsigned int mantissa2:32; + unsigned int mantissa1:32; + unsigned int mantissa0:15; + unsigned int quiet_nan:1; + unsigned int exponent:15; + unsigned int negative:1; +#endif + } ieee_nan; + }; + +#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */ + +__END_DECLS + +#endif /* ieee754.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/sys/asm.h b/lib/libc/include/riscv32-linux-gnu/sys/asm.h new file mode 100644 index 0000000000000000000000000000000000000000..4e702a7462a39f0927291adfb6e9604db3f2655a --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/sys/asm.h @@ -0,0 +1,66 @@ +/* Miscellaneous macros. + Copyright (C) 2000-2024 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 + . */ + +#ifndef _SYS_ASM_H +#define _SYS_ASM_H + +/* Macros to handle different pointer/register sizes for 32/64-bit code. */ +#if __riscv_xlen == 64 +# define PTRLOG 3 +# define SZREG 8 +# define REG_S sd +# define REG_L ld +#elif __riscv_xlen == 32 +# define PTRLOG 2 +# define SZREG 4 +# define REG_S sw +# define REG_L lw +#else +# error __riscv_xlen must equal 32 or 64 +#endif + +#if !defined __riscv_float_abi_soft +/* For ABI uniformity, reserve 8 bytes for floats, even if double-precision + floating-point is not supported in hardware. */ +# if defined __riscv_float_abi_double +# define FREG_L fld +# define FREG_S fsd +# define SZFREG 8 +# else +# error unsupported FLEN +# endif +#endif + +/* Declare leaf routine. */ +#define LEAF(symbol) \ + .globl symbol; \ + .align 2; \ + .type symbol,@function; \ +symbol: \ + cfi_startproc; + +/* Mark end of function. */ +#undef END +#define END(function) \ + cfi_endproc; \ + .size function,.-function + +/* Stack alignment. */ +#define ALMASK ~15 + +#endif /* sys/asm.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/sys/cachectl.h b/lib/libc/include/riscv32-linux-gnu/sys/cachectl.h new file mode 100644 index 0000000000000000000000000000000000000000..3f1972883227187d03a9700df95aa85bcb74c7f9 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/sys/cachectl.h @@ -0,0 +1,32 @@ +/* RISC-V instruction cache flushing interface + Copyright (C) 2017-2024 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 + . */ + +#ifndef _SYS_CACHECTL_H +#define _SYS_CACHECTL_H 1 + +#include + +__BEGIN_DECLS + +extern int __riscv_flush_icache (void *__start, void *__end, + unsigned long int __flags); + +__END_DECLS + +#endif /* sys/cachectl.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/sys/ucontext.h b/lib/libc/include/riscv32-linux-gnu/sys/ucontext.h new file mode 100644 index 0000000000000000000000000000000000000000..59cff4a158d0ba652d00194a39b660bd32133aaf --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/sys/ucontext.h @@ -0,0 +1,110 @@ +/* struct ucontext definition, RISC-V version. + Copyright (C) 1997-2024 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 + . */ + +/* Don't rely on this, the interface is currently messed up and may need to + be broken to be fixed. */ +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include + +#include +#include + +typedef unsigned long int __riscv_mc_gp_state[32]; + +#ifdef __USE_MISC +# define NGREG 32 + +# define REG_PC 0 +# define REG_RA 1 +# define REG_SP 2 +# define REG_TP 4 +# define REG_S0 8 +# define REG_S1 9 +# define REG_A0 10 +# define REG_S2 18 +# define REG_NARGS 8 + +typedef unsigned long int greg_t; + +/* Container for all general registers. */ +typedef __riscv_mc_gp_state gregset_t; + +/* Container for floating-point state. */ +typedef union __riscv_mc_fp_state fpregset_t; +#endif + +struct __riscv_mc_f_ext_state + { + unsigned int __f[32]; + unsigned int __fcsr; + }; + +struct __riscv_mc_d_ext_state + { + unsigned long long int __f[32]; + unsigned int __fcsr; + }; + +struct __riscv_mc_q_ext_state + { + unsigned long long int __f[64] __attribute__ ((__aligned__ (16))); + unsigned int __fcsr; + /* Reserved for expansion of sigcontext structure. Currently zeroed + upon signal, and must be zero upon sigreturn. */ + unsigned int __glibc_reserved[3]; + }; + +union __riscv_mc_fp_state + { + struct __riscv_mc_f_ext_state __f; + struct __riscv_mc_d_ext_state __d; + struct __riscv_mc_q_ext_state __q; + }; + +typedef struct mcontext_t + { + __riscv_mc_gp_state __gregs; + union __riscv_mc_fp_state __fpregs; + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long int __uc_flags; + struct ucontext_t *uc_link; + stack_t uc_stack; + sigset_t uc_sigmask; + /* There's some padding here to allow sigset_t to be expanded in the + future. Though this is unlikely, other architectures put uc_sigmask + at the end of this structure and explicitly state it can be + expanded, so we didn't want to box ourselves in here. */ + char __glibc_reserved[1024 / 8 - sizeof (sigset_t)]; + /* We can't put uc_sigmask at the end of this structure because we need + to be able to expand sigcontext in the future. For example, the + vector ISA extension will almost certainly add ISA state. We want + to ensure all user-visible ISA state can be saved and restored via a + ucontext, so we're putting this at the end in order to allow for + infinite extensibility. Since we know this will be extended and we + assume sigset_t won't be extended an extreme amount, we're + prioritizing this. */ + mcontext_t uc_mcontext; + } ucontext_t; + +#endif /* sys/ucontext.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnu/sys/user.h b/lib/libc/include/riscv32-linux-gnu/sys/user.h new file mode 100644 index 0000000000000000000000000000000000000000..2a125d9340a7858d203816064ae602938a915340 --- /dev/null +++ b/lib/libc/include/riscv32-linux-gnu/sys/user.h @@ -0,0 +1,23 @@ +/* Copyright (C) 2001-2024 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 + . */ + +#ifndef _SYS_USER_H +#define _SYS_USER_H 1 + + + +#endif /* _SYS_USER_H */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/endianness.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/endianness.h deleted file mode 100644 index 16a1549ca7fd0546f10f2fa46dcac3190ff86b8d..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/endianness.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _BITS_ENDIANNESS_H -#define _BITS_ENDIANNESS_H 1 - -#ifndef _BITS_ENDIAN_H -# error "Never use directly; include instead." -#endif - -/* RISC-V is little-endian. */ -#define __BYTE_ORDER __LITTLE_ENDIAN - -#endif /* bits/endianness.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/environments.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/environments.h deleted file mode 100644 index d8ab3220e9203eea202799360959d9ecd87a05dd..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/environments.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (C) 2020-2024 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 - . */ - -#ifndef _UNISTD_H -# error "Never include this file directly. Use instead" -#endif - -#include - -/* This header should define the following symbols under the described - situations. A value `1' means that the model is always supported, - `-1' means it is never supported. Undefined means it cannot be - statically decided. - - _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type - _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type - - _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type - _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type - - The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, - _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, - _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were - used in previous versions of the Unix standard and are available - only for compatibility. -*/ - -#if __WORDSIZE == 64 - -/* We can never provide environments with 32-bit wide pointers. */ -# define _POSIX_V7_ILP32_OFF32 -1 -# define _POSIX_V7_ILP32_OFFBIG -1 -# define _POSIX_V6_ILP32_OFF32 -1 -# define _POSIX_V6_ILP32_OFFBIG -1 -# define _XBS5_ILP32_OFF32 -1 -# define _XBS5_ILP32_OFFBIG -1 -/* We also have no use (for now) for an environment with bigger pointers - and offsets. */ -# define _POSIX_V7_LPBIG_OFFBIG -1 -# define _POSIX_V6_LPBIG_OFFBIG -1 -# define _XBS5_LPBIG_OFFBIG -1 - -/* By default we have 64-bit wide `long int', pointers and `off_t'. */ -# define _POSIX_V7_LP64_OFF64 1 -# define _POSIX_V6_LP64_OFF64 1 -# define _XBS5_LP64_OFF64 1 - -#else /* __WORDSIZE == 32 */ - -/* RISC-V requires 64-bit off_t */ -# define _POSIX_V7_ILP32_OFF32 -1 -# define _POSIX_V6_ILP32_OFF32 -1 -# define _XBS5_ILP32_OFF32 -1 - -# define _POSIX_V7_ILP32_OFFBIG 1 -# define _POSIX_V6_ILP32_OFFBIG 1 -# define _XBS5_ILP32_OFFBIG 1 - -/* We can never provide environments with 64-bit wide pointers. */ -# define _POSIX_V7_LP64_OFF64 -1 -# define _POSIX_V7_LPBIG_OFFBIG -1 -# define _POSIX_V6_LP64_OFF64 -1 -# define _POSIX_V6_LPBIG_OFFBIG -1 -# define _XBS5_LP64_OFF64 -1 -# define _XBS5_LPBIG_OFFBIG -1 - -#endif /* __WORDSIZE == 32 */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/fcntl.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/fcntl.h deleted file mode 100644 index f61875db67ed87033fc6761321357338fabfa0fa..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/fcntl.h +++ /dev/null @@ -1,62 +0,0 @@ -/* O_*, F_*, FD_* bit values for Linux / RISC-V. - Copyright (C) 2011-2024 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 - . */ - -#ifndef _FCNTL_H -# error "Never use directly; include instead." -#endif - -#include - -/* In 64-bit ISA files are always with 64bit off_t and F_*LK64 are the same as - non-64-bit versions. It will need to be revised for 128-bit. */ -#if __WORDSIZE == 64 -# define __O_LARGEFILE 0 - -# define F_GETLK64 5 /* Get record locking info. */ -# define F_SETLK64 6 /* Set record locking info (non-blocking). */ -# define F_SETLKW64 7 /* Set record locking info (blocking). */ -#endif - -struct flock - { - short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ - short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ -#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64 - __off_t l_start; /* Offset where the lock begins. */ - __off_t l_len; /* Size of the locked area; zero means until EOF. */ -#else - __off64_t l_start; /* Offset where the lock begins. */ - __off64_t l_len; /* Size of the locked area; zero means until EOF. */ -#endif - __pid_t l_pid; /* Process holding the lock. */ - }; - -#ifdef __USE_LARGEFILE64 -struct flock64 - { - short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ - short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ - __off64_t l_start; /* Offset where the lock begins. */ - __off64_t l_len; /* Size of the locked area; zero means until EOF. */ - __pid_t l_pid; /* Process holding the lock. */ - }; -#endif - -/* Include generic Linux declarations. */ -#include \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/fenv.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/fenv.h deleted file mode 100644 index 9467134bb3ed66d180f0eba3cc42e94000053af9..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/fenv.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Floating point environment, RISC-V version. - Copyright (C) 1998-2024 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 - . */ - -#ifndef _FENV_H -# error "Never use directly; include 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_C2X) -/* 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 \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/floatn.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/floatn.h deleted file mode 100644 index 20c1af5c2e78d63f234f254435ecf0d8d3ee5017..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/floatn.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Macros to control TS 18661-3 glibc features on ldbl-128 platforms. - Copyright (C) 2017-2024 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 - . */ - -#ifndef _BITS_FLOATN_H -#define _BITS_FLOATN_H - -#include -#include - -/* 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 && !__GNUC_PREREQ (13, 0)) -/* 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 && !__GNUC_PREREQ (13, 0)) -# 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 && !__GNUC_PREREQ (13, 0)) -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 - -#endif /* _BITS_FLOATN_H */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/link.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/link.h deleted file mode 100644 index 9aa86a7c51041dfe80b497403bfe8220c26eb232..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/link.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Machine-specific declarations for dynamic linker interface. RISC-V version. - Copyright (C) 2005-2024 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 - . */ - -#ifndef _LINK_H -# error "Never include directly; use 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 \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/long-double.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/long-double.h deleted file mode 100644 index a83f6c746f743a9d157cd3c48b2857af7e4da526..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/long-double.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Properties of long double type. ldbl-128 version. - Copyright (C) 2016-2024 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 - . */ - -/* long double is distinct from double, so there is nothing to - define here. */ -#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/procfs.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/procfs.h deleted file mode 100644 index 4fab0ffd9ca2b57c9e9d05001d31e7247fae0ccb..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/procfs.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Types for registers for sys/procfs.h. RISC-V version. - Copyright (C) 1996-2024 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 - . */ - -#ifndef _SYS_PROCFS_H -# error "Never include directly; use instead." -#endif - -#include - -/* ELF register definitions */ -#define ELF_NGREG NGREG -#define ELF_NFPREG NFPREG - -typedef unsigned long int elf_greg_t; -typedef unsigned long int elf_gregset_t[32]; -typedef union __riscv_mc_fp_state elf_fpregset_t; \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/pthreadtypes-arch.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/pthreadtypes-arch.h deleted file mode 100644 index 460d0eaf1cef820c746150e9f20635dfbca6e323..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/pthreadtypes-arch.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Machine-specific pthread type layouts. RISC-V version. - Copyright (C) 2011-2024 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 - . */ - -#ifndef _BITS_PTHREADTYPES_ARCH_H -#define _BITS_PTHREADTYPES_ARCH_H 1 - -#include - -#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -#define __SIZEOF_PTHREAD_COND_T 48 -#define __SIZEOF_PTHREAD_CONDATTR_T 4 -#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 - -#if __WORDSIZE == 64 -# define __SIZEOF_PTHREAD_ATTR_T 56 -# define __SIZEOF_PTHREAD_MUTEX_T 40 -# define __SIZEOF_PTHREAD_RWLOCK_T 56 -# define __SIZEOF_PTHREAD_BARRIER_T 32 -#else -# define __SIZEOF_PTHREAD_ATTR_T 32 -# define __SIZEOF_PTHREAD_MUTEX_T 32 -# define __SIZEOF_PTHREAD_RWLOCK_T 48 -# define __SIZEOF_PTHREAD_BARRIER_T 20 -#endif - -#define __LOCK_ALIGNMENT -#define __ONCE_ALIGNMENT - -#endif /* bits/pthreadtypes.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/rseq.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/rseq.h deleted file mode 100644 index 5ea695ad1c3d4a4eee314fb1d9b3cc9aa46f1a1d..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/rseq.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Restartable Sequences architecture header. Stub version. - Copyright (C) 2021-2024 Free Software Foundation, Inc. - - 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 - . */ - -#ifndef _SYS_RSEQ_H -# error "Never use directly; include instead." -#endif - -/* RSEQ_SIG is a signature required before each abort handler code. - - It is a 32-bit value that maps to actual architecture code compiled - into applications and libraries. It needs to be defined for each - architecture. When choosing this value, it needs to be taken into - account that generating invalid instructions may have ill effects on - tools like objdump, and may also have impact on the CPU speculative - execution efficiency in some cases. */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/setjmp.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/setjmp.h deleted file mode 100644 index 7ccaa193d03daf6d433ba8d0f1d2eab1b4ba0983..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/setjmp.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Define the machine-dependent type `jmp_buf'. RISC-V version. - Copyright (C) 2011-2024 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 - . */ - -#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 */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/sigcontext.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/sigcontext.h deleted file mode 100644 index 14050da42c9b6cfb67b932f5d8988b360616c14c..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/sigcontext.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Machine-dependent signal context structure for Linux. RISC-V version. - Copyright (C) 1996-2024 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 - . */ - -#ifndef _BITS_SIGCONTEXT_H -#define _BITS_SIGCONTEXT_H 1 - -#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H -# error "Never use directly; include instead." -#endif - -struct sigcontext { - /* gregs[0] holds the program counter. */ - unsigned long int gregs[32]; - unsigned long long int fpregs[66] __attribute__ ((__aligned__ (16))); -}; - -#endif \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/struct_rwlock.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/struct_rwlock.h deleted file mode 100644 index 0b7afa3e006fbc3c069d84f5231fd4add109aa3c..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/struct_rwlock.h +++ /dev/null @@ -1,68 +0,0 @@ -/* RISC-V internal rwlock struct definitions. - Copyright (C) 2019-2024 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 - . */ - -#ifndef _RWLOCK_INTERNAL_H -#define _RWLOCK_INTERNAL_H - -/* There is a lot of padding in this structure. While it's not strictly - necessary on RISC-V, we're going to leave it in to be on the safe side in - case it's needed in the future. Most other architectures have the padding, - so this gives us the same extensibility as everyone else has. */ -struct __pthread_rwlock_arch_t -{ - unsigned int __readers; - unsigned int __writers; - unsigned int __wrphase_futex; - unsigned int __writers_futex; - unsigned int __pad3; - unsigned int __pad4; -#if __WORDSIZE == 64 - int __cur_writer; - int __shared; - unsigned long int __pad1; - unsigned long int __pad2; - unsigned int __flags; -#else -# if __BYTE_ORDER == __BIG_ENDIAN - unsigned char __pad1; - unsigned char __pad2; - unsigned char __shared; - unsigned char __flags; -# else - unsigned char __flags; - unsigned char __shared; - unsigned char __pad1; - unsigned char __pad2; -# endif - int __cur_writer; -#endif -}; - -#if __WORDSIZE == 64 -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags -#elif __BYTE_ORDER == __BIG_ENDIAN -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 -#else -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 -#endif - -#endif \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/struct_stat.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/struct_stat.h deleted file mode 100644 index c8e2d78b57f2b1e99f4a3d9217060f3ddc9ec0dd..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/struct_stat.h +++ /dev/null @@ -1,127 +0,0 @@ -/* Definition for struct stat. - Copyright (C) 2020-2024 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 - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STRUCT_STAT_H -#define _BITS_STRUCT_STAT_H 1 - -#include -#include - -#if defined __USE_FILE_OFFSET64 -# define __field64(type, type64, name) type64 name -#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T -# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T -# error "ino_t and off_t must both be the same type" -# endif -# define __field64(type, type64, name) type name -#elif __BYTE_ORDER == __LITTLE_ENDIAN -# define __field64(type, type64, name) \ - type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad -#else -# define __field64(type, type64, name) \ - int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name -#endif - -struct stat - { - __dev_t st_dev; /* Device. */ - __field64(__ino_t, __ino64_t, st_ino); /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - __dev_t __pad1; - __field64(__off_t, __off64_t, st_size); /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - int __pad2; - __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */ -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - int __glibc_reserved[2]; - }; - -#undef __field64 - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - __dev_t __pad1; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - int __pad2; - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - int __glibc_reserved[2]; - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC - -#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/time64.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/time64.h deleted file mode 100644 index 8793352fb2a5fd0a6b5e11e1a7adb8948e83b9e2..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/time64.h +++ /dev/null @@ -1,36 +0,0 @@ -/* bits/time64.h -- underlying types for __time64_t. RISC-V version. - Copyright (C) 2020-2024 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 - . */ - -#ifndef _BITS_TYPES_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_TIME64_H -#define _BITS_TIME64_H 1 - -/* Define __TIME64_T_TYPE so that it is always a 64-bit type. */ - -#if __WORDSIZE == 64 -/* If we already have 64-bit time type then use it. */ -# define __TIME64_T_TYPE __TIME_T_TYPE -#else -/* Define a 64-bit time type alongsize the 32-bit one. */ -# define __TIME64_T_TYPE __SQUAD_TYPE -#endif - -#endif /* bits/time64.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/timesize.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/timesize.h deleted file mode 100644 index 17f828ecfe923d221f429a252cf23f1d775eb3e5..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/timesize.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Bit size of the time_t type at glibc build time, general case. - Copyright (C) 2018-2024 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 - . */ - -/* Size in bits of the 'time_t' type of the default ABI. */ -#define __TIMESIZE 64 \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/typesizes.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/typesizes.h deleted file mode 100644 index d875caa94e85b23baefbedc926689dd18ddbea4a..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/typesizes.h +++ /dev/null @@ -1,107 +0,0 @@ -/* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI. - Copyright (C) 2011-2024 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 - . */ - -#ifndef _BITS_TYPES_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_TYPESIZES_H -#define _BITS_TYPESIZES_H 1 - -/* See for the meaning of these macros. This file exists so - that need not vary across different GNU platforms. */ -#if __TIMESIZE == 64 && __WORDSIZE == 32 -/* These are the "new" y2038 types defined for architectures added after - the 5.1 kernel. */ -# define __INO_T_TYPE __UQUAD_TYPE -# define __OFF_T_TYPE __SQUAD_TYPE -# define __RLIM_T_TYPE __UQUAD_TYPE -# define __BLKCNT_T_TYPE __SQUAD_TYPE -# define __FSBLKCNT_T_TYPE __UQUAD_TYPE -# define __FSFILCNT_T_TYPE __UQUAD_TYPE -# define __TIME_T_TYPE __SQUAD_TYPE -# define __SUSECONDS_T_TYPE __SQUAD_TYPE -#else -# define __INO_T_TYPE __ULONGWORD_TYPE -# define __OFF_T_TYPE __SLONGWORD_TYPE -# define __RLIM_T_TYPE __ULONGWORD_TYPE -# define __BLKCNT_T_TYPE __SLONGWORD_TYPE -# define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -# define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -# define __TIME_T_TYPE __SLONGWORD_TYPE -# define __SUSECONDS_T_TYPE __SLONGWORD_TYPE -#endif - -#define __DEV_T_TYPE __UQUAD_TYPE -#define __UID_T_TYPE __U32_TYPE -#define __GID_T_TYPE __U32_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE -#define __MODE_T_TYPE __U32_TYPE -#define __NLINK_T_TYPE __U32_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE -#define __PID_T_TYPE __S32_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE -#define __FSWORD_T_TYPE __SWORD_TYPE -#define __ID_T_TYPE __U32_TYPE -#define __CLOCK_T_TYPE __SLONGWORD_TYPE -#define __USECONDS_T_TYPE __U32_TYPE -#define __SUSECONDS64_T_TYPE __SQUAD_TYPE -#define __DADDR_T_TYPE __S32_TYPE -#define __KEY_T_TYPE __S32_TYPE -#define __CLOCKID_T_TYPE __S32_TYPE -#define __TIMER_T_TYPE void * -#define __BLKSIZE_T_TYPE __S32_TYPE -#define __FSID_T_TYPE struct { int __val[2]; } -#define __SSIZE_T_TYPE __SWORD_TYPE -#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE -#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE -#define __CPU_MASK_TYPE __ULONGWORD_TYPE - -#if defined __LP64__ || (__TIMESIZE == 64 && __WORDSIZE == 32) -/* Tell the libc code that off_t and off64_t are actually the same type - for all ABI purposes, even if possibly expressed as different base types - for C type-checking purposes. */ -# define __OFF_T_MATCHES_OFF64_T 1 - -/* Same for ino_t and ino64_t. */ -# define __INO_T_MATCHES_INO64_T 1 - -/* And for __rlim_t and __rlim64_t. */ -# define __RLIM_T_MATCHES_RLIM64_T 1 - -/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ -# define __STATFS_MATCHES_STATFS64 1 - -/* And for getitimer, setitimer and rusage */ -# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 (__WORDSIZE == 64) -#else -# define __RLIM_T_MATCHES_RLIM64_T 0 - -# define __STATFS_MATCHES_STATFS64 0 - -# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 -#endif - -/* Number of descriptors that can fit in an `fd_set'. */ -#define __FD_SETSIZE 1024 - - -#endif /* bits/typesizes.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/bits/wordsize.h b/lib/libc/include/riscv32-linux-gnuilp32/bits/wordsize.h deleted file mode 100644 index 1c655c99e9d3c1621a7a6a3d7aba97cb09d9dc40..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/bits/wordsize.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Determine the wordsize from the preprocessor defines. RISC-V version. - Copyright (C) 2002-2024 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 - . */ - -#if __riscv_xlen == (__SIZEOF_POINTER__ * 8) -# define __WORDSIZE __riscv_xlen -#else -# error unsupported ABI -#endif - -#define __WORDSIZE_TIME64_COMPAT32 1 - -#if __WORDSIZE == 32 -# define __WORDSIZE32_SIZE_ULONG 0 -# define __WORDSIZE32_PTRDIFF_LONG 0 -#endif \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/fpu_control.h b/lib/libc/include/riscv32-linux-gnuilp32/fpu_control.h deleted file mode 100644 index 995a96eef0b0c592a74d4f30060d00126a2dd939..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/fpu_control.h +++ /dev/null @@ -1,74 +0,0 @@ -/* FPU control word bits. RISC-V version. - Copyright (C) 1996-2024 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 - . */ - -#ifndef _FPU_CONTROL_H -#define _FPU_CONTROL_H - -#include - -#ifndef __riscv_flen - -# define _FPU_RESERVED 0xffffffff -# define _FPU_DEFAULT 0x00000000 -typedef unsigned int fpu_control_t; -# define _FPU_GETCW(cw) (cw) = 0 -# define _FPU_SETCW(cw) do { } while (0) -extern fpu_control_t __fpu_control; - -#else /* __riscv_flen */ - -# define _FPU_RESERVED 0 -# define _FPU_DEFAULT 0 -# define _FPU_IEEE _FPU_DEFAULT - -/* Type of the control word. */ -typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__))); - -/* Macros for accessing the hardware control word. */ -# define _FPU_GETCW(cw) __asm__ volatile ("frsr %0" : "=r" (cw)) -# define _FPU_SETCW(cw) __asm__ volatile ("fssr %z0" : : "rJ" (cw)) - -/* Default control word set at startup. */ -extern fpu_control_t __fpu_control; - -# define _FCLASS(x) (__extension__ ({ int __res; \ - if (sizeof (x) * 8 > __riscv_flen) __builtin_trap (); \ - if (sizeof (x) == 4) asm ("fclass.s %0, %1" : "=r" (__res) : "f" (x)); \ - else if (sizeof (x) == 8) asm ("fclass.d %0, %1" : "=r" (__res) : "f" (x)); \ - else __builtin_trap (); \ - __res; })) - -# define _FCLASS_MINF (1 << 0) -# define _FCLASS_MNORM (1 << 1) -# define _FCLASS_MSUBNORM (1 << 2) -# define _FCLASS_MZERO (1 << 3) -# define _FCLASS_PZERO (1 << 4) -# define _FCLASS_PSUBNORM (1 << 5) -# define _FCLASS_PNORM (1 << 6) -# define _FCLASS_PINF (1 << 7) -# define _FCLASS_SNAN (1 << 8) -# define _FCLASS_QNAN (1 << 9) -# define _FCLASS_ZERO (_FCLASS_MZERO | _FCLASS_PZERO) -# define _FCLASS_SUBNORM (_FCLASS_MSUBNORM | _FCLASS_PSUBNORM) -# define _FCLASS_NORM (_FCLASS_MNORM | _FCLASS_PNORM) -# define _FCLASS_INF (_FCLASS_MINF | _FCLASS_PINF) -# define _FCLASS_NAN (_FCLASS_SNAN | _FCLASS_QNAN) - -#endif /* __riscv_flen */ - -#endif /* fpu_control.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/gnu/lib-names-ilp32.h b/lib/libc/include/riscv32-linux-gnuilp32/gnu/lib-names-ilp32.h deleted file mode 100644 index f7cf1ab8a20aa4918dec394e898a17af5f5aea29..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/gnu/lib-names-ilp32.h +++ /dev/null @@ -1,27 +0,0 @@ -/* This file is automatically generated. */ -#ifndef __GNU_LIB_NAMES_H -# error "Never use directly; include instead." -#endif - -#define LD_LINUX_RISCV32_ILP32_SO "ld-linux-riscv32-ilp32.so.1" -#define LD_SO "ld-linux-riscv32-ilp32.so.1" -#define LIBANL_SO "libanl.so.1" -#define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" -#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" -#define LIBC_SO "libc.so.6" -#define LIBDL_SO "libdl.so.2" -#define LIBGCC_S_SO "libgcc_s.so.1" -#define LIBMVEC_SO "libmvec.so.1" -#define LIBM_SO "libm.so.6" -#define LIBNSL_SO "libnsl.so.1" -#define LIBNSS_COMPAT_SO "libnss_compat.so.2" -#define LIBNSS_DB_SO "libnss_db.so.2" -#define LIBNSS_DNS_SO "libnss_dns.so.2" -#define LIBNSS_FILES_SO "libnss_files.so.2" -#define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" -#define LIBNSS_LDAP_SO "libnss_ldap.so.2" -#define LIBPTHREAD_SO "libpthread.so.0" -#define LIBRESOLV_SO "libresolv.so.2" -#define LIBRT_SO "librt.so.1" -#define LIBTHREAD_DB_SO "libthread_db.so.1" -#define LIBUTIL_SO "libutil.so.1" \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/gnu/lib-names.h b/lib/libc/include/riscv32-linux-gnuilp32/gnu/lib-names.h deleted file mode 100644 index bd22593296d2fd435dc10404edd671917332a5bb..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/gnu/lib-names.h +++ /dev/null @@ -1,22 +0,0 @@ -/* This file is automatically generated. - It defines macros to allow user program to find the shared - library files which come as part of GNU libc. */ -#ifndef __GNU_LIB_NAMES_H -#define __GNU_LIB_NAMES_H 1 - -#include - -#if __WORDSIZE == 32 && defined __riscv_float_abi_soft -# include -#endif -#if __WORDSIZE == 32 && defined __riscv_float_abi_double -# include -#endif -#if __WORDSIZE == 64 && defined __riscv_float_abi_soft -# include -#endif -#if __WORDSIZE == 64 && defined __riscv_float_abi_double -# include -#endif - -#endif /* gnu/lib-names.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/gnu/stubs-ilp32.h b/lib/libc/include/riscv32-linux-gnuilp32/gnu/stubs-ilp32.h deleted file mode 100644 index 6ce02418e69609f4642a522910708769e96d6ee9..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/gnu/stubs-ilp32.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is automatically generated. - It defines a symbol `__stub_FUNCTION' for each function - in the C library which is a stub, meaning it will fail - every time called, usually setting errno to ENOSYS. */ - -#ifdef _LIBC - #error Applications may not define the macro _LIBC -#endif - -#define __stub___compat_bdflush -#define __stub___compat_create_module -#define __stub___compat_get_kernel_syms -#define __stub___compat_query_module -#define __stub___compat_uselib -#define __stub_chflags -#define __stub_fchflags -#define __stub_feclearexcept -#define __stub_fedisableexcept -#define __stub_feenableexcept -#define __stub_fegetenv -#define __stub_fegetexcept -#define __stub_fegetexceptflag -#define __stub_fegetmode -#define __stub_fegetround -#define __stub_feholdexcept -#define __stub_feraiseexcept -#define __stub_fesetenv -#define __stub_fesetexcept -#define __stub_fesetexceptflag -#define __stub_fesetmode -#define __stub_fesetround -#define __stub_fetestexcept -#define __stub_feupdateenv -#define __stub_gtty -#define __stub_revoke -#define __stub_setlogin -#define __stub_sigreturn -#define __stub_stty \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/gnu/stubs.h b/lib/libc/include/riscv32-linux-gnuilp32/gnu/stubs.h deleted file mode 100644 index 833e9c36258fd3599ebbb283a70eefeaef2fb06e..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/gnu/stubs.h +++ /dev/null @@ -1,18 +0,0 @@ -/* This file is automatically generated. - This file selects the right generated file of `__stub_FUNCTION' macros - based on the architecture being compiled for. */ - -#include - -#if __WORDSIZE == 32 && defined __riscv_float_abi_soft -# include -#endif -#if __WORDSIZE == 32 && defined __riscv_float_abi_double -# include -#endif -#if __WORDSIZE == 64 && defined __riscv_float_abi_soft -# include -#endif -#if __WORDSIZE == 64 && defined __riscv_float_abi_double -# include -#endif \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/ieee754.h b/lib/libc/include/riscv32-linux-gnuilp32/ieee754.h deleted file mode 100644 index b1e2ec7dc62289feb601b616bd73553a6fd7930d..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/ieee754.h +++ /dev/null @@ -1,170 +0,0 @@ -/* Copyright (C) 1992-2024 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 - . */ - -#ifndef _IEEE754_H -#define _IEEE754_H 1 - -#include - -#include - -__BEGIN_DECLS - -union ieee754_float - { - float f; - - /* This is the IEEE 754 single-precision format. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:8; - unsigned int mantissa:23; -#endif /* Big endian. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN - unsigned int mantissa:23; - unsigned int exponent:8; - unsigned int negative:1; -#endif /* Little endian. */ - } ieee; - - /* This format makes it easier to see if a NaN is a signalling NaN. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:8; - unsigned int quiet_nan:1; - unsigned int mantissa:22; -#endif /* Big endian. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN - unsigned int mantissa:22; - unsigned int quiet_nan:1; - unsigned int exponent:8; - unsigned int negative:1; -#endif /* Little endian. */ - } ieee_nan; - }; - -#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ - - -union ieee754_double - { - double d; - - /* This is the IEEE 754 double-precision format. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:11; - /* Together these comprise the mantissa. */ - unsigned int mantissa0:20; - unsigned int mantissa1:32; -#endif /* Big endian. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN - /* Together these comprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:20; - unsigned int exponent:11; - unsigned int negative:1; -#endif /* Little endian. */ - } ieee; - - /* This format makes it easier to see if a NaN is a signalling NaN. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:11; - unsigned int quiet_nan:1; - /* Together these comprise the mantissa. */ - unsigned int mantissa0:19; - unsigned int mantissa1:32; -#else - /* Together these comprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:19; - unsigned int quiet_nan:1; - unsigned int exponent:11; - unsigned int negative:1; -#endif - } ieee_nan; - }; - -#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ - - -union ieee854_long_double - { - long double d; - - /* This is the IEEE 854 quad-precision format. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:15; - /* Together these comprise the mantissa. */ - unsigned int mantissa0:16; - unsigned int mantissa1:32; - unsigned int mantissa2:32; - unsigned int mantissa3:32; -#endif /* Big endian. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN - /* Together these comprise the mantissa. */ - unsigned int mantissa3:32; - unsigned int mantissa2:32; - unsigned int mantissa1:32; - unsigned int mantissa0:16; - unsigned int exponent:15; - unsigned int negative:1; -#endif /* Little endian. */ - } ieee; - - /* This format makes it easier to see if a NaN is a signalling NaN. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:15; - unsigned int quiet_nan:1; - /* Together these comprise the mantissa. */ - unsigned int mantissa0:15; - unsigned int mantissa1:32; - unsigned int mantissa2:32; - unsigned int mantissa3:32; -#else - /* Together these comprise the mantissa. */ - unsigned int mantissa3:32; - unsigned int mantissa2:32; - unsigned int mantissa1:32; - unsigned int mantissa0:15; - unsigned int quiet_nan:1; - unsigned int exponent:15; - unsigned int negative:1; -#endif - } ieee_nan; - }; - -#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */ - -__END_DECLS - -#endif /* ieee754.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/sys/asm.h b/lib/libc/include/riscv32-linux-gnuilp32/sys/asm.h deleted file mode 100644 index 4e702a7462a39f0927291adfb6e9604db3f2655a..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/sys/asm.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Miscellaneous macros. - Copyright (C) 2000-2024 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 - . */ - -#ifndef _SYS_ASM_H -#define _SYS_ASM_H - -/* Macros to handle different pointer/register sizes for 32/64-bit code. */ -#if __riscv_xlen == 64 -# define PTRLOG 3 -# define SZREG 8 -# define REG_S sd -# define REG_L ld -#elif __riscv_xlen == 32 -# define PTRLOG 2 -# define SZREG 4 -# define REG_S sw -# define REG_L lw -#else -# error __riscv_xlen must equal 32 or 64 -#endif - -#if !defined __riscv_float_abi_soft -/* For ABI uniformity, reserve 8 bytes for floats, even if double-precision - floating-point is not supported in hardware. */ -# if defined __riscv_float_abi_double -# define FREG_L fld -# define FREG_S fsd -# define SZFREG 8 -# else -# error unsupported FLEN -# endif -#endif - -/* Declare leaf routine. */ -#define LEAF(symbol) \ - .globl symbol; \ - .align 2; \ - .type symbol,@function; \ -symbol: \ - cfi_startproc; - -/* Mark end of function. */ -#undef END -#define END(function) \ - cfi_endproc; \ - .size function,.-function - -/* Stack alignment. */ -#define ALMASK ~15 - -#endif /* sys/asm.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/sys/cachectl.h b/lib/libc/include/riscv32-linux-gnuilp32/sys/cachectl.h deleted file mode 100644 index 3f1972883227187d03a9700df95aa85bcb74c7f9..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/sys/cachectl.h +++ /dev/null @@ -1,32 +0,0 @@ -/* RISC-V instruction cache flushing interface - Copyright (C) 2017-2024 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 - . */ - -#ifndef _SYS_CACHECTL_H -#define _SYS_CACHECTL_H 1 - -#include - -__BEGIN_DECLS - -extern int __riscv_flush_icache (void *__start, void *__end, - unsigned long int __flags); - -__END_DECLS - -#endif /* sys/cachectl.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/sys/ucontext.h b/lib/libc/include/riscv32-linux-gnuilp32/sys/ucontext.h deleted file mode 100644 index 59cff4a158d0ba652d00194a39b660bd32133aaf..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/sys/ucontext.h +++ /dev/null @@ -1,110 +0,0 @@ -/* struct ucontext definition, RISC-V version. - Copyright (C) 1997-2024 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 - . */ - -/* Don't rely on this, the interface is currently messed up and may need to - be broken to be fixed. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include - -#include -#include - -typedef unsigned long int __riscv_mc_gp_state[32]; - -#ifdef __USE_MISC -# define NGREG 32 - -# define REG_PC 0 -# define REG_RA 1 -# define REG_SP 2 -# define REG_TP 4 -# define REG_S0 8 -# define REG_S1 9 -# define REG_A0 10 -# define REG_S2 18 -# define REG_NARGS 8 - -typedef unsigned long int greg_t; - -/* Container for all general registers. */ -typedef __riscv_mc_gp_state gregset_t; - -/* Container for floating-point state. */ -typedef union __riscv_mc_fp_state fpregset_t; -#endif - -struct __riscv_mc_f_ext_state - { - unsigned int __f[32]; - unsigned int __fcsr; - }; - -struct __riscv_mc_d_ext_state - { - unsigned long long int __f[32]; - unsigned int __fcsr; - }; - -struct __riscv_mc_q_ext_state - { - unsigned long long int __f[64] __attribute__ ((__aligned__ (16))); - unsigned int __fcsr; - /* Reserved for expansion of sigcontext structure. Currently zeroed - upon signal, and must be zero upon sigreturn. */ - unsigned int __glibc_reserved[3]; - }; - -union __riscv_mc_fp_state - { - struct __riscv_mc_f_ext_state __f; - struct __riscv_mc_d_ext_state __d; - struct __riscv_mc_q_ext_state __q; - }; - -typedef struct mcontext_t - { - __riscv_mc_gp_state __gregs; - union __riscv_mc_fp_state __fpregs; - } mcontext_t; - -/* Userlevel context. */ -typedef struct ucontext_t - { - unsigned long int __uc_flags; - struct ucontext_t *uc_link; - stack_t uc_stack; - sigset_t uc_sigmask; - /* There's some padding here to allow sigset_t to be expanded in the - future. Though this is unlikely, other architectures put uc_sigmask - at the end of this structure and explicitly state it can be - expanded, so we didn't want to box ourselves in here. */ - char __glibc_reserved[1024 / 8 - sizeof (sigset_t)]; - /* We can't put uc_sigmask at the end of this structure because we need - to be able to expand sigcontext in the future. For example, the - vector ISA extension will almost certainly add ISA state. We want - to ensure all user-visible ISA state can be saved and restored via a - ucontext, so we're putting this at the end in order to allow for - infinite extensibility. Since we know this will be extended and we - assume sigset_t won't be extended an extreme amount, we're - prioritizing this. */ - mcontext_t uc_mcontext; - } ucontext_t; - -#endif /* sys/ucontext.h */ \ No newline at end of file diff --git a/lib/libc/include/riscv32-linux-gnuilp32/sys/user.h b/lib/libc/include/riscv32-linux-gnuilp32/sys/user.h deleted file mode 100644 index 2a125d9340a7858d203816064ae602938a915340..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv32-linux-gnuilp32/sys/user.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (C) 2001-2024 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 - . */ - -#ifndef _SYS_USER_H -#define _SYS_USER_H 1 - - - -#endif /* _SYS_USER_H */ \ No newline at end of file diff --git a/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64.h b/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64.h deleted file mode 100644 index facadbf08830886c6e99cb83aa5782c5412e9e94..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64.h +++ /dev/null @@ -1,27 +0,0 @@ -/* This file is automatically generated. */ -#ifndef __GNU_LIB_NAMES_H -# error "Never use directly; include instead." -#endif - -#define LD_LINUX_RISCV64_LP64_SO "ld-linux-riscv64-lp64.so.1" -#define LD_SO "ld-linux-riscv64-lp64.so.1" -#define LIBANL_SO "libanl.so.1" -#define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" -#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" -#define LIBC_SO "libc.so.6" -#define LIBDL_SO "libdl.so.2" -#define LIBGCC_S_SO "libgcc_s.so.1" -#define LIBMVEC_SO "libmvec.so.1" -#define LIBM_SO "libm.so.6" -#define LIBNSL_SO "libnsl.so.1" -#define LIBNSS_COMPAT_SO "libnss_compat.so.2" -#define LIBNSS_DB_SO "libnss_db.so.2" -#define LIBNSS_DNS_SO "libnss_dns.so.2" -#define LIBNSS_FILES_SO "libnss_files.so.2" -#define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" -#define LIBNSS_LDAP_SO "libnss_ldap.so.2" -#define LIBPTHREAD_SO "libpthread.so.0" -#define LIBRESOLV_SO "libresolv.so.2" -#define LIBRT_SO "librt.so.1" -#define LIBTHREAD_DB_SO "libthread_db.so.1" -#define LIBUTIL_SO "libutil.so.1" \ No newline at end of file diff --git a/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64d.h b/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64d.h new file mode 100644 index 0000000000000000000000000000000000000000..e16743eb16650f8adba82d2a2f287eaf61c9d950 --- /dev/null +++ b/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64d.h @@ -0,0 +1,27 @@ +/* This file is automatically generated. */ +#ifndef __GNU_LIB_NAMES_H +# error "Never use directly; include instead." +#endif + +#define LD_LINUX_RISCV64_LP64D_SO "ld-linux-riscv64-lp64d.so.1" +#define LD_SO "ld-linux-riscv64-lp64d.so.1" +#define LIBANL_SO "libanl.so.1" +#define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" +#define LIBC_SO "libc.so.6" +#define LIBDL_SO "libdl.so.2" +#define LIBGCC_S_SO "libgcc_s.so.1" +#define LIBMVEC_SO "libmvec.so.1" +#define LIBM_SO "libm.so.6" +#define LIBNSL_SO "libnsl.so.1" +#define LIBNSS_COMPAT_SO "libnss_compat.so.2" +#define LIBNSS_DB_SO "libnss_db.so.2" +#define LIBNSS_DNS_SO "libnss_dns.so.2" +#define LIBNSS_FILES_SO "libnss_files.so.2" +#define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" +#define LIBNSS_LDAP_SO "libnss_ldap.so.2" +#define LIBPTHREAD_SO "libpthread.so.0" +#define LIBRESOLV_SO "libresolv.so.2" +#define LIBRT_SO "librt.so.1" +#define LIBTHREAD_DB_SO "libthread_db.so.1" +#define LIBUTIL_SO "libutil.so.1" diff --git a/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64.h b/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64.h deleted file mode 100644 index 6ce02418e69609f4642a522910708769e96d6ee9..0000000000000000000000000000000000000000 --- a/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is automatically generated. - It defines a symbol `__stub_FUNCTION' for each function - in the C library which is a stub, meaning it will fail - every time called, usually setting errno to ENOSYS. */ - -#ifdef _LIBC - #error Applications may not define the macro _LIBC -#endif - -#define __stub___compat_bdflush -#define __stub___compat_create_module -#define __stub___compat_get_kernel_syms -#define __stub___compat_query_module -#define __stub___compat_uselib -#define __stub_chflags -#define __stub_fchflags -#define __stub_feclearexcept -#define __stub_fedisableexcept -#define __stub_feenableexcept -#define __stub_fegetenv -#define __stub_fegetexcept -#define __stub_fegetexceptflag -#define __stub_fegetmode -#define __stub_fegetround -#define __stub_feholdexcept -#define __stub_feraiseexcept -#define __stub_fesetenv -#define __stub_fesetexcept -#define __stub_fesetexceptflag -#define __stub_fesetmode -#define __stub_fesetround -#define __stub_fetestexcept -#define __stub_feupdateenv -#define __stub_gtty -#define __stub_revoke -#define __stub_setlogin -#define __stub_sigreturn -#define __stub_stty \ No newline at end of file diff --git a/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64d.h b/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64d.h new file mode 100644 index 0000000000000000000000000000000000000000..4d4c0d146a4063129577bff6724df15f3a36b84f --- /dev/null +++ b/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64d.h @@ -0,0 +1,24 @@ +/* This file is automatically generated. + It defines a symbol `__stub_FUNCTION' for each function + in the C library which is a stub, meaning it will fail + every time called, usually setting errno to ENOSYS. */ + +#ifdef _LIBC + #error Applications may not define the macro _LIBC +#endif + +#define __stub___compat_bdflush +#define __stub___compat_create_module +#define __stub___compat_get_kernel_syms +#define __stub___compat_query_module +#define __stub___compat_uselib +#define __stub_chflags +#define __stub_fchflags +#define __stub_fedisableexcept +#define __stub_feenableexcept +#define __stub_fegetexcept +#define __stub_gtty +#define __stub_revoke +#define __stub_setlogin +#define __stub_sigreturn +#define __stub_stty diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 4d42ba674b2e06ed2caa6d03059f764ba21c5db2..dc5da4a8ae5a0c5c6efbf8369c00cfa251978e07 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -483,7 +483,21 @@ pub const Os = struct { .min = .{ .major = 4, .minor = 19, .patch = 0 }, .max = .{ .major = 6, .minor = 5, .patch = 7 }, }, - .glibc = .{ .major = 2, .minor = 28, .patch = 0 }, + .glibc = blk: { + const default_min = .{ .major = 2, .minor = 28, .patch = 0 }; + + for (std.zig.target.available_libcs) |libc| { + // We don't know the ABI here. We can get away with not checking it + // for now, but that may not always remain true. + if (libc.os != tag or libc.arch != arch) continue; + + if (libc.glibc_min) |min| { + if (min.order(default_min) == .gt) break :blk min; + } + } + + break :blk default_min; + }, }, }, @@ -1750,8 +1764,8 @@ pub const DynamicLinker = struct { else => "/lib64/ld-linux-x86-64.so.2", }), - .riscv32 => init("/lib/ld-linux-riscv32-ilp32.so.1"), - .riscv64 => init("/lib/ld-linux-riscv64-lp64.so.1"), + .riscv32 => init("/lib/ld-linux-riscv32-ilp32d.so.1"), + .riscv64 => init("/lib/ld-linux-riscv64-lp64d.so.1"), // Architectures in this list have been verified as not having a standard // dynamic linker path. diff --git a/lib/std/zig/target.zig b/lib/std/zig/target.zig index 7edacdbe85d47a949b965c57d231ccc63a0d1d13..6cc3b40227614442c8a29cff20596400336bab04 100644 --- a/lib/std/zig/target.zig +++ b/lib/std/zig/target.zig @@ -57,7 +57,7 @@ pub const available_libcs = [_]ArchOsAbi{ .{ .arch = .powerpc, .os = .linux, .abi = .gnueabi }, .{ .arch = .powerpc, .os = .linux, .abi = .gnueabihf }, .{ .arch = .powerpc, .os = .linux, .abi = .musl }, - .{ .arch = .riscv32, .os = .linux, .abi = .gnuilp32, .glibc_min = .{ .major = 2, .minor = 33, .patch = 0 } }, + .{ .arch = .riscv32, .os = .linux, .abi = .gnu, .glibc_min = .{ .major = 2, .minor = 33, .patch = 0 } }, .{ .arch = .riscv32, .os = .linux, .abi = .musl }, .{ .arch = .riscv64, .os = .linux, .abi = .gnu, .glibc_min = .{ .major = 2, .minor = 27, .patch = 0 } }, .{ .arch = .riscv64, .os = .linux, .abi = .musl }, diff --git a/src/glibc.zig b/src/glibc.zig index b218b98fd89a3b4e8b0d49e27f29b74edf820bc8..a2c8e17430e35cd417e8e55248682407036311fe 100644 --- a/src/glibc.zig +++ b/src/glibc.zig @@ -153,6 +153,21 @@ pub fn loadMetaData(gpa: Allocator, contents: []const u8) LoadMetaDataError!*ABI return abi; } +fn useElfInitFini(target: std.Target) bool { + // Legacy architectures use _init/_fini. + return switch (target.cpu.arch) { + .arm, .armeb, .thumb, .thumbeb => true, + .aarch64, .aarch64_be => true, + .m68k => true, + .mips, .mipsel, .mips64, .mips64el => true, + .powerpc, .powerpcle, .powerpc64, .powerpc64le => true, + .s390x => true, + .sparc, .sparc64 => true, + .x86, .x86_64 => true, + else => false, + }; +} + pub const CRTFile = enum { crti_o, crtn_o, @@ -348,8 +363,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: std.Progre "-std=gnu11", "-fgnu89-inline", "-fmerge-all-constants", - // glibc sets this flag but clang does not support it. - // "-frounding-math", + "-frounding-math", "-fno-stack-protector", "-fno-common", "-fmath-errno", @@ -358,6 +372,10 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: std.Progre }); try add_include_dirs(comp, arena, &args); + if (!useElfInitFini(target)) { + try args.append("-DNO_INITFINI"); + } + if (target.cpu.arch == .x86) { // This prevents i386/sysdep.h from trying to do some // silly and unnecessary inline asm hack that uses weird diff --git a/src/main.zig b/src/main.zig index d7f7e006db27c24d9919e0568ba94f6ddc52b78d..a023e7d8ecb7ead6d454376e67950cd5d497df7d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3412,6 +3412,14 @@ fn buildOutputType( std.log.info("zig can provide libc for related target {s}-{s}.{d}-{s}", .{ @tagName(t.arch), @tagName(t.os), os_ver.major, @tagName(t.abi), }); + } else if (t.glibc_min) |glibc_min| { + std.log.info("zig can provide libc for related target {s}-{s}-{s}.{d}.{d}", .{ + @tagName(t.arch), + @tagName(t.os), + @tagName(t.abi), + glibc_min.major, + glibc_min.minor, + }); } else { std.log.info("zig can provide libc for related target {s}-{s}-{s}", .{ @tagName(t.arch), @tagName(t.os), @tagName(t.abi), diff --git a/src/target.zig b/src/target.zig index 768e4d957eb957fbc72df57f994b7715912e30ac..6cd5967d0e75c97be197c71510216af798eadbef 100644 --- a/src/target.zig +++ b/src/target.zig @@ -369,7 +369,6 @@ pub fn addrSpaceCastIsValid( pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 { const have_float = switch (target.abi) { - .gnuilp32 => return "ilp32", .gnueabihf, .musleabihf, .eabihf => true, else => false, }; diff --git a/tools/process_headers.zig b/tools/process_headers.zig index 66ce77d7c499efbc592408503f8d03c9e89349ea..c83903bc28d3798f66b3e7e3df74ee8757bbe195 100644 --- a/tools/process_headers.zig +++ b/tools/process_headers.zig @@ -165,12 +165,12 @@ const glibc_targets = [_]LibCTarget{ .abi = MultiAbi{ .specific = Abi.gnueabi }, }, LibCTarget{ - .name = "riscv32-linux-gnu-rv32imac-ilp32", + .name = "riscv32-linux-gnu-rv32imafdc-ilp32d", .arch = MultiArch{ .specific = Arch.riscv32 }, - .abi = MultiAbi{ .specific = Abi.gnuilp32 }, + .abi = MultiAbi{ .specific = Abi.gnu }, }, LibCTarget{ - .name = "riscv64-linux-gnu-rv64imac-lp64", + .name = "riscv64-linux-gnu-rv64imafdc-lp64d", .arch = MultiArch{ .specific = Arch.riscv64 }, .abi = MultiAbi{ .specific = Abi.gnu }, },