diff options
author | Palmer Dabbelt <palmer.dabbelt@eecs.berkeley.edu> | 2016-07-11 22:38:10 -0700 |
---|---|---|
committer | Palmer Dabbelt <palmer.dabbelt@eecs.berkeley.edu> | 2016-07-11 22:52:26 -0700 |
commit | a92d6674316269b715b20ab4ad9377b46ebf299f (patch) | |
tree | d208ddcc66c239994b5daa9e1c3193cf07c1040d /glibc | |
parent | 6fb6d2a064b449e2f66929f1ecd18c0acfd86f5f (diff) | |
download | riscv-gnu-toolchain-a92d6674316269b715b20ab4ad9377b46ebf299f.zip riscv-gnu-toolchain-a92d6674316269b715b20ab4ad9377b46ebf299f.tar.gz riscv-gnu-toolchain-a92d6674316269b715b20ab4ad9377b46ebf299f.tar.bz2 |
Move to submodules for GCC, glibc
Diffstat (limited to 'glibc')
150 files changed, 0 insertions, 6234 deletions
diff --git a/glibc/sysdeps/riscv/Implies b/glibc/sysdeps/riscv/Implies deleted file mode 100644 index f2e1ea4..0000000 --- a/glibc/sysdeps/riscv/Implies +++ /dev/null @@ -1,4 +0,0 @@ -init_array - -ieee754/flt-32 -ieee754/dbl-64 diff --git a/glibc/sysdeps/riscv/Makefile b/glibc/sysdeps/riscv/Makefile deleted file mode 100644 index 43279ab..0000000 --- a/glibc/sysdeps/riscv/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -ifneq ($(all-rtld-routines),) -CFLAGS-rtld.c += -mno-plt -CFLAGS-dl-load.c += -mno-plt -CFLAGS-dl-cache.c += -mno-plt -CFLAGS-dl-lookup.c += -mno-plt -CFLAGS-dl-object.c += -mno-plt -CFLAGS-dl-reloc.c += -mno-plt -CFLAGS-dl-deps.c += -mno-plt -CFLAGS-dl-runtime.c += -mno-plt -CFLAGS-dl-error.c += -mno-plt -CFLAGS-dl-init.c += -mno-plt -CFLAGS-dl-fini.c += -mno-plt -CFLAGS-dl-debug.c += -mno-plt -CFLAGS-dl-misc.c += -mno-plt -CFLAGS-dl-version.c += -mno-plt -CFLAGS-dl-profile.c += -mno-plt -CFLAGS-dl-conflict.c += -mno-plt -CFLAGS-dl-tls.c += -mno-plt -CFLAGS-dl-origin.c += -mno-plt -CFLAGS-dl-scope.c += -mno-plt -CFLAGS-dl-execstack.c += -mno-plt -CFLAGS-dl-caller.c += -mno-plt -CFLAGS-dl-open.c += -mno-plt -CFLAGS-dl-close.c += -mno-plt -CFLAGS-dl-sysdep.c += -mno-plt -CFLAGS-dl-environ.c += -mno-plt -CFLAGS-dl-minimal.c += -mno-plt -CFLAGS-dl-static.c += -mno-plt -CFLAGS-dl-brk.c += -mno-plt -CFLAGS-dl-sbrk.c += -mno-plt -CFLAGS-dl-getcwd.c += -mno-plt -CFLAGS-dl-openat64.c += -mno-plt -CFLAGS-dl-opendir.c += -mno-plt -CFLAGS-dl-fxstatat64.c += -mno-plt -endif - -CFLAGS-closedir.c += -mno-plt -CFLAGS-exit.c += -mno-plt -CFLAGS-cxa_atexit.c += -mno-plt - -ifeq ($(subdir),misc) -sysdep_headers += sys/asm.h -endif - -ASFLAGS-.os += $(pic-ccflag) - -ifneq ($(with-fp),yes) -+cflags += -msoft-float -ASFLAGS += -msoft-float -sysdep-LDFLAGS += -msoft-float -endif diff --git a/glibc/sysdeps/riscv/Versions b/glibc/sysdeps/riscv/Versions deleted file mode 100644 index 5a0c2d2..0000000 --- a/glibc/sysdeps/riscv/Versions +++ /dev/null @@ -1,5 +0,0 @@ -libc { - GLIBC_2.14 { - __memcpy_g; - } -} diff --git a/glibc/sysdeps/riscv/__longjmp.S b/glibc/sysdeps/riscv/__longjmp.S deleted file mode 100644 index 52385c9..0000000 --- a/glibc/sysdeps/riscv/__longjmp.S +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (C) 1996, 1997, 2000, 2002, 2003, 2004 - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <sysdep.h> -#include <sys/asm.h> - -ENTRY (__longjmp) - REG_L ra, 0*SZREG(a0) - REG_L s0, 1*SZREG(a0) - REG_L s1, 2*SZREG(a0) - REG_L s2, 3*SZREG(a0) - REG_L s3, 4*SZREG(a0) - REG_L s4, 5*SZREG(a0) - REG_L s5, 6*SZREG(a0) - REG_L s6, 7*SZREG(a0) - REG_L s7, 8*SZREG(a0) - REG_L s8, 9*SZREG(a0) - REG_L s9, 10*SZREG(a0) - REG_L s10,11*SZREG(a0) - REG_L s11,12*SZREG(a0) - REG_L sp, 13*SZREG(a0) - -#ifdef __riscv_hard_float - REG_L a3, 15*SZREG(a0) - - fld fs0, 16*SZREG+ 0*8(a0) - fld fs1, 16*SZREG+ 1*8(a0) - fld fs2, 16*SZREG+ 2*8(a0) - fld fs3, 16*SZREG+ 3*8(a0) - fld fs4, 16*SZREG+ 4*8(a0) - fld fs5, 16*SZREG+ 5*8(a0) - fld fs6, 16*SZREG+ 6*8(a0) - fld fs7, 16*SZREG+ 7*8(a0) - fld fs8, 16*SZREG+ 8*8(a0) - fld fs9, 16*SZREG+ 9*8(a0) - fld fs10,16*SZREG+10*8(a0) - fld fs11,16*SZREG+11*8(a0) - - fssr a3 -#endif - - seqz a0, a1 - add a0, a0, a1 # a0 = (a1 == 0) ? 1 : a1 - ret - -END(__longjmp) diff --git a/glibc/sysdeps/riscv/atomic-machine.h b/glibc/sysdeps/riscv/atomic-machine.h deleted file mode 100644 index dced351..0000000 --- a/glibc/sysdeps/riscv/atomic-machine.h +++ /dev/null @@ -1,128 +0,0 @@ -/* Low-level functions for atomic operations. RISC-V version. - Copyright (C) 2011-2016 Free Software Foundation, Inc. - - Contributed by Andrew Waterman (waterman@cs.berkeley.edu) at UC Berkeley. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _RISCV_BITS_ATOMIC_H -#define _RISCV_BITS_ATOMIC_H 1 - -#include <inttypes.h> - -typedef int32_t atomic32_t; -typedef uint32_t uatomic32_t; -typedef int_fast32_t atomic_fast32_t; -typedef uint_fast32_t uatomic_fast32_t; - -typedef int64_t atomic64_t; -typedef uint64_t uatomic64_t; -typedef int_fast64_t atomic_fast64_t; -typedef uint_fast64_t uatomic_fast64_t; - -typedef intptr_t atomicptr_t; -typedef uintptr_t uatomicptr_t; -typedef intmax_t atomic_max_t; -typedef uintmax_t uatomic_max_t; - -#ifdef __riscv_atomic - -#ifdef __riscv64 -# define __HAVE_64B_ATOMICS 1 -#else -# define __HAVE_64B_ATOMICS 0 -#endif - -#define USE_ATOMIC_COMPILER_BUILTINS 1 - -#define asm_amo(which, ordering, mem, value) ({ \ - typeof(*mem) __tmp; \ - if (sizeof(__tmp) == 4) \ - asm volatile (which ".w" ordering "\t%0, %z2, %1" \ - : "=r"(__tmp), "+A"(*(mem)) \ - : "rJ"(value)); \ - else if (sizeof(__tmp) == 8) \ - asm volatile (which ".d" ordering "\t%0, %z2, %1" \ - : "=r"(__tmp), "+A"(*(mem)) \ - : "rJ"(value)); \ - else \ - abort(); \ - __tmp; }) - -/* Atomic compare and exchange. */ - -#define atomic_cas(ordering, mem, newval, oldval) ({ \ - typeof(*mem) __tmp; \ - int __tmp2; \ - if (sizeof(__tmp) == 4) \ - asm volatile ("1: lr.w" ordering "\t%0, %2\n" \ - "bne\t%0, %z4, 1f\n" \ - "sc.w" ordering "\t%1, %z3, %2\n" \ - "bnez\t%1, 1b\n" \ - "1:" \ - : "=&r"(__tmp), "=&r"(__tmp2), "+A"(*(mem)) \ - : "rJ"(newval), "rJ"(oldval)); \ - else if (sizeof(__tmp) == 8) \ - asm volatile ("1: lr.d" ordering "\t%0, %2\n" \ - "bne\t%0, %z4, 1f\n" \ - "sc.d" ordering "\t%1, %z3, %2\n" \ - "bnez\t%1, 1b\n" \ - "1:" \ - : "=&r"(__tmp), "=&r"(__tmp2), "+A"(*(mem)) \ - : "rJ"(newval), "rJ"(oldval)); \ - else \ - abort(); \ - __tmp; }) - -#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ - atomic_cas(".aq", mem, newval, oldval) - -#define atomic_compare_and_exchange_val_rel(mem, newval, oldval) \ - atomic_cas(".rl", mem, newval, oldval) - -/* Atomic exchange (without compare). */ - -#define atomic_exchange_acq(mem, value) asm_amo("amoswap", ".aq", mem, value) -#define atomic_exchange_rel(mem, value) asm_amo("amoswap", ".rl", mem, value) - - -/* Atomically add value and return the previous (unincremented) value. */ - -#define atomic_exchange_and_add(mem, value) asm_amo("amoadd", "", mem, value) - -#define atomic_max(mem, value) asm_amo("amomaxu", "", mem, value) -#define atomic_min(mem, value) asm_amo("amominu", "", mem, value) - -#define atomic_bit_test_set(mem, bit) \ - ({ typeof(*mem) __mask = (typeof(*mem))1 << (bit); \ - asm_amo("amoor", "", mem, __mask) & __mask; }) - -#define atomic_full_barrier() __sync_synchronize() - -#define catomic_exchange_and_add(mem, value) \ - atomic_exchange_and_add(mem, value) -#define catomic_max(mem, value) atomic_max(mem, value) - -#else /* __riscv_atomic */ - -#define __HAVE_64B_ATOMICS 0 -#define USE_ATOMIC_COMPILER_BUILTINS 0 - -#endif /* !__riscv_atomic */ - -#endif /* bits/atomic.h */ diff --git a/glibc/sysdeps/riscv/bits/endian.h b/glibc/sysdeps/riscv/bits/endian.h deleted file mode 100644 index 4aaf559..0000000 --- a/glibc/sysdeps/riscv/bits/endian.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef _ENDIAN_H -# error "Never use <bits/endian.h> directly; include <endian.h> instead." -#endif - -#define __BYTE_ORDER __LITTLE_ENDIAN diff --git a/glibc/sysdeps/riscv/bits/fenv.h b/glibc/sysdeps/riscv/bits/fenv.h deleted file mode 100644 index 0ccf5cb..0000000 --- a/glibc/sysdeps/riscv/bits/fenv.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (C) 1998, 1999, 2000 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _FENV_H -# error "Never use <bits/fenv.h> directly; include <fenv.h> instead." -#endif - -enum - { - FE_INEXACT = 0x01, -#define FE_INEXACT FE_INEXACT - FE_UNDERFLOW = 0x02, -#define FE_UNDERFLOW FE_UNDERFLOW - FE_OVERFLOW = 0x04, -#define FE_OVERFLOW FE_OVERFLOW - FE_DIVBYZERO = 0x08, -#define FE_DIVBYZERO FE_DIVBYZERO - FE_INVALID = 0x10, -#define FE_INVALID FE_INVALID - }; - -#define FE_ALL_EXCEPT \ - (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) - -enum - { - FE_TONEAREST = 0x0, -#define FE_TONEAREST FE_TONEAREST - FE_TOWARDZERO = 0x1, -#define FE_TOWARDZERO FE_TOWARDZERO - FE_DOWNWARD = 0x2, -#define FE_DOWNWARD FE_DOWNWARD - FE_UPWARD = 0x3 -#define FE_UPWARD 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) diff --git a/glibc/sysdeps/riscv/bits/link.h b/glibc/sysdeps/riscv/bits/link.h deleted file mode 100644 index 6d04749..0000000 --- a/glibc/sysdeps/riscv/bits/link.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 2005, 2009 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _LINK_H -# error "Never include <bits/link.h> directly; use <link.h> instead." -#endif - -typedef struct La_riscv_regs -{ - unsigned long lr_reg[8]; /* a0 - a7 */ - double lr_fpreg[8]; /* fa0 - fa7 */ - unsigned long lr_ra; - unsigned long lr_sp; -} La_riscv_regs; - -/* Return values for calls from PLT on RISC-V. */ -typedef struct La_riscv_retval -{ - unsigned long lrv_a0; - unsigned long lrv_a1; - double lrv_fa0; - double lrv_fa1; -} La_riscv_retval; - -__BEGIN_DECLS - -extern ElfW(Addr) la_riscv_gnu_pltenter (ElfW(Sym) *__sym, unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - La_riscv_regs *__regs, - unsigned int *__flags, - const char *__symname, - long int *__framesizep); -extern unsigned int la_riscv_gnu_pltexit (ElfW(Sym) *__sym, unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - const La_riscv_regs *__inregs, - La_riscv_retval *__outregs, - const char *__symname); - -__END_DECLS diff --git a/glibc/sysdeps/riscv/bits/mathdef.h b/glibc/sysdeps/riscv/bits/mathdef.h deleted file mode 100644 index c186059..0000000 --- a/glibc/sysdeps/riscv/bits/mathdef.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2007 - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#if !defined _MATH_H && !defined _COMPLEX_H -# error "Never use <bits/mathdef.h> directly; include <math.h> instead" -#endif - -#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF -# define _MATH_H_MATHDEF 1 - -/* MIPS has `float' and `double' operations. */ -typedef float float_t; /* `float' expressions are evaluated as - `float'. */ -typedef double double_t; /* `double' expressions are evaluated as - `double'. */ - -/* The values returned by `ilogb' for 0 and NaN respectively. */ -# define FP_ILOGB0 (-2147483647) -# define FP_ILOGBNAN 2147483647 - -#endif /* ISO C99 */ - -#if ! defined __NO_LONG_DOUBLE_MATH -/* Signal that we do not really have a `long double'. This disables the - declaration of all the `long double' function variants. */ -# define __NO_LONG_DOUBLE_MATH 1 -#endif diff --git a/glibc/sysdeps/riscv/bits/mathinline.h b/glibc/sysdeps/riscv/bits/mathinline.h deleted file mode 100644 index 4b7a1f9..0000000 --- a/glibc/sysdeps/riscv/bits/mathinline.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2011-2015 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _MATH_H -# error "Never use <bits/mathinline.h> directly; include <math.h> instead." -#endif - -#ifndef __extern_always_inline -# define __MATH_INLINE __inline -#else -# define __MATH_INLINE __extern_always_inline -#endif - - -#if defined __USE_ISOC99 && defined __GNUC__ - -/* Test for negative number. Used in the signbit() macro. */ -__MATH_INLINE int -__NTH (__signbitf (float __x)) -{ - return __builtin_signbitf (__x); -} -__MATH_INLINE int -__NTH (__signbit (double __x)) -{ - return __builtin_signbit (__x); -} - -#endif diff --git a/glibc/sysdeps/riscv/bits/setjmp.h b/glibc/sysdeps/riscv/bits/setjmp.h deleted file mode 100644 index f7cb019..0000000 --- a/glibc/sysdeps/riscv/bits/setjmp.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Define the machine-dependent type `jmp_buf'. RISC-V version. - Copyright (C) 1992,1993,1995,1997,2000,2002,2003,2004,2005,2006 - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _RISCV_BITS_SETJMP_H -#define _RISCV_BITS_SETJMP_H - -typedef struct __jmp_buf_internal_tag - { - /* Program counter. */ - long __pc; - /* Callee-saved registers. */ - long __regs[12]; - /* Stack pointer. */ - long __sp; - /* Thread pointer. */ - long __tp; - /* Floating point status register. */ - long __fsr; - - /* Callee-saved floating point registers. - Note that there are an even number of preceding words in this struct, - so no padding will be inserted before __fpregs, even for RV32. */ - double __fpregs[12]; - } __jmp_buf[1]; - -#endif /* _RISCV_BITS_SETJMP_H */ diff --git a/glibc/sysdeps/riscv/bits/string.h b/glibc/sysdeps/riscv/bits/string.h deleted file mode 100644 index 8160b8c..0000000 --- a/glibc/sysdeps/riscv/bits/string.h +++ /dev/null @@ -1,25 +0,0 @@ -/* This file should provide inline versions of string functions. - - Surround GCC-specific parts with #ifdef __GNUC__, and use `__extern_inline'. - - This file should define __STRING_INLINES if functions are actually defined - as inlines. */ - -#ifndef _BITS_STRING_H -#define _BITS_STRING_H 1 - -#define _STRING_INLINE_unaligned 0 - -#if defined(__GNUC__) && !defined(__cplusplus) - -static __inline__ unsigned long __libc_detect_null(unsigned long w) -{ - unsigned long mask = 0x7f7f7f7f; - if (sizeof(long) == 8) - mask = ((mask << 16) << 16) | mask; - return ~(((w & mask) + mask) | w | mask); -} - -#endif /* __GNUC__ && !__cplusplus */ - -#endif /* bits/string.h */ diff --git a/glibc/sysdeps/riscv/bits/wordsize.h b/glibc/sysdeps/riscv/bits/wordsize.h deleted file mode 100644 index 67bb48f..0000000 --- a/glibc/sysdeps/riscv/bits/wordsize.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (C) 2002, 2003 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#if defined __riscv64 -#define __WORDSIZE 64 -#define __WORDSIZE_TIME64_COMPAT32 1 -#else -#define __WORDSIZE 32 -#endif diff --git a/glibc/sysdeps/riscv/bsd-_setjmp.c b/glibc/sysdeps/riscv/bsd-_setjmp.c deleted file mode 100644 index 0d41310..0000000 --- a/glibc/sysdeps/riscv/bsd-_setjmp.c +++ /dev/null @@ -1 +0,0 @@ -/* _setjmp is implemented in setjmp.S */ diff --git a/glibc/sysdeps/riscv/bsd-setjmp.c b/glibc/sysdeps/riscv/bsd-setjmp.c deleted file mode 100644 index ee7c5e3..0000000 --- a/glibc/sysdeps/riscv/bsd-setjmp.c +++ /dev/null @@ -1 +0,0 @@ -/* setjmp is implemented in setjmp.S */ diff --git a/glibc/sysdeps/riscv/configure b/glibc/sysdeps/riscv/configure deleted file mode 100644 index 7280dbb..0000000 --- a/glibc/sysdeps/riscv/configure +++ /dev/null @@ -1,87 +0,0 @@ - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -# This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/riscv/elf. - -$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h - diff --git a/glibc/sysdeps/riscv/configure.in b/glibc/sysdeps/riscv/configure.in deleted file mode 100644 index 34f62d4..0000000 --- a/glibc/sysdeps/riscv/configure.in +++ /dev/null @@ -1,4 +0,0 @@ -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/riscv/elf. - -AC_DEFINE(PI_STATIC_AND_HIDDEN) diff --git a/glibc/sysdeps/riscv/crti.S b/glibc/sysdeps/riscv/crti.S deleted file mode 100644 index e15ff3f..0000000 --- a/glibc/sysdeps/riscv/crti.S +++ /dev/null @@ -1,16 +0,0 @@ -/* Facilitate pthread initialization using init_array. */ - -#ifdef PREINIT_FUNCTION - -#if PREINIT_FUNCTION_WEAK -# error PREINIT_FUNCTION_WEAK is unsupported -#endif - - .section .init_array, "aw" -#ifdef __riscv64 - .dword PREINIT_FUNCTION -#else - .word PREINIT_FUNCTION -#endif - -#endif diff --git a/glibc/sysdeps/riscv/dl-machine.h b/glibc/sysdeps/riscv/dl-machine.h deleted file mode 100644 index b618bd9..0000000 --- a/glibc/sysdeps/riscv/dl-machine.h +++ /dev/null @@ -1,331 +0,0 @@ -/* Machine-dependent ELF dynamic relocation inline functions. MIPS version. - Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* FIXME: Profiling of shared libraries is not implemented yet. */ -#ifndef dl_machine_h -#define dl_machine_h - -#define ELF_MACHINE_NAME "RISC-V" -#define EM_RISCV 243 - -/* Relocs. */ -#define R_RISCV_NONE 0 -#define R_RISCV_32 1 -#define R_RISCV_64 2 -#define R_RISCV_RELATIVE 3 -#define R_RISCV_COPY 4 -#define R_RISCV_JUMP_SLOT 5 -#define R_RISCV_TLS_DTPMOD32 6 -#define R_RISCV_TLS_DTPMOD64 7 -#define R_RISCV_TLS_DTPREL32 8 -#define R_RISCV_TLS_DTPREL64 9 -#define R_RISCV_TLS_TPREL32 10 -#define R_RISCV_TLS_TPREL64 11 - -#include <entry.h> - -#ifndef ENTRY_POINT -#error ENTRY_POINT needs to be defined for MIPS. -#endif - -#include <sys/asm.h> -#include <dl-tls.h> - -#ifndef _RTLD_PROLOGUE -# define _RTLD_PROLOGUE(entry) \ - ".globl\t" __STRING(entry) "\n\t" \ - ".type\t" __STRING(entry) ", @function\n" \ - __STRING(entry) ":\n\t" -#endif - -#ifndef _RTLD_EPILOGUE -# define _RTLD_EPILOGUE(entry) \ - ".size\t" __STRING(entry) ", . - " __STRING(entry) "\n\t" -#endif - -/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. - This only makes sense on MIPS when using PLTs, so choose the - PLT relocation (not encountered when not using PLTs). */ -#define ELF_MACHINE_JMP_SLOT R_RISCV_JUMP_SLOT -#define elf_machine_type_class(type) \ - ((ELF_RTYPE_CLASS_PLT * ((type) == ELF_MACHINE_JMP_SLOT \ - || (_RISCV_SZPTR == 32 && (type) == R_RISCV_TLS_DTPREL32) \ - || (_RISCV_SZPTR == 32 && (type) == R_RISCV_TLS_DTPMOD32) \ - || (_RISCV_SZPTR == 32 && (type) == R_RISCV_TLS_TPREL32) \ - || (_RISCV_SZPTR == 64 && (type) == R_RISCV_TLS_DTPREL64) \ - || (_RISCV_SZPTR == 64 && (type) == R_RISCV_TLS_DTPMOD64) \ - || (_RISCV_SZPTR == 64 && (type) == R_RISCV_TLS_TPREL64))) \ - | (ELF_RTYPE_CLASS_COPY * ((type) == R_RISCV_COPY))) - -#define ELF_MACHINE_NO_REL 1 -#define ELF_MACHINE_NO_RELA 0 - -/* Return nonzero iff ELF header is compatible with the running host. */ -static inline int __attribute_used__ -elf_machine_matches_host (const ElfW(Ehdr) *ehdr) -{ - return ehdr->e_machine == EM_RISCV; -} - -/* Return the link-time address of _DYNAMIC. */ -static inline ElfW(Addr) -elf_machine_dynamic (void) -{ - extern ElfW(Addr) _GLOBAL_OFFSET_TABLE_ __attribute__((visibility("hidden"))); - return _GLOBAL_OFFSET_TABLE_; -} - -#define STRINGXP(X) __STRING(X) -#define STRINGXV(X) STRINGV_(X) -#define STRINGV_(...) # __VA_ARGS__ - -/* Return the run-time load address of the shared object. */ -static inline ElfW(Addr) -elf_machine_load_address (void) -{ - ElfW(Addr) load_addr; - asm ("lla %0, _DYNAMIC" : "=r"(load_addr)); - return load_addr - elf_machine_dynamic (); -} - -/* Initial entry point code for the dynamic linker. - The C function `_dl_start' is the real entry point; - its return value is the user program's entry point. */ - -#define RTLD_START asm (\ - ".text\n\ - " _RTLD_PROLOGUE(ENTRY_POINT) "\ - move a0, sp\n\ - jal _dl_start\n\ - # Stash user entry point in s0.\n\ - move s0, a0\n\ - # See if we were run as a command with the executable file\n\ - # name as an extra leading argument.\n\ - lw a0, _dl_skip_args\n\ - # Load the original argument count.\n\ - " STRINGXP(REG_L) " a1, 0(sp)\n\ - # Subtract _dl_skip_args from it.\n\ - sub a1, a1, a0\n\ - # Adjust the stack pointer to skip _dl_skip_args words.\n\ - sll a0, a0, " STRINGXP (PTRLOG) "\n\ - add sp, sp, a0\n\ - # Save back the modified argument count.\n\ - " STRINGXP(REG_S) " a1, 0(sp)\n\ - # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\ - " STRINGXP(REG_L) " a0, _rtld_local\n\ - add a2, sp, " STRINGXP (SZREG) "\n\ - sll a3, a1, " STRINGXP (PTRLOG) "\n\ - add a3, a3, a2\n\ - add a3, a3, " STRINGXP (SZREG) "\n\ - # Call the function to run the initializers.\n\ - jal _dl_init\n\ - # Pass our finalizer function to _start.\n\ - lla a0, _dl_fini\n\ - # Jump to the user entry point.\n\ - jr s0\n\ - " _RTLD_EPILOGUE(ENTRY_POINT) "\ - .previous" \ -); - -/* Names of the architecture-specific auditing callback functions. */ -# ifdef __riscv64 -# define ARCH_LA_PLTENTER mips_n64_gnu_pltenter -# define ARCH_LA_PLTEXIT mips_n64_gnu_pltexit -# else -# define ARCH_LA_PLTENTER mips_n32_gnu_pltenter -# define ARCH_LA_PLTEXIT mips_n32_gnu_pltexit -# endif - -/* Bias .got.plt entry by the offset requested by the PLT header. */ -#define elf_machine_plt_value(map, reloc, value) (value) -#define elf_machine_fixup_plt(map, t, reloc, reloc_addr, value) \ - (*(ElfW(Addr) *)(reloc_addr) = (value)) - -#endif /* !dl_machine_h */ - -#ifdef RESOLVE_MAP - -/* Perform a relocation described by R_INFO at the location pointed to - by RELOC_ADDR. SYM is the relocation symbol specified by R_INFO and - MAP is the object containing the reloc. */ - -auto inline void -__attribute__ ((always_inline)) -elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, - const ElfW(Sym) *sym, const struct r_found_version *version, - void *const reloc_addr, int skip_ifunc) -{ - ElfW(Addr) r_info = reloc->r_info; - const unsigned long int r_type = ELFW(R_TYPE) (r_info); - ElfW(Addr) *addr_field = (ElfW(Addr) *) reloc_addr; - const ElfW(Sym) *const __attribute__((unused)) refsym = sym; - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - ElfW(Addr) value = 0; - if (sym_map != NULL) - value = sym_map->l_addr + sym->st_value + reloc->r_addend; - - switch (r_type) - { -#ifndef RTLD_BOOTSTRAP - case __WORDSIZE == 64 ? R_RISCV_TLS_DTPMOD64 : R_RISCV_TLS_DTPMOD32: - if (sym_map) - *addr_field = sym_map->l_tls_modid; - break; - - case __WORDSIZE == 64 ? R_RISCV_TLS_DTPREL64 : R_RISCV_TLS_DTPREL32: - if (sym != NULL) - *addr_field = TLS_DTPREL_VALUE (sym) + reloc->r_addend; - break; - - case __WORDSIZE == 64 ? R_RISCV_TLS_TPREL64 : R_RISCV_TLS_TPREL32: - if (sym != NULL) - { - CHECK_STATIC_TLS (map, sym_map); - *addr_field = TLS_TPREL_VALUE (sym_map, sym) + reloc->r_addend; - } - break; - - case R_RISCV_COPY: - { - if (__builtin_expect (sym == NULL, 0)) - /* This can happen in trace mode if an object could not be - found. */ - break; - - /* Handle TLS copy relocations. */ - if (__glibc_unlikely (ELFW(ST_TYPE) (sym->st_info) == STT_TLS)) - { - /* There's nothing to do if the symbol is in .tbss. */ - if (__glibc_likely (sym->st_value >= sym_map->l_tls_initimage_size)) - break; - value += (ElfW(Addr)) sym_map->l_tls_initimage - sym_map->l_addr; - } - - size_t size = sym->st_size; - if (__builtin_expect (sym->st_size != refsym->st_size, 0)) - { - const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]); - if (sym->st_size > refsym->st_size) - size = refsym->st_size; - if (sym->st_size > refsym->st_size || GLRO(dl_verbose)) - _dl_error_printf ("\ - %s: Symbol `%s' has different size in shared object, consider re-linking\n", - rtld_progname ?: "<program name unknown>", - strtab + refsym->st_name); - } - - memcpy (reloc_addr, (void *)value, size); - break; - } -#endif - -#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC - case R_RISCV_RELATIVE: - { -# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC - /* This is defined in rtld.c, but nowhere in the static libc.a; - make the reference weak so static programs can still link. - This declaration cannot be done when compiling rtld.c - (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the - common defn for _dl_rtld_map, which is incompatible with a - weak decl in the same file. */ -# ifndef SHARED - weak_extern (GL(dl_rtld_map)); -# endif - if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */ -# endif - *addr_field = map->l_addr + reloc->r_addend; - break; - } -#endif - - case R_RISCV_JUMP_SLOT: - case __WORDSIZE == 64 ? R_RISCV_64 : R_RISCV_32: - *addr_field = value; - break; - - case R_RISCV_NONE: - break; - - default: - _dl_reloc_bad_type (map, r_type, 0); - break; - } -} - -auto inline void -__attribute__((always_inline)) -elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc, - void *const reloc_addr) -{ - *(ElfW(Addr) *)reloc_addr = l_addr + reloc->r_addend; -} - -auto inline void -__attribute__((always_inline)) -elf_machine_lazy_rel (struct link_map *map, ElfW(Addr) l_addr, - const ElfW(Rela) *reloc, int skip_ifunc) -{ - ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset); - const unsigned int r_type = ELFW(R_TYPE) (reloc->r_info); - - /* Check for unexpected PLT reloc type. */ - if (__builtin_expect (r_type == R_RISCV_JUMP_SLOT, 1)) - { - if (__builtin_expect (map->l_mach.plt, 0) == 0) - { - if (l_addr) - *reloc_addr += l_addr; - } - else - *reloc_addr = map->l_mach.plt; - } - else - _dl_reloc_bad_type (map, r_type, 1); -} - -/* Set up the loaded object described by L so its stub function - will jump to the on-demand fixup code __dl_runtime_resolve. */ - -auto inline int -__attribute__((always_inline)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) -{ -#ifndef RTLD_BOOTSTRAP - /* If using PLTs, fill in the first two entries of .got.plt. */ - if (l->l_info[DT_JMPREL]) - { - extern void _dl_runtime_resolve (void) __attribute__((visibility("hidden"))); - ElfW(Addr) *gotplt = (ElfW(Addr) *) D_PTR (l, l_info[DT_PLTGOT]); - /* If a library is prelinked but we have to relocate anyway, - we have to be able to undo the prelinking of .got.plt. - The prelinker saved the address of .plt for us here. */ - if (gotplt[1]) - l->l_mach.plt = gotplt[1] + l->l_addr; - gotplt[0] = (ElfW(Addr)) &_dl_runtime_resolve; - gotplt[1] = (ElfW(Addr)) l; - } -#endif - - return lazy; -} - -#endif /* RESOLVE_MAP */ diff --git a/glibc/sysdeps/riscv/dl-tls.h b/glibc/sysdeps/riscv/dl-tls.h deleted file mode 100644 index da2b444..0000000 --- a/glibc/sysdeps/riscv/dl-tls.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Thread-local storage handling in the ELF dynamic linker. MIPS version. - Copyright (C) 2005 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - - -/* Type used for the representation of TLS information in the GOT. */ -typedef struct -{ - unsigned long int ti_module; - unsigned long int ti_offset; -} tls_index; - -/* The thread pointer points to the first static TLS block. */ -#define TLS_TP_OFFSET 0 - -/* Dynamic thread vector pointers point 0x800 past the start of each - TLS block. */ -#define TLS_DTV_OFFSET 0x800 - -/* Compute the value for a GOTTPREL reloc. */ -#define TLS_TPREL_VALUE(sym_map, sym) \ - ((sym_map)->l_tls_offset + (sym)->st_value - TLS_TP_OFFSET) - -/* Compute the value for a DTPREL reloc. */ -#define TLS_DTPREL_VALUE(sym) \ - ((sym)->st_value - TLS_DTV_OFFSET) - -extern void *__tls_get_addr (tls_index *ti); - -# define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET) -# define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET) - -/* Value used for dtv entries for which the allocation is delayed. */ -#define TLS_DTV_UNALLOCATED ((void *) -1l) diff --git a/glibc/sysdeps/riscv/dl-trampoline.S b/glibc/sysdeps/riscv/dl-trampoline.S deleted file mode 100644 index 9d8a5e7..0000000 --- a/glibc/sysdeps/riscv/dl-trampoline.S +++ /dev/null @@ -1,41 +0,0 @@ -#include <sysdep.h> -#include <sys/asm.h> - -/* Assembler veneer called from the PLT header code for lazy loading. - The PLT header passes its own args in t0-t2. */ - -ENTRY(_dl_runtime_resolve) - # Save arguments to stack. - addi sp, sp, -10*SZREG - REG_S ra, 9*SZREG(sp) - REG_S a0, 1*SZREG(sp) - REG_S a1, 2*SZREG(sp) - REG_S a2, 3*SZREG(sp) - REG_S a3, 4*SZREG(sp) - REG_S a4, 5*SZREG(sp) - REG_S a5, 6*SZREG(sp) - REG_S a6, 7*SZREG(sp) - REG_S a7, 8*SZREG(sp) - - # Update .got.plt and obtain runtime address of callee. - slli a1, t1, 1 - mv a0, t0 # link map - add a1, a1, t1 # reloc offset (== thrice the .got.plt offset) - jal _dl_fixup - move t0, a0 - - # Restore arguments from stack. - REG_L ra, 9*SZREG(sp) - REG_L a0, 1*SZREG(sp) - REG_L a1, 2*SZREG(sp) - REG_L a2, 3*SZREG(sp) - REG_L a3, 4*SZREG(sp) - REG_L a4, 5*SZREG(sp) - REG_L a5, 6*SZREG(sp) - REG_L a6, 7*SZREG(sp) - REG_L a7, 8*SZREG(sp) - addi sp, sp, 10*SZREG - - # Invoke the callee. - jr t0 -END(_dl_runtime_resolve) diff --git a/glibc/sysdeps/riscv/fpu/fclrexcpt.c b/glibc/sysdeps/riscv/fpu/fclrexcpt.c deleted file mode 100644 index 1a4632d..0000000 --- a/glibc/sysdeps/riscv/fpu/fclrexcpt.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Clear given exceptions in current floating-point environment. - Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 1998. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <fpu_control.h> - -int -feclearexcept (int excepts) -{ - asm volatile ("csrc fflags, %0" : : "r"(excepts)); - return 0; -} -libm_hidden_def (feclearexcept) diff --git a/glibc/sysdeps/riscv/fpu/fedisblxcpt.c b/glibc/sysdeps/riscv/fpu/fedisblxcpt.c deleted file mode 100644 index 25eaee5..0000000 --- a/glibc/sysdeps/riscv/fpu/fedisblxcpt.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Disable floating-point exceptions. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 2000. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <fpu_control.h> - -int -fedisableexcept (int excepts) -{ - /* FP exceptions never generate traps. */ - return 0; -} diff --git a/glibc/sysdeps/riscv/fpu/feenablxcpt.c b/glibc/sysdeps/riscv/fpu/feenablxcpt.c deleted file mode 100644 index 761c58d..0000000 --- a/glibc/sysdeps/riscv/fpu/feenablxcpt.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Enable floating-point exceptions. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 2000. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <fpu_control.h> - -int -feenableexcept (int excepts) -{ - /* FP exceptions never generate traps. */ - return -1; -} diff --git a/glibc/sysdeps/riscv/fpu/fegetenv.c b/glibc/sysdeps/riscv/fpu/fegetenv.c deleted file mode 100644 index fbf9799..0000000 --- a/glibc/sysdeps/riscv/fpu/fegetenv.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Store current floating-point environment. - Copyright (C) 1998, 1999, 2000, 2002, 2010 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 1998. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <fpu_control.h> - -int -__fegetenv (fenv_t *envp) -{ - _FPU_GETCW (*envp); - - /* Success. */ - return 0; -} -libm_hidden_def (__fegetenv) -weak_alias (__fegetenv, fegetenv) -libm_hidden_weak (fegetenv) diff --git a/glibc/sysdeps/riscv/fpu/fegetexcept.c b/glibc/sysdeps/riscv/fpu/fegetexcept.c deleted file mode 100644 index bdb4b7d..0000000 --- a/glibc/sysdeps/riscv/fpu/fegetexcept.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Get enabled floating-point exceptions. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 2000. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <fpu_control.h> - -int -fegetexcept (void) -{ - /* FP exceptions never generate traps. */ - return 0; -} diff --git a/glibc/sysdeps/riscv/fpu/fegetround.c b/glibc/sysdeps/riscv/fpu/fegetround.c deleted file mode 100644 index cd503ab..0000000 --- a/glibc/sysdeps/riscv/fpu/fegetround.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Return current rounding direction. - Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <fpu_control.h> - -int -__fegetround (void) -{ - int round; - _FPU_GETROUND (round); - return round; -} -libm_hidden_def (__fegetround) -weak_alias (__fegetround, fegetround) -libm_hidden_weak (fegetround) diff --git a/glibc/sysdeps/riscv/fpu/feholdexcpt.c b/glibc/sysdeps/riscv/fpu/feholdexcpt.c deleted file mode 100644 index 89203fc..0000000 --- a/glibc/sysdeps/riscv/fpu/feholdexcpt.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Store current floating-point environment and clear exceptions. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 2000. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <math_private.h> - -int -__feholdexcept (fenv_t *envp) -{ - libc_feholdexcept_riscv (envp); - return 0; -} -libm_hidden_def (__feholdexcept) -weak_alias (__feholdexcept, feholdexcept) -libm_hidden_weak (feholdexcept) diff --git a/glibc/sysdeps/riscv/fpu/fesetenv.c b/glibc/sysdeps/riscv/fpu/fesetenv.c deleted file mode 100644 index dd089a9..0000000 --- a/glibc/sysdeps/riscv/fpu/fesetenv.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Install given floating-point environment. - Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 1998. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <math_private.h> - -int -__fesetenv (const fenv_t *envp) -{ - libc_fesetenv_riscv (envp); - return 0; -} -libm_hidden_def (__fesetenv) -weak_alias (__fesetenv, fesetenv) -libm_hidden_weak (fesetenv) diff --git a/glibc/sysdeps/riscv/fpu/fesetround.c b/glibc/sysdeps/riscv/fpu/fesetround.c deleted file mode 100644 index 5ae831a..0000000 --- a/glibc/sysdeps/riscv/fpu/fesetround.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Set current rounding direction. - Copyright (C) 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <fpu_control.h> - -int -__fesetround (int round) -{ - switch (round) - { - case FE_TONEAREST: - case FE_TOWARDZERO: - case FE_DOWNWARD: - case FE_UPWARD: - _FPU_SETROUND (round); - return 0; - default: - return round; /* a nonzero value */ - } -} -libm_hidden_def (__fesetround) -weak_alias (__fesetround, fesetround) -libm_hidden_weak (fesetround) diff --git a/glibc/sysdeps/riscv/fpu/feupdateenv.c b/glibc/sysdeps/riscv/fpu/feupdateenv.c deleted file mode 100644 index b685132..0000000 --- a/glibc/sysdeps/riscv/fpu/feupdateenv.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Install given floating-point environment and raise exceptions. - Copyright (C) 1998, 1999, 2000, 2002, 2010 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 1998. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <math_private.h> - -int -__feupdateenv (const fenv_t *envp) -{ - libc_feupdateenv_riscv (envp); - return 0; -} -libm_hidden_def (__feupdateenv) -weak_alias (__feupdateenv, feupdateenv) -libm_hidden_weak (feupdateenv) diff --git a/glibc/sysdeps/riscv/fpu/fgetexcptflg.c b/glibc/sysdeps/riscv/fpu/fgetexcptflg.c deleted file mode 100644 index 3d6eac1..0000000 --- a/glibc/sysdeps/riscv/fpu/fgetexcptflg.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Store current representation for exceptions. - Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 1998. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <fpu_control.h> - -int -fegetexceptflag (fexcept_t *flagp, int excepts) -{ - /* Get the current exceptions. */ - _FPU_GETFLAGS (*flagp); - *flagp &= excepts; - - /* Success. */ - return 0; -} diff --git a/glibc/sysdeps/riscv/fpu/fraiseexcpt.c b/glibc/sysdeps/riscv/fpu/fraiseexcpt.c deleted file mode 100644 index b9f555a..0000000 --- a/glibc/sysdeps/riscv/fpu/fraiseexcpt.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Raise given exceptions. - Copyright (C) 2000, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 2000. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <fpu_control.h> - -int -__feraiseexcept (int excepts) -{ - asm volatile ("csrs fflags, %0" : : "r"(excepts)); - return 0; -} -libm_hidden_def (__feraiseexcept) -weak_alias (__feraiseexcept, feraiseexcept) -libm_hidden_weak (feraiseexcept) diff --git a/glibc/sysdeps/riscv/fpu/fsetexcptflg.c b/glibc/sysdeps/riscv/fpu/fsetexcptflg.c deleted file mode 100644 index c28235a..0000000 --- a/glibc/sysdeps/riscv/fpu/fsetexcptflg.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Set floating-point environment exception handling. - Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Hartvig Ekner <hartvige@mips.com>, 2002. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <fpu_control.h> - -int -fesetexceptflag (const fexcept_t *flagp, int excepts) -{ - fexcept_t flags = *flagp; - asm volatile ("csrc fflags, %0" : : "r"(excepts)); - asm volatile ("csrs fflags, %0" : : "r"(flags & excepts)); - - return 0; -} diff --git a/glibc/sysdeps/riscv/fpu/ftestexcept.c b/glibc/sysdeps/riscv/fpu/ftestexcept.c deleted file mode 100644 index 38686cb..0000000 --- a/glibc/sysdeps/riscv/fpu/ftestexcept.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Test exception in current environment. - Copyright (C) 1998, 2010 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <fenv.h> -#include <math_private.h> - -int -fetestexcept (int excepts) -{ - return libc_fetestexcept_riscv (excepts); -} -libm_hidden_def (fetestexcept) diff --git a/glibc/sysdeps/riscv/fpu/libm-test-ulps b/glibc/sysdeps/riscv/fpu/libm-test-ulps deleted file mode 100644 index e69de29..0000000 --- a/glibc/sysdeps/riscv/fpu/libm-test-ulps +++ /dev/null diff --git a/glibc/sysdeps/riscv/fpu/math_private.h b/glibc/sysdeps/riscv/fpu/math_private.h deleted file mode 100644 index 445ffed..0000000 --- a/glibc/sysdeps/riscv/fpu/math_private.h +++ /dev/null @@ -1,145 +0,0 @@ -/* Private floating point rounding and exceptions handling. RISC-V version. - Copyright (C) 2014-2015 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef RISCV_MATH_PRIVATE_H -#define RISCV_MATH_PRIVATE_H 1 - -#include <fenv.h> -#include <fpu_control.h> - -static __always_inline void -libc_feholdexcept_riscv (fenv_t *envp) -{ - _FPU_GETCW (*envp); - _FPU_SETFLAGS (0); -} - -#define libc_feholdexcept libc_feholdexcept_riscv -#define libc_feholdexceptf libc_feholdexcept_riscv -#define libc_feholdexceptl libc_feholdexcept_riscv - -static __always_inline void -libc_fesetround_riscv (int round) -{ - _FPU_SETROUND (round); -} - -#define libc_fesetround libc_fesetround_riscv -#define libc_fesetroundf libc_fesetround_riscv -#define libc_fesetroundl libc_fesetround_riscv - -static __always_inline void -libc_feholdexcept_setround_riscv (fenv_t *envp, int round) -{ - libc_fesetround_riscv (round); - libc_feholdexcept_riscv (envp); -} - -#define libc_feholdexcept_setround libc_feholdexcept_setround_riscv -#define libc_feholdexcept_setroundf libc_feholdexcept_setround_riscv -#define libc_feholdexcept_setroundl libc_feholdexcept_setround_riscv - -static __always_inline int -libc_fetestexcept_riscv (int ex) -{ - int cw; - - _FPU_GETFLAGS (cw); - - return cw & ex; -} - -#define libc_fetestexcept libc_fetestexcept_riscv -#define libc_fetestexceptf libc_fetestexcept_riscv -#define libc_fetestexceptl libc_fetestexcept_riscv - -static __always_inline void -libc_fesetenv_riscv (const fenv_t *envp) -{ - long env = (long) envp - (long) FE_DFL_ENV; - if (env != 0) - env = *envp; - - _FPU_SETCW (env); -} - -#define libc_fesetenv libc_fesetenv_riscv -#define libc_fesetenvf libc_fesetenv_riscv -#define libc_fesetenvl libc_fesetenv_riscv -#define libc_feresetround_noex libc_fesetenv_riscv -#define libc_feresetround_noexf libc_fesetenv_riscv -#define libc_feresetround_noexl libc_fesetenv_riscv - -static __always_inline int -libc_feupdateenv_test_riscv (const fenv_t *envp, int ex) -{ - fenv_t env = *envp; - int excepts; - - _FPU_SETROUND (0); - asm volatile ("csrrs %0, fcsr, %1" : "=r"(excepts) : "r"(env)); - - return excepts & ex; -} - -#define libc_feupdateenv_test libc_feupdateenv_test_riscv -#define libc_feupdateenv_testf libc_feupdateenv_test_riscv -#define libc_feupdateenv_testl libc_feupdateenv_test_riscv - -static __always_inline void -libc_feupdateenv_riscv (const fenv_t *envp) -{ - fenv_t env = *envp; - - _FPU_SETROUND (0); - asm volatile ("csrs fcsr, %0" : : "r"(env)); -} - -#define libc_feupdateenv libc_feupdateenv_riscv -#define libc_feupdateenvf libc_feupdateenv_riscv -#define libc_feupdateenvl libc_feupdateenv_riscv - -static __always_inline void -libc_feholdsetround_riscv (fenv_t *envp, int round) -{ - /* Note this implementation makes an improperly-formatted fenv_t and - so should only be used in conjunction with libc_feresetround. */ - int old_round; - asm volatile ("csrrw %0, frm, %1" : "=r"(old_round) : "r"(round)); - *envp = old_round; -} - -#define libc_feholdsetround libc_feholdsetround_riscv -#define libc_feholdsetroundf libc_feholdsetround_riscv -#define libc_feholdsetroundl libc_feholdsetround_riscv - -static __always_inline void -libc_feresetround_riscv (fenv_t *envp) -{ - /* Note this implementation takes an improperly-formatted fenv_t and - so should only be used in conjunction with libc_feholdsetround. */ - _FPU_SETROUND (*envp); -} - -#define libc_feresetround libc_feresetround_riscv -#define libc_feresetroundf libc_feresetround_riscv -#define libc_feresetroundl libc_feresetround_riscv - -#include_next <math_private.h> - -#endif diff --git a/glibc/sysdeps/riscv/fpu/s_copysign.c b/glibc/sysdeps/riscv/fpu/s_copysign.c deleted file mode 100644 index 32dc5dc..0000000 --- a/glibc/sysdeps/riscv/fpu/s_copysign.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "math.h" - -double __copysign(double x, double y) -{ - double res; - asm ("fsgnj.d %0, %1, %2" : "=f"(res) : "f"(x), "f"(y)); - return res; -} -weak_alias (__copysign, copysign) diff --git a/glibc/sysdeps/riscv/fpu/s_copysignf.c b/glibc/sysdeps/riscv/fpu/s_copysignf.c deleted file mode 100644 index 11d493b..0000000 --- a/glibc/sysdeps/riscv/fpu/s_copysignf.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "math.h" - -float __copysignf(float x, float y) -{ - float res; - asm ("fsgnj.s %0, %1, %2" : "=f"(res) : "f"(x), "f"(y)); - return res; -} -weak_alias (__copysignf, copysignf) diff --git a/glibc/sysdeps/riscv/fpu/s_fabs.c b/glibc/sysdeps/riscv/fpu/s_fabs.c deleted file mode 100644 index 95f5b28..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fabs.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "math.h" - -double __fabs(double x) -{ - double res; - asm ("fabs.d %0, %1" : "=f"(res) : "f"(x)); - return res; -} -weak_alias (__fabs, fabs) diff --git a/glibc/sysdeps/riscv/fpu/s_fabsf.c b/glibc/sysdeps/riscv/fpu/s_fabsf.c deleted file mode 100644 index 9df4ae6..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fabsf.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "math.h" - -float __fabsf(float x) -{ - float res; - asm ("fabs.s %0, %1" : "=f"(res) : "f"(x)); - return res; -} -weak_alias (__fabsf, fabsf) diff --git a/glibc/sysdeps/riscv/fpu/s_fdim.c b/glibc/sysdeps/riscv/fpu/s_fdim.c deleted file mode 100644 index 96c6199..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fdim.c +++ /dev/null @@ -1,22 +0,0 @@ -#include <errno.h> -#include <math.h> -#include "fpu_control.h" - -double __fdim (double x, double y) -{ - double diff = x - y; - - if (x <= y) - return 0.0; - -#ifdef __riscv_soft_float - if (isinf(diff)) - errno = ERANGE; -#else - if (__builtin_expect(_FCLASS(diff) & _FCLASS_INF, 0)) - errno = ERANGE; -#endif - - return diff; -} -weak_alias (__fdim, fdim) diff --git a/glibc/sysdeps/riscv/fpu/s_fdimf.c b/glibc/sysdeps/riscv/fpu/s_fdimf.c deleted file mode 100644 index 893132a..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fdimf.c +++ /dev/null @@ -1,22 +0,0 @@ -#include <errno.h> -#include <math.h> -#include "fpu_control.h" - -float __fdimf (float x, float y) -{ - float diff = x - y; - - if (x <= y) - return 0.0f; - -#ifdef __riscv_soft_float - if (isinf(diff)) - errno = ERANGE; -#else - if (__builtin_expect(_FCLASS(diff) & _FCLASS_INF, 0)) - errno = ERANGE; -#endif - - return diff; -} -weak_alias (__fdimf, fdimf) diff --git a/glibc/sysdeps/riscv/fpu/s_finite.c b/glibc/sysdeps/riscv/fpu/s_finite.c deleted file mode 100644 index bf2135b..0000000 --- a/glibc/sysdeps/riscv/fpu/s_finite.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "math.h" -#include "fpu_control.h" - -int __finite(double x) -{ - return _FCLASS(x) & ~(_FCLASS_INF | _FCLASS_NAN); -} -hidden_def (__finite) -weak_alias (__finite, finite) diff --git a/glibc/sysdeps/riscv/fpu/s_finitef.c b/glibc/sysdeps/riscv/fpu/s_finitef.c deleted file mode 100644 index 6448d2d..0000000 --- a/glibc/sysdeps/riscv/fpu/s_finitef.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "math.h" -#include "fpu_control.h" - -int __finitef(float x) -{ - return _FCLASS(x) & ~(_FCLASS_INF | _FCLASS_NAN); -} -hidden_def (__finitef) -weak_alias (__finitef, finitef) diff --git a/glibc/sysdeps/riscv/fpu/s_fma.c b/glibc/sysdeps/riscv/fpu/s_fma.c deleted file mode 100644 index 797bc7d..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fma.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <math.h> -#include <fenv.h> -#include <ieee754.h> - -double __fma (double x, double y, double z) -{ - double out; - asm volatile ("fmadd.d %0, %1, %2, %3" : "=f"(out) : "f"(x), "f"(y), "f"(z)); - return out; -} -weak_alias (__fma, fma) diff --git a/glibc/sysdeps/riscv/fpu/s_fmaf.c b/glibc/sysdeps/riscv/fpu/s_fmaf.c deleted file mode 100644 index 11775f9..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fmaf.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <math.h> -#include <fenv.h> -#include <ieee754.h> - -float __fmaf (float x, float y, float z) -{ - float out; - asm volatile ("fmadd.s %0, %1, %2, %3" : "=f"(out) : "f"(x), "f"(y), "f"(z)); - return out; -} -weak_alias (__fmaf, fmaf) diff --git a/glibc/sysdeps/riscv/fpu/s_fmax.c b/glibc/sysdeps/riscv/fpu/s_fmax.c deleted file mode 100644 index e133c67..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fmax.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <math.h> - -double __fmax (double x, double y) -{ -#ifdef __riscv_soft_float - if (isnan(x)) - return y; - if (isnan(y)) - return x; - return (x > y) ? x : y; -#else - double res; - asm ("fmax.d %0, %1, %2" : "=f"(res) : "f"(x), "f"(y)); - return res; -#endif -} -weak_alias (__fmax, fmax) diff --git a/glibc/sysdeps/riscv/fpu/s_fmaxf.c b/glibc/sysdeps/riscv/fpu/s_fmaxf.c deleted file mode 100644 index 6ec578c..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fmaxf.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <math.h> - -float __fmaxf (float x, float y) -{ -#ifdef __riscv_soft_float - if (isnan(x)) - return y; - if (isnan(y)) - return x; - return (x > y) ? x : y; -#else - float res; - asm ("fmax.s %0, %1, %2" : "=f"(res) : "f"(x), "f"(y)); - return res; -#endif -} -weak_alias (__fmaxf, fmaxf) diff --git a/glibc/sysdeps/riscv/fpu/s_fmin.c b/glibc/sysdeps/riscv/fpu/s_fmin.c deleted file mode 100644 index 8330620..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fmin.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <math.h> - -double __fmin (double x, double y) -{ -#ifdef __riscv_soft_float - if (isnan(x)) - return y; - if (isnan(y)) - return x; - return (x < y) ? x : y; -#else - double res; - asm ("fmin.d %0, %1, %2" : "=f"(res) : "f"(x), "f"(y)); - return res; -#endif -} -weak_alias (__fmin, fmin) diff --git a/glibc/sysdeps/riscv/fpu/s_fminf.c b/glibc/sysdeps/riscv/fpu/s_fminf.c deleted file mode 100644 index 00dcb6c..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fminf.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <math.h> - -float __fminf (float x, float y) -{ -#ifdef __riscv_soft_float - if (isnan(x)) - return y; - if (isnan(y)) - return x; - return (x < y) ? x : y; -#else - float res; - asm ("fmin.s %0, %1, %2" : "=f"(res) : "f"(x), "f"(y)); - return res; -#endif -} -weak_alias (__fminf, fminf) diff --git a/glibc/sysdeps/riscv/fpu/s_fpclassify.c b/glibc/sysdeps/riscv/fpu/s_fpclassify.c deleted file mode 100644 index 2b58c3f..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fpclassify.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <math.h> -#include "fpu_control.h" -#include "math_private.h" - -int __fpclassify (double x) -{ - int cls = _FCLASS(x); - if (__builtin_expect(cls & _FCLASS_NORM, _FCLASS_NORM)) - return FP_NORMAL; - if (__builtin_expect(cls & _FCLASS_ZERO, _FCLASS_ZERO)) - return FP_ZERO; - if (__builtin_expect(cls & _FCLASS_SUBNORM, _FCLASS_SUBNORM)) - return FP_SUBNORMAL; - if (__builtin_expect(cls & _FCLASS_INF, _FCLASS_INF)) - return FP_INFINITE; - return FP_NAN; -} -libm_hidden_def (__fpclassify) diff --git a/glibc/sysdeps/riscv/fpu/s_fpclassifyf.c b/glibc/sysdeps/riscv/fpu/s_fpclassifyf.c deleted file mode 100644 index fae20fa..0000000 --- a/glibc/sysdeps/riscv/fpu/s_fpclassifyf.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <math.h> -#include "fpu_control.h" -#include "math_private.h" - -int __fpclassifyf (float x) -{ - int cls = _FCLASS(x); - if (__builtin_expect(cls & _FCLASS_NORM, _FCLASS_NORM)) - return FP_NORMAL; - if (__builtin_expect(cls & _FCLASS_ZERO, _FCLASS_ZERO)) - return FP_ZERO; - if (__builtin_expect(cls & _FCLASS_SUBNORM, _FCLASS_SUBNORM)) - return FP_SUBNORMAL; - if (__builtin_expect(cls & _FCLASS_INF, _FCLASS_INF)) - return FP_INFINITE; - return FP_NAN; -} -libm_hidden_def (__fpclassifyf) diff --git a/glibc/sysdeps/riscv/fpu/s_isinf.c b/glibc/sysdeps/riscv/fpu/s_isinf.c deleted file mode 100644 index 339d97f..0000000 --- a/glibc/sysdeps/riscv/fpu/s_isinf.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "math.h" -#include "fpu_control.h" - -int __isinf(double x) -{ - int cls = _FCLASS(x); - return -((cls & _FCLASS_MINF) ? 1 : 0) | ((cls & _FCLASS_PINF) ? 1 : 0); -} -hidden_def (__isinf) -weak_alias (__isinf, isinf) diff --git a/glibc/sysdeps/riscv/fpu/s_isinff.c b/glibc/sysdeps/riscv/fpu/s_isinff.c deleted file mode 100644 index 501342e..0000000 --- a/glibc/sysdeps/riscv/fpu/s_isinff.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "math.h" -#include "fpu_control.h" - -int __isinff(float x) -{ - int cls = _FCLASS(x); - return -((cls & _FCLASS_MINF) ? 1 : 0) | ((cls & _FCLASS_PINF) ? 1 : 0); -} -hidden_def (__isinff) -weak_alias (__isinff, isinff) diff --git a/glibc/sysdeps/riscv/fpu/s_isnan.c b/glibc/sysdeps/riscv/fpu/s_isnan.c deleted file mode 100644 index dcbb629..0000000 --- a/glibc/sysdeps/riscv/fpu/s_isnan.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "math.h" -#include "fpu_control.h" - -int __isnan(double x) -{ - return _FCLASS(x) & _FCLASS_NAN; -} -hidden_def (__isnan) -weak_alias (__isnan, isnan) diff --git a/glibc/sysdeps/riscv/fpu/s_isnanf.c b/glibc/sysdeps/riscv/fpu/s_isnanf.c deleted file mode 100644 index 78e9d0c..0000000 --- a/glibc/sysdeps/riscv/fpu/s_isnanf.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "math.h" -#include "fpu_control.h" - -int __isnanf(float x) -{ - return _FCLASS(x) & _FCLASS_NAN; -} -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) diff --git a/glibc/sysdeps/riscv/fpu/s_signbit.c b/glibc/sysdeps/riscv/fpu/s_signbit.c deleted file mode 100644 index 5f99c3f..0000000 --- a/glibc/sysdeps/riscv/fpu/s_signbit.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <features.h> -#undef __USE_EXTERN_INLINES -#include <math.h> -#include <stdint.h> -#include "math_private.h" - -int __signbit (double x) -{ -#ifdef __riscv64 - int64_t hx; - EXTRACT_WORDS64 (hx, x); - return hx < 0; -#else - int32_t hx; - GET_HIGH_WORD (hx, x); - return hx < 0; -#endif -} diff --git a/glibc/sysdeps/riscv/fpu/s_signbitf.c b/glibc/sysdeps/riscv/fpu/s_signbitf.c deleted file mode 100644 index 6e25688..0000000 --- a/glibc/sysdeps/riscv/fpu/s_signbitf.c +++ /dev/null @@ -1,12 +0,0 @@ -#include <features.h> -#undef __USE_EXTERN_INLINES -#include <math.h> -#include <stdint.h> -#include "math_private.h" - -int __signbitf (float x) -{ - int32_t hx; - GET_FLOAT_WORD (hx, x); - return hx < 0; -} diff --git a/glibc/sysdeps/riscv/fpu_control.h b/glibc/sysdeps/riscv/fpu_control.h deleted file mode 100644 index f69e3f3..0000000 --- a/glibc/sysdeps/riscv/fpu_control.h +++ /dev/null @@ -1,84 +0,0 @@ -/* FPU control word bits. Mips version. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2008 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Olaf Flebbe and Ralf Baechle. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _FPU_CONTROL_H -#define _FPU_CONTROL_H - -#include <features.h> - -#ifdef __riscv_soft_float - -#define _FPU_RESERVED 0xffffffff -#define _FPU_DEFAULT 0x00000000 -typedef unsigned int fpu_control_t; -#define _FPU_GETCW(cw) (cw) = 0 -#define _FPU_GETROUND(cw) (cw) = 0 -#define _FPU_GETFLAGS(cw) (cw) = 0 -#define _FPU_SETCW(cw) do { } while (0) -#define _FPU_SETROUND(cw) do { } while (0) -#define _FPU_SETFLAGS(cw) do { } while (0) -extern fpu_control_t __fpu_control; - -#else /* __riscv_soft_float */ - -#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_GETROUND(cw) __asm__ volatile ("frrm %0" : "=r" (cw)) -#define _FPU_GETFLAGS(cw) __asm__ volatile ("frflags %0" : "=r" (cw)) -#define _FPU_SETCW(cw) __asm__ volatile ("fssr %z0" : : "rJ" (cw)) -#define _FPU_SETROUND(cw) __asm__ volatile ("fsrm %z0" : : "rJ" (cw)) -#define _FPU_SETFLAGS(cw) __asm__ volatile ("fsflags %z0" : : "rJ" (cw)) - -/* Default control word set at startup. */ -extern fpu_control_t __fpu_control; - -#define _FCLASS(x) ({ int res; \ - 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 abort(); \ - 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_soft_float */ - -#endif /* fpu_control.h */ diff --git a/glibc/sysdeps/riscv/gccframe.h b/glibc/sysdeps/riscv/gccframe.h deleted file mode 100644 index ec9311c..0000000 --- a/glibc/sysdeps/riscv/gccframe.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Definition of object in frame unwind info. mips version. - Copyright (C) 2001 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#define FIRST_PSEUDO_REGISTER 76 - -#include <sysdeps/generic/gccframe.h> diff --git a/glibc/sysdeps/riscv/get-rounding-mode.h b/glibc/sysdeps/riscv/get-rounding-mode.h deleted file mode 100644 index 0e1cce3..0000000 --- a/glibc/sysdeps/riscv/get-rounding-mode.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Determine floating-point rounding mode within libc. RISC-V version. - - Copyright (C) 2015 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _RISCV_GET_ROUNDING_MODE_H -#define _RISCV_GET_ROUNDING_MODE_H - -#include <fenv.h> -#include <fpu_control.h> - -/* Return the floating-point rounding mode. */ - -static inline int -get_rounding_mode (void) -{ - fpu_control_t fpcr; - - _FPU_GETROUND (fpcr); - return fpcr; -} - -#endif /* get-rounding-mode.h */ diff --git a/glibc/sysdeps/riscv/ieee754.h b/glibc/sysdeps/riscv/ieee754.h deleted file mode 100644 index 912e088..0000000 --- a/glibc/sysdeps/riscv/ieee754.h +++ /dev/null @@ -1,325 +0,0 @@ -/* Copyright (C) 1992, 1995, 1996, 1999, 2002, 2003 - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _IEEE754_H - -#define _IEEE754_H 1 -#include <features.h> - -#include <endian.h> - -#include <float.h> - -__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 -# if __FLOAT_WORD_ORDER == __BIG_ENDIAN - unsigned int mantissa0:20; - unsigned int exponent:11; - unsigned int negative:1; - unsigned int mantissa1:32; -# else - /* Together these comprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:20; - unsigned int exponent:11; - unsigned int negative:1; -# endif -#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 -# if __FLOAT_WORD_ORDER == __BIG_ENDIAN - unsigned int mantissa0:19; - unsigned int quiet_nan:1; - unsigned int exponent:11; - unsigned int negative:1; - 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 -#endif - } ieee_nan; - }; - -#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ - -#if LDBL_MANT_DIG == 113 - -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; -#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:15; - unsigned int quiet_nan:1; - unsigned int exponent:15; - unsigned int negative:1; -#endif /* Little endian. */ - } ieee_nan; - }; - -#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */ - -#elif LDBL_MANT_DIG == 64 - -union ieee854_long_double - { - long double d; - - /* This is the IEEE 854 double-extended-precision format. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:15; - unsigned int empty:16; - unsigned int mantissa0:32; - unsigned int mantissa1:32; -#endif -#if __BYTE_ORDER == __LITTLE_ENDIAN -# if __FLOAT_WORD_ORDER == __BIG_ENDIAN - unsigned int exponent:15; - unsigned int negative:1; - unsigned int empty:16; - unsigned int mantissa0:32; - unsigned int mantissa1:32; -# else - unsigned int mantissa1:32; - unsigned int mantissa0:32; - unsigned int exponent:15; - unsigned int negative:1; - unsigned int empty:16; -# endif -#endif - } ieee; - - /* This is for NaNs in the IEEE 854 double-extended-precision format. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:15; - unsigned int empty:16; - unsigned int one:1; - unsigned int quiet_nan:1; - unsigned int mantissa0:30; - unsigned int mantissa1:32; -#endif -#if __BYTE_ORDER == __LITTLE_ENDIAN -# if __FLOAT_WORD_ORDER == __BIG_ENDIAN - unsigned int exponent:15; - unsigned int negative:1; - unsigned int empty:16; - unsigned int mantissa0:30; - unsigned int quiet_nan:1; - unsigned int one:1; - unsigned int mantissa1:32; -# else - unsigned int mantissa1:32; - unsigned int mantissa0:30; - unsigned int quiet_nan:1; - unsigned int one:1; - unsigned int exponent:15; - unsigned int negative:1; - unsigned int empty:16; -# endif -#endif - } ieee_nan; - }; - -#define IEEE854_LONG_DOUBLE_BIAS 0x3fff - -#elif LDBL_MANT_DIG == 53 - -union ieee854_long_double - { - long 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 -# if __FLOAT_WORD_ORDER == __BIG_ENDIAN - unsigned int mantissa0:20; - unsigned int exponent:11; - unsigned int negative:1; - unsigned int mantissa1:32; -# else - /* Together these comprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:20; - unsigned int exponent:11; - unsigned int negative:1; -# endif -#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 -# if __FLOAT_WORD_ORDER == __BIG_ENDIAN - unsigned int mantissa0:19; - unsigned int quiet_nan:1; - unsigned int exponent:11; - unsigned int negative:1; - 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 -#endif - } ieee_nan; - }; - -#define IEEE854_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */ - -#endif /* LDBL_MANT_DIG == 53 */ - -__END_DECLS - -#endif /* ieee754.h */ diff --git a/glibc/sysdeps/riscv/jmpbuf-unwind.h b/glibc/sysdeps/riscv/jmpbuf-unwind.h deleted file mode 100644 index bfa1a64..0000000 --- a/glibc/sysdeps/riscv/jmpbuf-unwind.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (C) 2003, 2005, 2006 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <setjmp.h> -#include <stdint.h> -#include <unwind.h> -#include <sysdep.h> - -/* Test if longjmp to JMPBUF would unwind the frame - containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ - ((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp)) - -#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ - _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) - -static inline uintptr_t __attribute__ ((unused)) -_jmpbuf_sp (__jmp_buf regs) -{ - uintptr_t sp = regs[0].__sp; -#ifdef PTR_DEMANGLE - PTR_DEMANGLE (sp); -#endif - return sp; -} - -#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) - -/* We use the normal longjmp for unwinding. */ -#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/glibc/sysdeps/riscv/ldsodefs.h b/glibc/sysdeps/riscv/ldsodefs.h deleted file mode 100644 index 8820a08..0000000 --- a/glibc/sysdeps/riscv/ldsodefs.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Run-time dynamic linker data structures for loaded ELF shared objects. - Copyright (C) 2000, 2002, 2003, 2006, 2007 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _MIPS_LDSODEFS_H -#define _MIPS_LDSODEFS_H 1 - -#include <elf.h> - -struct La_mips_32_regs; -struct La_mips_32_retval; -struct La_mips_64_regs; -struct La_mips_64_retval; - -#define ARCH_PLTENTER_MEMBERS \ - Elf32_Addr (*mips_o32_gnu_pltenter) (Elf32_Sym *, unsigned int, \ - uintptr_t *, uintptr_t *, \ - const struct La_mips_32_regs *, \ - unsigned int *, const char *name, \ - long int *framesizep); \ - Elf32_Addr (*mips_n32_gnu_pltenter) (Elf32_Sym *, unsigned int, \ - uintptr_t *, uintptr_t *, \ - const struct La_mips_64_regs *, \ - unsigned int *, const char *name, \ - long int *framesizep); \ - Elf64_Addr (*mips_n64_gnu_pltenter) (Elf64_Sym *, unsigned int, \ - uintptr_t *, uintptr_t *, \ - const struct La_mips_64_regs *, \ - unsigned int *, const char *name, \ - long int *framesizep); - -#define ARCH_PLTEXIT_MEMBERS \ - unsigned int (*mips_o32_gnu_pltexit) (Elf32_Sym *, unsigned int, \ - uintptr_t *, uintptr_t *, \ - const struct La_mips_32_regs *, \ - struct La_mips_32_retval *, \ - const char *); \ - unsigned int (*mips_n32_gnu_pltexit) (Elf32_Sym *, unsigned int, \ - uintptr_t *, uintptr_t *, \ - const struct La_mips_64_regs *, \ - struct La_mips_64_retval *, \ - const char *); \ - unsigned int (*mips_n64_gnu_pltexit) (Elf64_Sym *, unsigned int, \ - uintptr_t *, uintptr_t *, \ - const struct La_mips_64_regs *, \ - struct La_mips_64_retval *, \ - const char *); - -/* The MIPS ABI specifies that the dynamic section has to be read-only. */ - -#define DL_RO_DYN_SECTION 1 - -#include_next <ldsodefs.h> - -#endif diff --git a/glibc/sysdeps/riscv/libc-tls.c b/glibc/sysdeps/riscv/libc-tls.c deleted file mode 100644 index 9984dce..0000000 --- a/glibc/sysdeps/riscv/libc-tls.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Thread-local storage handling in the ELF dynamic linker. MIPS version. - Copyright (C) 2005 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <csu/libc-tls.c> -#include <dl-tls.h> - -#if USE_TLS - -/* On RISC-V, linker optimizations are not required, so __tls_get_addr - can be called even in statically linked binaries. In this case module - must be always 1 and PT_TLS segment exist in the binary, otherwise it - would not link. */ - -void * -__tls_get_addr (tls_index *ti) -{ - dtv_t *dtv = THREAD_DTV (); - return (char *) dtv[1].pointer.val + GET_ADDR_OFFSET; -} - -#endif diff --git a/glibc/sysdeps/riscv/linkmap.h b/glibc/sysdeps/riscv/linkmap.h deleted file mode 100644 index a6df782..0000000 --- a/glibc/sysdeps/riscv/linkmap.h +++ /dev/null @@ -1,4 +0,0 @@ -struct link_map_machine - { - ElfW(Addr) plt; /* Address of .plt */ - }; diff --git a/glibc/sysdeps/riscv/memcpy.c b/glibc/sysdeps/riscv/memcpy.c deleted file mode 100644 index 94e6435..0000000 --- a/glibc/sysdeps/riscv/memcpy.c +++ /dev/null @@ -1,68 +0,0 @@ -#include <string.h> -#include <stdint.h> - -void* __memcpy(void* aa, const void* bb, size_t n) -{ - #define BODY(a, b, t) { \ - t tt = *b; \ - a++, b++; \ - *(a-1) = tt; \ - } - - char* a = (char*)aa; - const char* b = (const char*)bb; - char* end = a+n; - uintptr_t msk = sizeof(long)-1; - if (__builtin_expect(((uintptr_t)a & msk) != ((uintptr_t)b & msk) || n < sizeof(long), 0)) - { -small: - if (__builtin_expect(a < end, 1)) - while (a < end) - BODY(a, b, char); - return aa; - } - - if (__builtin_expect(((uintptr_t)a & msk) != 0, 0)) - while ((uintptr_t)a & msk) - BODY(a, b, char); - - long* la = (long*)a; - const long* lb = (const long*)b; - long* lend = (long*)((uintptr_t)end & ~msk); - - if (__builtin_expect(la < lend-8, 0)) - { - while (la < lend-8) - { - long b0 = *lb++; - long b1 = *lb++; - long b2 = *lb++; - long b3 = *lb++; - long b4 = *lb++; - long b5 = *lb++; - long b6 = *lb++; - long b7 = *lb++; - long b8 = *lb++; - *la++ = b0; - *la++ = b1; - *la++ = b2; - *la++ = b3; - *la++ = b4; - *la++ = b5; - *la++ = b6; - *la++ = b7; - *la++ = b8; - } - } - - while (la < lend) - BODY(la, lb, long); - - a = (char*)la; - b = (const char*)lb; - if (__builtin_expect(a < end, 0)) - goto small; - return aa; -} -weak_alias (__memcpy, memcpy) -libc_hidden_builtin_def (memcpy) diff --git a/glibc/sysdeps/riscv/memset.S b/glibc/sysdeps/riscv/memset.S deleted file mode 100644 index 660d594..0000000 --- a/glibc/sysdeps/riscv/memset.S +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (C) 2014 Free Software Foundation, Inc. - Contributed by Andrew Waterman (waterman@cs.berkeley.edu) at UC Berkeley. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#include <sysdep.h> -#include <sys/asm.h> - -ENTRY(memset) - li a6, 15 - move a4, a0 - bleu a2, a6, .Ltiny - and a5, a4, 15 - bnez a5, .Lmisaligned - -.Laligned: - bnez a1, .Lwordify - -.Lwordified: - and a3, a2, ~15 - and a2, a2, 15 - add a3, a3, a4 - -#ifdef __riscv64 -1:sd a1, 0(a4) - sd a1, 8(a4) -#else -1:sw a1, 0(a4) - sw a1, 4(a4) - sw a1, 8(a4) - sw a1, 12(a4) -#endif - add a4, a4, 16 - bltu a4, a3, 1b - - bnez a2, .Ltiny - ret - -.Ltiny: - sub a3, a6, a2 - sll a3, a3, 2 -1:auipc t0, %pcrel_hi(.Ltable) - add a3, a3, t0 -.option push -.option norvc -.Ltable_misaligned: - jr a3, %pcrel_lo(1b) -.Ltable: - sb a1,14(a4) - sb a1,13(a4) - sb a1,12(a4) - sb a1,11(a4) - sb a1,10(a4) - sb a1, 9(a4) - sb a1, 8(a4) - sb a1, 7(a4) - sb a1, 6(a4) - sb a1, 5(a4) - sb a1, 4(a4) - sb a1, 3(a4) - sb a1, 2(a4) - sb a1, 1(a4) - sb a1, 0(a4) -.option pop - ret - -.Lwordify: - and a1, a1, 0xFF - sll a3, a1, 8 - or a1, a1, a3 - sll a3, a1, 16 - or a1, a1, a3 -#ifdef __riscv64 - sll a3, a1, 32 - or a1, a1, a3 -#endif - j .Lwordified - -.Lmisaligned: - sll a3, a5, 2 -1:auipc t0, %pcrel_hi(.Ltable_misaligned) - add a3, a3, t0 - mv t0, ra - jalr a3, %pcrel_lo(1b) - mv ra, t0 - - add a5, a5, -16 - sub a4, a4, a5 - add a2, a2, a5 - bleu a2, a6, .Ltiny - j .Laligned -END(memset) - -weak_alias(memset, __GI_memset) diff --git a/glibc/sysdeps/riscv/memusage.h b/glibc/sysdeps/riscv/memusage.h deleted file mode 100644 index c558a06..0000000 --- a/glibc/sysdeps/riscv/memusage.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (C) 2000 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; }) - -#include <sysdeps/generic/memusage.h> diff --git a/glibc/sysdeps/riscv/nptl/Makefile b/glibc/sysdeps/riscv/nptl/Makefile deleted file mode 100644 index d0c59a5..0000000 --- a/glibc/sysdeps/riscv/nptl/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (C) 2005 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, write to the Free -# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -# 02111-1307 USA. - -ifeq ($(subdir),csu) -gen-as-const-headers += tcb-offsets.sym -endif - -ifeq ($(subdir),nptl) -libpthread-sysdep_routines += nptl-sysdep -endif diff --git a/glibc/sysdeps/riscv/nptl/bits/pthreadtypes.h b/glibc/sysdeps/riscv/nptl/bits/pthreadtypes.h deleted file mode 100644 index 25e449d..0000000 --- a/glibc/sysdeps/riscv/nptl/bits/pthreadtypes.h +++ /dev/null @@ -1,241 +0,0 @@ -/* Machine-specific pthread type layouts. RISC-V version. - Copyright (C) 2011-2014 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _BITS_PTHREADTYPES_H -#define _BITS_PTHREADTYPES_H 1 - -#include <endian.h> - -#ifdef __riscv64 -# define __SIZEOF_PTHREAD_ATTR_T 56 -# define __SIZEOF_PTHREAD_MUTEX_T 40 -# define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -# define __SIZEOF_PTHREAD_COND_T 48 -# define __SIZEOF_PTHREAD_CONDATTR_T 4 -# define __SIZEOF_PTHREAD_RWLOCK_T 56 -# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -# define __SIZEOF_PTHREAD_BARRIER_T 32 -# define __SIZEOF_PTHREAD_BARRIERATTR_T 4 -#else -# define __SIZEOF_PTHREAD_ATTR_T 36 -# define __SIZEOF_PTHREAD_MUTEX_T 24 -# define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -# define __SIZEOF_PTHREAD_COND_T 48 -# define __SIZEOF_PTHREAD_CONDATTR_T 4 -# define __SIZEOF_PTHREAD_RWLOCK_T 32 -# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -# define __SIZEOF_PTHREAD_BARRIER_T 20 -# define __SIZEOF_PTHREAD_BARRIERATTR_T 4 -#endif - - -/* Thread identifiers. The structure of the attribute type is - deliberately not exposed. */ -typedef unsigned long int pthread_t; - - -union pthread_attr_t -{ - char __size[__SIZEOF_PTHREAD_ATTR_T]; - long int __align; -}; -#ifndef __have_pthread_attr_t -typedef union pthread_attr_t pthread_attr_t; -# define __have_pthread_attr_t 1 -#endif - -#ifdef __riscv64 -typedef struct __pthread_internal_list -{ - struct __pthread_internal_list *__prev; - struct __pthread_internal_list *__next; -} __pthread_list_t; -#else -typedef struct __pthread_internal_slist -{ - struct __pthread_internal_slist *__next; -} __pthread_slist_t; -#endif - - -/* Data structures for mutex handling. The structure of the attribute - type is deliberately not exposed. */ -typedef union -{ - struct __pthread_mutex_s - { - int __lock; - unsigned int __count; - int __owner; -#ifdef __riscv64 - unsigned int __nusers; -#endif - /* KIND must stay at this position in the structure to maintain - binary compatibility. */ - int __kind; -#ifdef __riscv64 - int __spins; - __pthread_list_t __list; -# define __PTHREAD_MUTEX_HAVE_PREV 1 -#else - unsigned int __nusers; - __extension__ union - { - int __spins; - __pthread_slist_t __list; - }; -#endif - } __data; - char __size[__SIZEOF_PTHREAD_MUTEX_T]; - long int __align; -} pthread_mutex_t; - -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */ -#define __PTHREAD_SPINS 0 - -typedef union -{ - char __size[__SIZEOF_PTHREAD_MUTEXATTR_T]; - int __align; -} pthread_mutexattr_t; - - -/* Data structure for conditional variable handling. The structure of - the attribute type is deliberately not exposed. */ -typedef union -{ - struct - { - int __lock; - unsigned int __futex; - __extension__ unsigned long long int __total_seq; - __extension__ unsigned long long int __wakeup_seq; - __extension__ unsigned long long int __woken_seq; - void *__mutex; - unsigned int __nwaiters; - unsigned int __broadcast_seq; - } __data; - char __size[__SIZEOF_PTHREAD_COND_T]; - __extension__ long long int __align; -} pthread_cond_t; - -typedef union -{ - char __size[__SIZEOF_PTHREAD_CONDATTR_T]; - int __align; -} pthread_condattr_t; - - -/* Keys for thread-specific data */ -typedef unsigned int pthread_key_t; - - -/* Once-only execution */ -typedef int pthread_once_t; - - -#if defined __USE_UNIX98 || defined __USE_XOPEN2K -/* Data structure for read-write lock variable handling. The - structure of the attribute type is deliberately not exposed. */ -typedef union -{ -# ifdef __riscv64 - struct - { - int __lock; - unsigned int __nr_readers; - unsigned int __readers_wakeup; - unsigned int __writer_wakeup; - unsigned int __nr_readers_queued; - unsigned int __nr_writers_queued; - int __writer; - int __shared; - unsigned long int __pad1; - unsigned long int __pad2; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned int __flags; - } __data; -# else - struct - { - int __lock; - unsigned int __nr_readers; - unsigned int __readers_wakeup; - unsigned int __writer_wakeup; - unsigned int __nr_readers_queued; - unsigned int __nr_writers_queued; -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned char __pad1; - unsigned char __pad2; - unsigned char __shared; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; -#else - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; - unsigned char __shared; - unsigned char __pad1; - unsigned char __pad2; -#endif - int __writer; - } __data; -# endif - char __size[__SIZEOF_PTHREAD_RWLOCK_T]; - long int __align; -} pthread_rwlock_t; - -#define __PTHREAD_RWLOCK_ELISION_EXTRA 0 - -typedef union -{ - char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T]; - long int __align; -} pthread_rwlockattr_t; -#endif - - -#ifdef __USE_XOPEN2K -/* POSIX spinlock data type. */ -#ifdef __riscv_atomic -typedef volatile int pthread_spinlock_t; -#else -typedef pthread_mutex_t pthread_spinlock_t; -#endif - - -/* POSIX barriers data type. The structure of the type is - deliberately not exposed. */ -typedef union -{ - char __size[__SIZEOF_PTHREAD_BARRIER_T]; - long int __align; -} pthread_barrier_t; - -typedef union -{ - char __size[__SIZEOF_PTHREAD_BARRIERATTR_T]; - int __align; -} pthread_barrierattr_t; -#endif - - -#endif /* bits/pthreadtypes.h */ diff --git a/glibc/sysdeps/riscv/nptl/bits/semaphore.h b/glibc/sysdeps/riscv/nptl/bits/semaphore.h deleted file mode 100644 index 6f775b4..0000000 --- a/glibc/sysdeps/riscv/nptl/bits/semaphore.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002, 2005, 2007 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SEMAPHORE_H -# error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead." -#endif - -#ifdef __riscv64 -# define __SIZEOF_SEM_T 32 -#else -# define __SIZEOF_SEM_T 16 -#endif - -/* Value returned if `sem_open' failed. */ -#define SEM_FAILED ((sem_t *) 0) - - -typedef union -{ - char __size[__SIZEOF_SEM_T]; - long int __align; -} sem_t; diff --git a/glibc/sysdeps/riscv/nptl/clone.S b/glibc/sysdeps/riscv/nptl/clone.S deleted file mode 100644 index 4106a34..0000000 --- a/glibc/sysdeps/riscv/nptl/clone.S +++ /dev/null @@ -1,2 +0,0 @@ -#define RESET_PID -#include <sysdeps/unix/sysv/linux/riscv/clone.S> diff --git a/glibc/sysdeps/riscv/nptl/libc-lowlevellock.c b/glibc/sysdeps/riscv/nptl/libc-lowlevellock.c deleted file mode 100644 index 0ecd41e..0000000 --- a/glibc/sysdeps/riscv/nptl/libc-lowlevellock.c +++ /dev/null @@ -1,8 +0,0 @@ -/* This kludge works around a libpthread static linking problem: - https://sourceware.org/bugzilla/show_bug.cgi?id=15648 */ - -#ifndef SHARED -# define __lll_lock_wait_private weak_function __lll_lock_wait_private -#endif - -#include <lowlevellock.c> diff --git a/glibc/sysdeps/riscv/nptl/nptl-sysdep.c b/glibc/sysdeps/riscv/nptl/nptl-sysdep.c deleted file mode 100644 index 16c1736..0000000 --- a/glibc/sysdeps/riscv/nptl/nptl-sysdep.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Pull in __syscall_error. */ -#include <sysdep.c> diff --git a/glibc/sysdeps/riscv/nptl/pt-vfork.S b/glibc/sysdeps/riscv/nptl/pt-vfork.S deleted file mode 100644 index 4edfd73..0000000 --- a/glibc/sysdeps/riscv/nptl/pt-vfork.S +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2005, 2006 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <tls.h> -#include "tcb-offsets.h" - -/* Save the PID value. */ -#define SAVE_PID \ - lw t0, PID_OFFSET(tp); /* Load the saved PID. */ \ - neg t0, t0; /* Negate it. */ \ - sw t0, PID_OFFSET(tp); /* Store the temporary PID. */ - -/* Restore the old PID value in the parent. */ -#define RESTORE_PID \ - beqz a0, 1f; /* If we are the parent... */ \ - lw t0, PID_OFFSET(tp); /* Load the saved PID. */ \ - neg t0, t0; /* Re-negate it. */ \ - sw t0, PID_OFFSET(tp); /* Restore the PID. */ \ -1: - -#include <sysdeps/unix/sysv/linux/riscv/vfork.S> diff --git a/glibc/sysdeps/riscv/nptl/pthread_spin_destroy.c b/glibc/sysdeps/riscv/nptl/pthread_spin_destroy.c deleted file mode 100644 index 1d65005..0000000 --- a/glibc/sysdeps/riscv/nptl/pthread_spin_destroy.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include "pthreadP.h" - - -int -pthread_spin_destroy (pthread_spinlock_t *lock) -{ -#ifdef __riscv_atomic - /* Nothing to do. */ - return 0; -#else - return pthread_mutex_destroy(lock); -#endif -} diff --git a/glibc/sysdeps/riscv/nptl/pthread_spin_init.c b/glibc/sysdeps/riscv/nptl/pthread_spin_init.c deleted file mode 100644 index d3c4317..0000000 --- a/glibc/sysdeps/riscv/nptl/pthread_spin_init.c +++ /dev/null @@ -1,33 +0,0 @@ -/* pthread_spin_init -- initialize a spin lock. Generic version. - Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include "pthreadP.h" - - -int -pthread_spin_init (pthread_spinlock_t *lock, int pshared) -{ -#ifdef __riscv_atomic - *lock = 0; - return 0; -#else - return pthread_mutex_init(lock, NULL); -#endif -} diff --git a/glibc/sysdeps/riscv/nptl/pthread_spin_lock.c b/glibc/sysdeps/riscv/nptl/pthread_spin_lock.c deleted file mode 100644 index 0e8840b..0000000 --- a/glibc/sysdeps/riscv/nptl/pthread_spin_lock.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2005 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> - -int pthread_spin_lock(pthread_spinlock_t* lock) -{ -#ifdef __riscv_atomic - int tmp1, tmp2; - - asm volatile ("\n\ - 1:lw %0, 0(%2)\n\ - li %1, %3\n\ - bnez %0, 1b\n\ - amoswap.w.aq %0, %1, 0(%2)\n\ - bnez %0, 1b" - : "=&r"(tmp1), "=&r"(tmp2) : "r"(lock), "i"(EBUSY) - ); - - return tmp1; -#else - return pthread_mutex_lock(lock); -#endif -} diff --git a/glibc/sysdeps/riscv/nptl/pthread_spin_trylock.c b/glibc/sysdeps/riscv/nptl/pthread_spin_trylock.c deleted file mode 100644 index b19ec5e..0000000 --- a/glibc/sysdeps/riscv/nptl/pthread_spin_trylock.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2005 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> - -int pthread_spin_trylock(pthread_spinlock_t* lock) -{ -#ifdef __riscv_atomic - int tmp1, tmp2; - - asm volatile ("\n\ - lw %0, 0(%2)\n\ - li %1, %3\n\ - bnez %0, 1f\n\ - amoswap.w.aq %0, %1, 0(%2)\n\ - 1:" - : "=&r"(tmp1), "=&r"(tmp2) : "r"(lock), "i"(EBUSY) - ); - - return tmp1; -#else - return pthread_mutex_trylock(lock); -#endif -} diff --git a/glibc/sysdeps/riscv/nptl/pthread_spin_unlock.c b/glibc/sysdeps/riscv/nptl/pthread_spin_unlock.c deleted file mode 100644 index 133311c..0000000 --- a/glibc/sysdeps/riscv/nptl/pthread_spin_unlock.c +++ /dev/null @@ -1,33 +0,0 @@ -/* pthread_spin_unlock -- unlock a spin lock. Generic version. - Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include "pthreadP.h" -#include <atomic.h> - -int -pthread_spin_unlock (pthread_spinlock_t *lock) -{ -#ifdef __riscv_atomic - asm volatile ("amoswap.w.rl x0, x0, 0(%0)" : : "r"(lock)); - return 0; -#else - return pthread_mutex_unlock(lock); -#endif -} diff --git a/glibc/sysdeps/riscv/nptl/pthreaddef.h b/glibc/sysdeps/riscv/nptl/pthreaddef.h deleted file mode 100644 index 59927ed..0000000 --- a/glibc/sysdeps/riscv/nptl/pthreaddef.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2011-2014 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Default stack size. */ -#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) - -/* Required stack pointer alignment at beginning. */ -#define STACK_ALIGN 16 - -/* Minimal stack size after allocating thread descriptor and guard size. */ -#define MINIMAL_REST_STACK 2048 - -/* Alignment requirement for TCB. */ -#define TCB_ALIGNMENT 16 - -/* Location of current stack frame. */ -#define CURRENT_STACK_FRAME __builtin_frame_address (0) diff --git a/glibc/sysdeps/riscv/nptl/sysdep-cancel.h b/glibc/sysdeps/riscv/nptl/sysdep-cancel.h deleted file mode 100644 index 3a3b116..0000000 --- a/glibc/sysdeps/riscv/nptl/sysdep-cancel.h +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright (C) 2003, 2004, 2005, 2006 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <sysdep.h> -#include <sysdeps/generic/sysdep.h> -#include <tls.h> -#ifndef __ASSEMBLER__ -# include <nptl/pthreadP.h> -#endif -#include <sys/asm.h> - -/* Gas will put the initial save of $gp into the CIE, because it appears to - happen before any instructions. So we use cfi_same_value instead of - cfi_restore. */ - -#if IS_IN (libc) || IS_IN (libpthread) || IS_IN (librt) - -# undef PSEUDO -# define PSEUDO(name, syscall_name, args) \ - .align 2; \ - L(pseudo_start): \ - 99: j __syscall_error; \ - ENTRY (name) \ - SINGLE_THREAD_P(t0); \ - bnez t0, L(pseudo_cancel); \ - .type __##syscall_name##_nocancel, @function; \ - .globl __##syscall_name##_nocancel; \ - __##syscall_name##_nocancel: \ - li a7, SYS_ify(syscall_name); \ - scall; \ - bltz a0, 99b; \ - ret; \ - .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \ - L(pseudo_cancel): \ - addi sp, sp, -STKSPACE; \ - REG_S ra, STKOFF_RA(sp); \ - cfi_rel_offset (ra, STKOFF_RA); \ - PUSHARGS_##args; /* save syscall args */ \ - CENABLE; \ - REG_S a0, STKOFF_SVMSK(sp); /* save mask */ \ - POPARGS_##args; /* restore syscall args */ \ - li a7, SYS_ify (syscall_name); \ - scall; \ - REG_S a0, STKOFF_A0(sp); /* save syscall result */ \ - REG_L a0, STKOFF_SVMSK(sp); /* pass mask as arg1 */ \ - CDISABLE; \ - REG_L ra, STKOFF_RA(sp); /* restore return address */ \ - REG_L a0, STKOFF_A0(sp); /* restore syscall result */ \ - addi sp, sp, STKSPACE; \ - bltz a0, 99b; \ - L(pseudo_end): - - -# define PUSHARGS_0 /* nothing to do */ -# define PUSHARGS_1 PUSHARGS_0 REG_S a0, STKOFF_A0(sp); cfi_rel_offset (a0, STKOFF_A0); -# define PUSHARGS_2 PUSHARGS_1 REG_S a1, STKOFF_A1(sp); cfi_rel_offset (a1, STKOFF_A1); -# define PUSHARGS_3 PUSHARGS_2 REG_S a2, STKOFF_A2(sp); cfi_rel_offset (a2, STKOFF_A2); -# define PUSHARGS_4 PUSHARGS_3 REG_S a3, STKOFF_A3(sp); cfi_rel_offset (a3, STKOFF_A3); -# define PUSHARGS_5 PUSHARGS_4 REG_S a4, STKOFF_A4(sp); cfi_rel_offset (a4, STKOFF_A4); -# define PUSHARGS_6 PUSHARGS_5 REG_S a5, STKOFF_A5(sp); cfi_rel_offset (a5, STKOFF_A5); - -# define POPARGS_0 /* nothing to do */ -# define POPARGS_1 POPARGS_0 REG_L a0, STKOFF_A0(sp); -# define POPARGS_2 POPARGS_1 REG_L a1, STKOFF_A1(sp); -# define POPARGS_3 POPARGS_2 REG_L a2, STKOFF_A2(sp); -# define POPARGS_4 POPARGS_3 REG_L a3, STKOFF_A3(sp); -# define POPARGS_5 POPARGS_4 REG_L a4, STKOFF_A4(sp); -# define POPARGS_6 POPARGS_5 REG_L a5, STKOFF_A5(sp); - -/* Avoid D$ misses by keeping less-used arguments further down stack. */ -# define STKOFF_A5 0 -# define STKOFF_A4 (STKOFF_A5 + SZREG) -# define STKOFF_A3 (STKOFF_A4 + SZREG) -# define STKOFF_A2 (STKOFF_A3 + SZREG) -# define STKOFF_A1 (STKOFF_A2 + SZREG) -# define STKOFF_A0 (STKOFF_A1 + SZREG) -# define STKOFF_SVMSK (STKOFF_A0 + SZREG) -# define STKOFF_RA (STKOFF_SVMSK + SZREG) -# define STKSPACE (STKOFF_RA + SZREG) - -# if IS_IN (libpthread) -# define CENABLE call __pthread_enable_asynccancel -# define CDISABLE call __pthread_disable_asynccancel -# elif IS_IN (librt) -# define CENABLE call __librt_enable_asynccancel -# define CDISABLE call __librt_disable_asynccancel -# else -# define CENABLE call __libc_enable_asynccancel -# define CDISABLE call __libc_disable_asynccancel -# endif - -# ifndef __ASSEMBLER__ -# define SINGLE_THREAD_P \ - __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ - header.multiple_threads) \ - == 0, 1) -# else -# include "tcb-offsets.h" -# define SINGLE_THREAD_P(reg) \ - lw reg, MULTIPLE_THREADS_OFFSET(tp) -#endif - -#elif !defined __ASSEMBLER__ - -# define SINGLE_THREAD_P 1 -# define NO_CANCELLATION 1 - -#endif - -#ifndef __ASSEMBLER__ -# define RTLD_SINGLE_THREAD_P \ - __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ - header.multiple_threads) == 0, 1) -#endif diff --git a/glibc/sysdeps/riscv/nptl/tcb-offsets.sym b/glibc/sysdeps/riscv/nptl/tcb-offsets.sym deleted file mode 100644 index e0e71dc..0000000 --- a/glibc/sysdeps/riscv/nptl/tcb-offsets.sym +++ /dev/null @@ -1,11 +0,0 @@ -#include <sysdep.h> -#include <tls.h> - --- - --- Abuse tls.h macros to derive offsets relative to the thread register. -#define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) - -MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) -PID_OFFSET thread_offsetof (pid) -TID_OFFSET thread_offsetof (tid) diff --git a/glibc/sysdeps/riscv/nptl/tls.h b/glibc/sysdeps/riscv/nptl/tls.h deleted file mode 100644 index 2982f97..0000000 --- a/glibc/sysdeps/riscv/nptl/tls.h +++ /dev/null @@ -1,159 +0,0 @@ -/* Definition for thread-local data handling. NPTL/RISC-V version. - Copyright (C) 2011-2014 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _RISCV_TLS_H -#define _RISCV_TLS_H 1 - -#include <dl-sysdep.h> - -/* Signal that TLS support is available. */ -#define USE_TLS 1 - -#ifndef __ASSEMBLER__ -# include <stdbool.h> -# include <stddef.h> -# include <stdint.h> - -/* Type for the dtv. */ -typedef union dtv -{ - size_t counter; - struct - { - void *val; - bool is_static; - } pointer; -} dtv_t; - -register void* __thread_self asm("tp"); -# define READ_THREAD_POINTER() ({ __thread_self; }) - -/* Get system call information. */ -# include <sysdep.h> - -/* The TP points to the start of the thread blocks. */ -# define TLS_DTV_AT_TP 1 -# define TLS_TCB_AT_TP 0 - -/* Get the thread descriptor definition. */ -# include <nptl/descr.h> - -typedef struct -{ - dtv_t *dtv; - void *private; -} tcbhead_t; - -/* This is the size of the initial TCB. Because our TCB is before the thread - pointer, we don't need this. */ -# define TLS_INIT_TCB_SIZE 0 - -/* Alignment requirements for the initial TCB. */ -# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread) - -/* This is the size of the TCB. Because our TCB is before the thread - pointer, we don't need this. */ -# define TLS_TCB_SIZE 0 - -/* Alignment requirements for the TCB. */ -# define TLS_TCB_ALIGN __alignof__ (struct pthread) - -/* This is the size we need before TCB - actually, it includes the TCB. */ -# define TLS_PRE_TCB_SIZE \ - (sizeof (struct pthread) \ - + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1))) - -/* The thread pointer tp points to the end of the TCB. - The pthread_descr structure is immediately in front of the TCB. */ -# define TLS_TCB_OFFSET 0 - -/* Install the dtv pointer. The pointer passed is to the element with - index -1 which contain the length. */ -# define INSTALL_DTV(tcbp, dtvp) \ - (((tcbhead_t *) (tcbp))[-1].dtv = (dtvp) + 1) - -/* Install new dtv for current thread. */ -# define INSTALL_NEW_DTV(dtv) \ - (THREAD_DTV() = (dtv)) - -/* Return dtv of given thread descriptor. */ -# define GET_DTV(tcbp) \ - (((tcbhead_t *) (tcbp))[-1].dtv) - -/* Code to initially initialize the thread pointer. */ -# define TLS_INIT_TP(tcbp) \ - ({ __thread_self = (char*)tcbp + TLS_TCB_OFFSET; NULL; }) - -/* Return the address of the dtv for the current thread. */ -# define THREAD_DTV() \ - (((tcbhead_t *) (READ_THREAD_POINTER () - TLS_TCB_OFFSET))[-1].dtv) - -/* Return the thread descriptor for the current thread. */ -# define THREAD_SELF \ - ((struct pthread *) (READ_THREAD_POINTER () \ - - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)) - -/* Value passed to 'clone' for initialization of the thread register. */ -# define TLS_DEFINE_INIT_TP(tp, pd) \ - void *tp = (void *) (pd) + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE - -/* Magic for libthread_db to know how to do THREAD_SELF. */ -# define DB_THREAD_SELF \ - CONST_THREAD_AREA (32, TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE) - -/* Access to data in the thread descriptor is easy. */ -# define THREAD_GETMEM(descr, member) \ - descr->member -# define THREAD_GETMEM_NC(descr, member, idx) \ - descr->member[idx] -# define THREAD_SETMEM(descr, member, value) \ - descr->member = (value) -# define THREAD_SETMEM_NC(descr, member, idx, value) \ - descr->member[idx] = (value) - -/* l_tls_offset == 0 is perfectly valid, so we have to use some different - value to mean unset l_tls_offset. */ -# define NO_TLS_OFFSET -1 - -/* Get and set the global scope generation counter in struct pthread. */ -# define THREAD_GSCOPE_FLAG_UNUSED 0 -# define THREAD_GSCOPE_FLAG_USED 1 -# define THREAD_GSCOPE_FLAG_WAIT 2 -# define THREAD_GSCOPE_RESET_FLAG() \ - do \ - { int __res \ - = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag, \ - THREAD_GSCOPE_FLAG_UNUSED); \ - if (__res == THREAD_GSCOPE_FLAG_WAIT) \ - lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE); \ - } \ - while (0) -# define THREAD_GSCOPE_SET_FLAG() \ - do \ - { \ - THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED; \ - atomic_write_barrier (); \ - } \ - while (0) -# define THREAD_GSCOPE_WAIT() \ - GL(dl_wait_lookup_done) () - -#endif /* __ASSEMBLER__ */ - -#endif /* tls.h */ diff --git a/glibc/sysdeps/riscv/nptl/vfork.S b/glibc/sysdeps/riscv/nptl/vfork.S deleted file mode 100644 index 56467dc..0000000 --- a/glibc/sysdeps/riscv/nptl/vfork.S +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2005, 2006 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <tls.h> -#include "tcb-offsets.h" - -/* Save the PID value. */ -#define SAVE_PID \ - lw t0, PID_OFFSET(tp); /* Load the saved PID. */ \ - neg t0, t0; /* Negate it. */ \ - bnez t0, 1f; /* If it was zero... */ \ - li t0, 0x80000000; /* use 0x80000000 instead. */ \ -1: sw t0, PID_OFFSET(tp); /* Store the temporary PID. */ - -/* Restore the old PID value in the parent. */ -#define RESTORE_PID \ - beqz a0, 1f; /* If we are the parent... */ \ - lw t0, PID_OFFSET(tp); /* Load the saved PID. */ \ - neg t0, t0; /* Re-negate it. */ \ - li t1, 0x80000000; /* Load 0x80000000... */ \ - bne t0, t1, 2f; /* ... compare against it... */ \ - li t0, 0; /* ... use 0 instead. */ \ -2: sw t0, PID_OFFSET(tp); /* Restore the PID. */ \ -1: - -#include <sysdeps/unix/sysv/linux/riscv/vfork.S> diff --git a/glibc/sysdeps/riscv/preconfigure b/glibc/sysdeps/riscv/preconfigure deleted file mode 100644 index 5863d2d..0000000 --- a/glibc/sysdeps/riscv/preconfigure +++ /dev/null @@ -1,28 +0,0 @@ -case "$machine" in -riscv32*) base_machine=riscv machine=riscv/rv32 - machine=$machine/$config_machine - ;; -riscv*) - case "$CC $CFLAGS $CPPFLAGS " in - *" -m32 "*) riscv_cc_abi=32 ;; - *" -m64 "*) riscv_cc_abi=64 ;; - *) riscv_cc_abi=default ;; - esac - case $config_os in - *64*) riscv_config_abi=64 ;; - *32*) riscv_config_abi=32 ;; - *) riscv_config_abi=$riscv_cc_abi ;; - esac - case $riscv_config_abi in - default) base_machine=riscv machine=riscv/rv64 ;; - 32) base_machine=riscv machine=riscv/rv32 ;; - 64) base_machine=riscv machine=riscv/rv64 ;; - esac - machine=$machine/$config_machine - if test $riscv_config_abi != $riscv_cc_abi; then - # This won't make it to config.make, but we want to - # set this in case configure tests depend on it. - CPPFLAGS="$CPPFLAGS -m$riscv_config_abi" - fi - ;; -esac diff --git a/glibc/sysdeps/riscv/rv32/Implies b/glibc/sysdeps/riscv/rv32/Implies deleted file mode 100644 index b2313e9..0000000 --- a/glibc/sysdeps/riscv/rv32/Implies +++ /dev/null @@ -1,2 +0,0 @@ -riscv -wordsize-32 diff --git a/glibc/sysdeps/riscv/rv32/Makefile b/glibc/sysdeps/riscv/rv32/Makefile deleted file mode 100644 index f9c69e3..0000000 --- a/glibc/sysdeps/riscv/rv32/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(filter -m32,$(CC)),) -CC += -m32 -endif diff --git a/glibc/sysdeps/riscv/rv64/Implies b/glibc/sysdeps/riscv/rv64/Implies deleted file mode 100644 index fae63bc..0000000 --- a/glibc/sysdeps/riscv/rv64/Implies +++ /dev/null @@ -1,6 +0,0 @@ -ieee754/flt-32 -ieee754/dbl-64 -riscv/rv64/soft-fp -riscv/rv64 -riscv -wordsize-64 diff --git a/glibc/sysdeps/riscv/rv64/Makefile b/glibc/sysdeps/riscv/rv64/Makefile deleted file mode 100644 index df2aaff..0000000 --- a/glibc/sysdeps/riscv/rv64/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(filter -m64,$(CC)),) -CC += -m64 -endif diff --git a/glibc/sysdeps/riscv/rv64/Versions b/glibc/sysdeps/riscv/rv64/Versions deleted file mode 100644 index 253a65f..0000000 --- a/glibc/sysdeps/riscv/rv64/Versions +++ /dev/null @@ -1,7 +0,0 @@ -libm { - GLIBC_2.1 { - # A generic bug got this omitted from other configurations' version - # sets, but we always had it. - exp2l; - } -} diff --git a/glibc/sysdeps/riscv/rv64/gmp-mparam.h b/glibc/sysdeps/riscv/rv64/gmp-mparam.h deleted file mode 100644 index 7666137..0000000 --- a/glibc/sysdeps/riscv/rv64/gmp-mparam.h +++ /dev/null @@ -1,31 +0,0 @@ -/* gmp-mparam.h -- Compiler/machine parameter header file. - -Copyright (C) 1991, 1993, 1994, 2002, 2003 Free Software Foundation, Inc. - -This file is part of the GNU MP Library. - -The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#if defined __GMP_H__ && ! defined _LONG_LONG_LIMB -#error "Included too late for _LONG_LONG_LIMB to take effect" -#endif - -#define _LONG_LONG_LIMB -#define BITS_PER_MP_LIMB 64 -#define BYTES_PER_MP_LIMB 8 -#define BITS_PER_LONGINT __WORDSIZE -#define BITS_PER_INT 32 -#define BITS_PER_SHORTINT 16 -#define BITS_PER_CHAR 8 diff --git a/glibc/sysdeps/riscv/rv64/soft-fp/Makefile b/glibc/sysdeps/riscv/rv64/soft-fp/Makefile deleted file mode 100644 index ada13e8..0000000 --- a/glibc/sysdeps/riscv/rv64/soft-fp/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifeq ($(subdir),math) -CPPFLAGS += -I../soft-fp -endif diff --git a/glibc/sysdeps/riscv/rv64/soft-fp/sfp-machine.h b/glibc/sysdeps/riscv/rv64/soft-fp/sfp-machine.h deleted file mode 100644 index 0bf2776..0000000 --- a/glibc/sysdeps/riscv/rv64/soft-fp/sfp-machine.h +++ /dev/null @@ -1,74 +0,0 @@ -#include <fenv.h> -#include <fpu_control.h> - -#define _FP_W_TYPE_SIZE 64 -#define _FP_W_TYPE unsigned long long -#define _FP_WS_TYPE signed long long -#define _FP_I_TYPE long long - -#define _FP_MUL_MEAT_S(R,X,Y) \ - _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) -#define _FP_MUL_MEAT_D(R,X,Y) \ - _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) -#define _FP_MUL_MEAT_Q(R,X,Y) \ - _FP_MUL_MEAT_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) - -#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) -#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y) -#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) - -#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) -#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1) -#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1 -#define _FP_NANSIGN_S 0 -#define _FP_NANSIGN_D 0 -#define _FP_NANSIGN_Q 0 - -#define _FP_KEEPNANFRACP 1 -/* From my experiments it seems X is chosen unless one of the - NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */ -#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ - do { \ - if ((_FP_FRAC_HIGH_RAW_##fs(X) | \ - _FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs) \ - { \ - R##_s = _FP_NANSIGN_##fs; \ - _FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs); \ - } \ - else \ - { \ - R##_s = X##_s; \ - _FP_FRAC_COPY_##wc(R,X); \ - } \ - R##_c = FP_CLS_NAN; \ - } while (0) - -#define _FP_DECL_EX fpu_control_t _fcw - -#define FP_ROUNDMODE (_fcw >> 5) - -#define FP_RND_NEAREST FE_TONEAREST -#define FP_RND_ZERO FE_TOWARDZERO -#define FP_RND_PINF FE_UPWARD -#define FP_RND_MINF FE_DOWNWARD - -#define FP_EX_INVALID FE_INVALID -#define FP_EX_OVERFLOW FE_OVERFLOW -#define FP_EX_UNDERFLOW FE_UNDERFLOW -#define FP_EX_DIVZERO FE_DIVBYZERO -#define FP_EX_INEXACT FE_INEXACT - -#ifdef __mips_hard_float -#define FP_INIT_ROUNDMODE \ -do { \ - _FPU_GETCW (_fcw); \ -} while (0) - -#define FP_HANDLE_EXCEPTIONS \ -do { \ - if (__builtin_expect (_fex, 0)) \ - _FPU_SETCW (_fcw | _fex); \ -} while (0) -#else -#define FP_INIT_ROUNDMODE _fcw = 0 /* no exceptions; FP_RND_NEAREST */ -#endif diff --git a/glibc/sysdeps/riscv/setjmp.S b/glibc/sysdeps/riscv/setjmp.S deleted file mode 100644 index 9327a91..0000000 --- a/glibc/sysdeps/riscv/setjmp.S +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (C) 1996, 1997, 2000, 2002, 2003, 2004 - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <sysdep.h> -#include <sys/asm.h> - -ENTRY (_setjmp) - li a1, 0 - j __sigsetjmp -END (_setjmp) -ENTRY (setjmp) - li a1, 1 - /* Fallthrough */ -END (setjmp) -ENTRY (__sigsetjmp) - REG_S ra, 0*SZREG(a0) - REG_S s0, 1*SZREG(a0) - REG_S s1, 2*SZREG(a0) - REG_S s2, 3*SZREG(a0) - REG_S s3, 4*SZREG(a0) - REG_S s4, 5*SZREG(a0) - REG_S s5, 6*SZREG(a0) - REG_S s6, 7*SZREG(a0) - REG_S s7, 8*SZREG(a0) - REG_S s8, 9*SZREG(a0) - REG_S s9, 10*SZREG(a0) - REG_S s10,11*SZREG(a0) - REG_S s11,12*SZREG(a0) - REG_S sp, 13*SZREG(a0) - -#ifdef __riscv_hard_float - frsr a3 - - fsd fs0, 16*SZREG+ 0*8(a0) - fsd fs1, 16*SZREG+ 1*8(a0) - fsd fs2, 16*SZREG+ 2*8(a0) - fsd fs3, 16*SZREG+ 3*8(a0) - fsd fs4, 16*SZREG+ 4*8(a0) - fsd fs5, 16*SZREG+ 5*8(a0) - fsd fs6, 16*SZREG+ 6*8(a0) - fsd fs7, 16*SZREG+ 7*8(a0) - fsd fs8, 16*SZREG+ 8*8(a0) - fsd fs9, 16*SZREG+ 9*8(a0) - fsd fs10,16*SZREG+10*8(a0) - fsd fs11,16*SZREG+11*8(a0) - - REG_S a3, 15*SZREG(a0) -#endif - -#if !IS_IN (libc) && IS_IN (rtld) - /* In ld.so we never save the signal mask. */ - li a0, 0 - ret -#else - /* Make a tail call to __sigjmp_save; it takes the same args. */ - j __sigjmp_save -#endif - - -END(__sigsetjmp) - -weak_alias(_setjmp, __GI__setjmp) diff --git a/glibc/sysdeps/riscv/soft-fp/sfp-machine.h b/glibc/sysdeps/riscv/soft-fp/sfp-machine.h deleted file mode 100644 index 3b2a40f..0000000 --- a/glibc/sysdeps/riscv/soft-fp/sfp-machine.h +++ /dev/null @@ -1,47 +0,0 @@ -#define _FP_W_TYPE_SIZE 32 -#define _FP_W_TYPE unsigned long -#define _FP_WS_TYPE signed long -#define _FP_I_TYPE long - -#define _FP_MUL_MEAT_S(R,X,Y) \ - _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) -#define _FP_MUL_MEAT_D(R,X,Y) \ - _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) -#define _FP_MUL_MEAT_Q(R,X,Y) \ - _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) - -#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(S,R,X,Y) -#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) -#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) - -#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) -#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 -#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 -#define _FP_NANSIGN_S 0 -#define _FP_NANSIGN_D 0 -#define _FP_NANSIGN_Q 0 - -#define _FP_KEEPNANFRACP 1 -/* From my experiments it seems X is chosen unless one of the - NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */ -#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ - do { \ - if ((_FP_FRAC_HIGH_RAW_##fs(X) | \ - _FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs) \ - { \ - R##_s = _FP_NANSIGN_##fs; \ - _FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs); \ - } \ - else \ - { \ - R##_s = X##_s; \ - _FP_FRAC_COPY_##wc(R,X); \ - } \ - R##_c = FP_CLS_NAN; \ - } while (0) - -#define FP_EX_INVALID (1 << 4) -#define FP_EX_DIVZERO (1 << 3) -#define FP_EX_OVERFLOW (1 << 2) -#define FP_EX_UNDERFLOW (1 << 1) -#define FP_EX_INEXACT (1 << 0) diff --git a/glibc/sysdeps/riscv/sotruss-lib.c b/glibc/sysdeps/riscv/sotruss-lib.c deleted file mode 100644 index f7bf3f1..0000000 --- a/glibc/sysdeps/riscv/sotruss-lib.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Override generic sotruss-lib.c to define actual functions for RISC-V. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#define HAVE_ARCH_PLTENTER -#define HAVE_ARCH_PLTEXIT - -#include <elf/sotruss-lib.c> - -ElfW(Addr) -la_riscv_gnu_pltenter (ElfW(Sym) *sym __attribute__ ((unused)), - unsigned int ndx __attribute__ ((unused)), - uintptr_t *refcook, uintptr_t *defcook, - La_riscv_regs *regs, unsigned int *flags, - const char *symname, long int *framesizep) -{ - print_enter (refcook, defcook, symname, - regs->lr_reg[0], regs->lr_reg[1], regs->lr_reg[2], - *flags); - - /* No need to copy anything, we will not need the parameters in any case. */ - *framesizep = 0; - - return sym->st_value; -} - -unsigned int -la_riscv_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook, - uintptr_t *defcook, - const struct La_riscv_regs *inregs, - struct La_riscv_retval *outregs, - const char *symname) -{ - print_exit (refcook, defcook, symname, outregs->lrv_a0); - - return 0; -} diff --git a/glibc/sysdeps/riscv/stackinfo.h b/glibc/sysdeps/riscv/stackinfo.h deleted file mode 100644 index 7a5e3e0..0000000 --- a/glibc/sysdeps/riscv/stackinfo.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 2000, 2010 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This file contains a bit of information about the stack allocation - of the processor. */ - -#ifndef _STACKINFO_H -#define _STACKINFO_H 1 - -#include <elf.h> - -/* On MIPS the stack grows down. */ -#define _STACK_GROWS_DOWN 1 - -/* Default to an executable stack. PF_X can be overridden if PT_GNU_STACK is - * present, but it is presumed absent. */ -#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X) - -#endif /* stackinfo.h */ diff --git a/glibc/sysdeps/riscv/start.S b/glibc/sysdeps/riscv/start.S deleted file mode 100644 index 8195002..0000000 --- a/glibc/sysdeps/riscv/start.S +++ /dev/null @@ -1,66 +0,0 @@ -/* Startup code compliant to the ELF Mips ABI. - Copyright (C) 1995, 1997, 2000, 2001, 2002, 2003, 2004 - 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. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#define __ASSEMBLY__ 1 -#include <entry.h> -#include <sysdep.h> -#include <sys/asm.h> - -/* The entry point's job is to call __libc_start_main. Per the ABI, - a0 contains the address of a function to be passed to atexit. - __libc_start_main wants this in a5. */ - -ENTRY(ENTRY_POINT) - lla gp, _gp - move a5, a0 /* rtld_fini */ - lla a0, main - REG_L a1, 0(sp) /* argc */ - addi a2, sp, SZREG /* argv */ - andi sp, sp, ALMASK /* Align stack. */ - lla a3, __libc_csu_init - lla a4, __libc_csu_fini - move a6, sp /* stack_end */ - - tail __libc_start_main@ -END(ENTRY_POINT) - -/* Define a symbol for the first piece of initialized data. */ - .data - .globl __data_start -__data_start: - .weak data_start - data_start = __data_start diff --git a/glibc/sysdeps/riscv/strcmp.S b/glibc/sysdeps/riscv/strcmp.S deleted file mode 100644 index d6b6eec..0000000 --- a/glibc/sysdeps/riscv/strcmp.S +++ /dev/null @@ -1,143 +0,0 @@ -# Artisanally coded in California by A. Shell Waterman - -#include <sysdep.h> -#include <sys/asm.h> - -#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ -# error -#endif - -ENTRY(strcmp) - or a4, a0, a1 - li t2, -1 - and a4, a4, SZREG-1 - bnez a4, .Lmisaligned - -#if SZREG == 4 - li t3, 0x7f7f7f7f -#else - ld t3, mask -#endif - - .macro check_one_word i n - REG_L a2, \i*SZREG(a0) - REG_L a3, \i*SZREG(a1) - - and t0, a2, t3 - or t1, a2, t3 - add t0, t0, t3 - or t0, t0, t1 - - bne t0, t2, .Lnull\i - .if \i+1-\n - bne a2, a3, .Lmismatch - .else - add a0, a0, \n*SZREG - add a1, a1, \n*SZREG - beq a2, a3, .Lloop - # fall through to .Lmismatch - .endif - .endm - - .macro foundnull i n - .ifne \i - .Lnull\i: - add a0, a0, \i*SZREG - add a1, a1, \i*SZREG - .ifeq \i-1 - .Lnull0: - .endif - bne a2, a3, .Lmisaligned - li a0, 0 - ret - .endif - .endm - -.Lloop: - # examine full words at a time, favoring strings of a couple dozen chars -#ifdef __riscv32 - check_one_word 0 5 - check_one_word 1 5 - check_one_word 2 5 - check_one_word 3 5 - check_one_word 4 5 -#else - check_one_word 0 3 - check_one_word 1 3 - check_one_word 2 3 -#endif - # backwards branch to .Lloop contained above - -.Lmismatch: - # words don't match, but a2 has no null byte. -#ifdef __riscv64 - sll a4, a2, 48 - sll a5, a3, 48 - bne a4, a5, .Lmismatch_upper - sll a4, a2, 32 - sll a5, a3, 32 - bne a4, a5, .Lmismatch_upper -#endif - sll a4, a2, 16 - sll a5, a3, 16 - bne a4, a5, .Lmismatch_upper - - srl a4, a2, 8*SZREG-16 - srl a5, a3, 8*SZREG-16 - sub a0, a4, a5 - and a1, a0, 0xff - bnez a1, 1f - ret - -.Lmismatch_upper: - srl a4, a4, 8*SZREG-16 - srl a5, a5, 8*SZREG-16 - sub a0, a4, a5 - and a1, a0, 0xff - bnez a1, 1f - ret - -1:and a4, a4, 0xff - and a5, a5, 0xff - sub a0, a4, a5 - ret - -.Lmisaligned: - # misaligned - lbu a2, 0(a0) - lbu a3, 0(a1) - add a0, a0, 1 - add a1, a1, 1 - bne a2, a3, 1f - bnez a2, .Lmisaligned - -1: - sub a0, a2, a3 - ret - - # cases in which a null byte was detected -#ifdef __riscv32 - foundnull 0 5 - foundnull 1 5 - foundnull 2 5 - foundnull 3 5 - foundnull 4 5 -#else - foundnull 0 3 - foundnull 1 3 - foundnull 2 3 -#endif - -END(strcmp) - -weak_alias(strcmp, __GI_strcmp) - -#if SZREG == 8 -#ifdef __PIC__ -.section .rodata.cst8,"aM",@progbits,8 -#else -.section .srodata.cst8,"aM",@progbits,8 -#endif -.align 3 -mask: .8byte 0x7f7f7f7f7f7f7f7f -#endif diff --git a/glibc/sysdeps/riscv/strcpy.c b/glibc/sysdeps/riscv/strcpy.c deleted file mode 100644 index c01c506..0000000 --- a/glibc/sysdeps/riscv/strcpy.c +++ /dev/null @@ -1,54 +0,0 @@ -#include <string.h> -#include <stdint.h> - -#undef strcpy - -char* strcpy(char* dst, const char* src) -{ - char* dst0 = dst; - - int misaligned = ((uintptr_t)dst | (uintptr_t)src) & (sizeof(long)-1); - if (__builtin_expect(!misaligned, 1)) - { - long* ldst = (long*)dst; - const long* lsrc = (const long*)src; - - while (!__libc_detect_null(*lsrc)) - *ldst++ = *lsrc++; - - dst = (char*)ldst; - src = (const char*)lsrc; - - char c0 = src[0]; - char c1 = src[1]; - char c2 = src[2]; - if (!(*dst++ = c0)) return dst0; - if (!(*dst++ = c1)) return dst0; - char c3 = src[3]; - if (!(*dst++ = c2)) return dst0; - if (sizeof(long) == 4) goto out; - char c4 = src[4]; - if (!(*dst++ = c3)) return dst0; - char c5 = src[5]; - if (!(*dst++ = c4)) return dst0; - char c6 = src[6]; - if (!(*dst++ = c5)) return dst0; - if (!(*dst++ = c6)) return dst0; - -out: - *dst++ = 0; - return dst0; - } - - char ch; - do - { - ch = *src; - src++; - dst++; - *(dst-1) = ch; - } while(ch); - - return dst0; -} -libc_hidden_def(strcpy) diff --git a/glibc/sysdeps/riscv/strlen.c b/glibc/sysdeps/riscv/strlen.c deleted file mode 100644 index 2630f46..0000000 --- a/glibc/sysdeps/riscv/strlen.c +++ /dev/null @@ -1,38 +0,0 @@ -#include <string.h> -#include <stdint.h> - -#undef strlen - -size_t strlen(const char* str) -{ - const char* start = str; - - if (__builtin_expect((uintptr_t)str & (sizeof(long)-1), 0)) do - { - char ch = *str; - str++; - if (!ch) - return str - start - 1; - } while ((uintptr_t)str & (sizeof(long)-1)); - - unsigned long* ls = (unsigned long*)str; - while (!__libc_detect_null(*ls++)) - ; - asm volatile ("" : "+r"(ls)); /* prevent "optimization" */ - - str = (const char*)ls; - size_t ret = str - start, sl = sizeof(long); - - char c0 = str[0-sl], c1 = str[1-sl], c2 = str[2-sl], c3 = str[3-sl]; - if (c0 == 0) return ret + 0 - sl; - if (c1 == 0) return ret + 1 - sl; - if (c2 == 0) return ret + 2 - sl; - if (sl == 4 || c3 == 0) return ret + 3 - sl; - - c0 = str[4-sl], c1 = str[5-sl], c2 = str[6-sl], c3 = str[7-sl]; - if (c0 == 0) return ret + 4 - sl; - if (c1 == 0) return ret + 5 - sl; - if (c2 == 0) return ret + 6 - sl; - return ret + 7 - sl; -} -libc_hidden_def(strlen) diff --git a/glibc/sysdeps/riscv/sys/asm.h b/glibc/sysdeps/riscv/sys/asm.h deleted file mode 100644 index 9b034b6..0000000 --- a/glibc/sysdeps/riscv/sys/asm.h +++ /dev/null @@ -1,69 +0,0 @@ -/* copyright (c) 1997, 1998, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ralf Baechle <ralf@gnu.org>. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SYS_ASM_H -#define _SYS_ASM_H - -/* - * Macros to handle different pointer/register sizes for 32/64-bit code - */ -#ifdef __riscv64 -# define PTR .dword -# define PTRLOG 3 -# define SZREG 8 -# define REG_S sd -# define REG_L ld -#else -# define PTR .word -# define PTRLOG 2 -# define SZREG 4 -# define REG_S sw -# define REG_L lw -#endif - -/* - * LEAF - declare leaf routine - */ -#define LEAF(symbol) \ - .globl symbol; \ - .align 2; \ - .type symbol,@function; \ -symbol: \ - cfi_startproc; - -/* - * NESTED - declare nested routine entry point - */ -#define NESTED(symbol, framesize, rpc) LEAF(symbol) - -/* - * END - mark end of function - */ -#undef END -#define END(function) \ - cfi_endproc; \ - .size function,.-function - -/* - * Stack alignment - */ -#define ALMASK ~15 - -#endif /* sys/asm.h */ diff --git a/glibc/sysdeps/riscv/tcb-offsets.sym b/glibc/sysdeps/riscv/tcb-offsets.sym deleted file mode 100644 index e0e71dc..0000000 --- a/glibc/sysdeps/riscv/tcb-offsets.sym +++ /dev/null @@ -1,11 +0,0 @@ -#include <sysdep.h> -#include <tls.h> - --- - --- Abuse tls.h macros to derive offsets relative to the thread register. -#define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) - -MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) -PID_OFFSET thread_offsetof (pid) -TID_OFFSET thread_offsetof (tid) diff --git a/glibc/sysdeps/riscv/tst-audit.h b/glibc/sysdeps/riscv/tst-audit.h deleted file mode 100644 index 6bd4a15..0000000 --- a/glibc/sysdeps/riscv/tst-audit.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Definitions for testing PLT entry/exit auditing. ARM version. - - Copyright (C) 2005 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#define pltenter la_riscv_gnu_pltenter -#define pltexit la_riscv_gnu_pltexit -#define La_regs La_riscv_regs -#define La_retval La_riscv_retval -#define int_retval lrv_a0 diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/Implies b/glibc/sysdeps/unix/sysv/linux/riscv/Implies deleted file mode 100644 index 6faec70..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/Implies +++ /dev/null @@ -1 +0,0 @@ -riscv/nptl diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/Makefile b/glibc/sysdeps/unix/sysv/linux/riscv/Makefile deleted file mode 100644 index a71840f..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -ifeq ($(subdir),elf) -ifeq ($(build-shared),yes) -# This is needed for DSO loading from static binaries. -sysdep-dl-routines += dl-static -sysdep_routines += dl-static -sysdep-rtld-routines += dl-static -endif -endif - -ifeq ($(subdir),stdlib) -gen-as-const-headers += ucontext_i.sym -endif - -ifeq ($(subdir),crypt) -libcrypt-sysdep_routines += sysdep -endif - -ifeq ($(subdir),nss) -libnss_db-sysdep_routines += sysdep -libnss_db-shared-only-routines += sysdep -endif - -ifeq ($(subdir),rt) -librt-sysdep_routines += sysdep -librt-shared-only-routines += sysdep -endif diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/Versions b/glibc/sysdeps/unix/sysv/linux/riscv/Versions deleted file mode 100644 index a56322a..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/Versions +++ /dev/null @@ -1,40 +0,0 @@ -ld { - GLIBC_PRIVATE { - # used for loading by static libraries - _dl_var_init; - } -} -libc { - # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk. - # When you get an error from errlist-compat.awk, you need to add a new - # version here. Don't do this blindly, since this means changing the ABI - # for all GNU/Linux configurations. - - GLIBC_2.0 { - #errlist-compat 123 - _sys_errlist; sys_errlist; _sys_nerr; sys_nerr; - - # Exception handling support functions from libgcc - __register_frame; __register_frame_table; __deregister_frame; - __frame_state_for; __register_frame_info_table; - - # Needed by gcc: - _flush_cache; - - # c* - cachectl; cacheflush; - - # s* - sysmips; - } - GLIBC_2.2 { - #errlist-compat 1134 - _sys_errlist; sys_errlist; _sys_nerr; sys_nerr; - - # _* - _test_and_set; - } - GLIBC_2.11 { - fallocate64; - } -} diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/____longjmp_chk.S b/glibc/sysdeps/unix/sysv/linux/riscv/____longjmp_chk.S deleted file mode 100644 index e903c7e..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/____longjmp_chk.S +++ /dev/null @@ -1,2 +0,0 @@ -#define __longjmp ____longjmp_chk -#include <__longjmp.S> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/arch-fork.h b/glibc/sysdeps/unix/sysv/linux/riscv/arch-fork.h deleted file mode 100644 index 5f94537..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/arch-fork.h +++ /dev/null @@ -1 +0,0 @@ -#include <sysdeps/unix/sysv/linux/i386/arch-fork.h> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/atomic-machine.h b/glibc/sysdeps/unix/sysv/linux/riscv/atomic-machine.h deleted file mode 100644 index e0fe86d..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/atomic-machine.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Low-level functions for atomic operations. RISC-V version. - Copyright (C) 2014-2016 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _LINUX_RISCV_BITS_ATOMIC_H -#define _LINUX_RISCV_BITS_ATOMIC_H 1 - -#include_next <atomic-machine.h> - -#ifndef __riscv_atomic - -#include <sys/syscall.h> -#include <sysdep.h> - -#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ - (abort (), (__typeof (*mem)) 0) - -#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ - (abort (), (__typeof (*mem)) 0) - -/* The only basic operation needed is compare and exchange. */ -#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ \ - INTERNAL_SYSCALL_DECL (__err); \ - (__typeof (*mem)) INTERNAL_SYSCALL (sysriscv, __err, 4, \ - RISCV_ATOMIC_CMPXCHG, mem, oldval, newval); \ - }) - -#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ - ({ \ - INTERNAL_SYSCALL_DECL (__err); \ - (__typeof (*mem)) INTERNAL_SYSCALL (sysriscv, __err, 4, \ - RISCV_ATOMIC_CMPXCHG64, mem, oldval, newval); \ - }) - -#endif /* __riscv_atomic */ - -#endif /* bits/atomic.h */ diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/bits/fcntl.h b/glibc/sysdeps/unix/sysv/linux/riscv/bits/fcntl.h deleted file mode 100644 index 8a166f6..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/bits/fcntl.h +++ /dev/null @@ -1,61 +0,0 @@ -/* O_*, F_*, FD_* bit values for Linux / RISC-V. - Copyright (C) 2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _FCNTL_H -# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." -#endif - -#include <bits/wordsize.h> - -/* 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 <bits/fcntl-linux.h> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/bits/mman.h b/glibc/sysdeps/unix/sysv/linux/riscv/bits/mman.h deleted file mode 100644 index 8ee3d96..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/bits/mman.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Definitions for POSIX memory map interface. Linux/MIPS version. - Copyright (C) 1997, 2000, 2003, 2004, 2005, 2006, 2009, 2011 - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SYS_MMAN_H -# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." -#endif - -#ifdef __USE_MISC -# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ -# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ -# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ -# define MAP_LOCKED 0x02000 /* Lock the mapping. */ -# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ -# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ -# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ -# define MAP_STACK 0x20000 /* Allocation is for a stack. */ -# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ -#endif - -/* Include generic Linux declarations. */ -#include <bits/mman-linux.h> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h b/glibc/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h deleted file mode 100644 index a4fc69b..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 1996, 1997, 1998, 2003, 2004, 2006 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _BITS_SIGCONTEXT_H -#define _BITS_SIGCONTEXT_H 1 - -#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H -# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead." -#endif - -struct sigcontext { - /* gregs[0] holds the program counter. */ - unsigned long gregs[32]; - unsigned long long fpregs[32]; - unsigned int fsr; -}; - -#endif diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/clone.S b/glibc/sysdeps/unix/sysv/linux/riscv/clone.S deleted file mode 100644 index 368d40a..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/clone.S +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright (C) 1996, 1997, 2000, 2003, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ralf Baechle <ralf@linux-mips.org>, 1996. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* clone() is even more special than fork() as it mucks with stacks - and invokes a function in the right context after its all over. */ - -#include <sys/asm.h> -#include <sysdep.h> -#define _ERRNO_H 1 -#include <bits/errno.h> -#ifdef RESET_PID -#include <tls.h> -#include "tcb-offsets.h" -#endif - -#define CLONE_VM 0x00000100 -#define CLONE_THREAD 0x00010000 - -/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg, - void *parent_tidptr, void *tls, void *child_tidptr) */ - - .text -LEAF(__clone) - - /* Sanity check arguments. */ - beqz a0,L(invalid) /* No NULL function pointers. */ - beqz a1,L(invalid) /* No NULL stack pointers. */ - - addi a1,a1,-32 /* Reserve argument save space. */ - REG_S a0,0(a1) /* Save function pointer. */ - REG_S a3,SZREG(a1) /* Save argument pointer. */ -#ifdef RESET_PID - REG_S a2,(SZREG*2)(a1) /* Save clone flags. */ -#endif - - /* The syscall expects the args to be in different slots. */ - move a0,a2 - move a2,a4 - move a3,a5 - move a4,a6 - - /* Do the system call */ - li a7,__NR_clone - scall - - bltz a0,L(error) - beqz a0,L(thread_start) - - /* Successful return from the parent */ - ret - -L(invalid): - li a0, 0 - /* Something bad happened -- no child created */ -L(error): - j __syscall_error - END(__clone) - -/* Load up the arguments to the function. Put this block of code in - its own function so that we can terminate the stack trace with our - debug info. */ - -ENTRY(__thread_start) -L(thread_start): - /* The stackframe has been created on entry of clone(). */ - -#ifdef RESET_PID - /* Check and see if we need to reset the PID. */ - REG_L a0,(SZREG*2)(sp) - li a1,CLONE_THREAD - and a1,a0,a1 - beqz a1,L(restore_pid) -L(donepid): -#endif - - /* Restore the arg for user's function. */ - REG_L a1,0(sp) /* Function pointer. */ - REG_L a0,SZREG(sp) /* Argument pointer. */ - - /* Call the user's function. */ - jalr a1 - - /* Call _exit with the function's return value. */ - j _exit - -#ifdef RESET_PID -L(restore_pid): - and a1,a0,CLONE_VM - li a2,-1 - bnez a1,L(gotpid) - li a2,__NR_getpid - scall -L(gotpid): - sw a2,PID_OFFSET(tp) - sw a2,TID_OFFSET(tp) - j L(donepid) -#endif - - END(__thread_start) - -weak_alias (__clone, clone) diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/configure b/glibc/sysdeps/unix/sysv/linux/riscv/configure deleted file mode 100644 index 038022f..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/configure +++ /dev/null @@ -1,28 +0,0 @@ -# This file is generated from configure.in by Autoconf. DO NOT EDIT! - # Local configure fragment for sysdeps/unix/sysv/linux/riscv. - -case "$prefix" in -/usr | /usr/) - # 32-bit libraries on bi-arch platforms go in /lib32 instead of /lib. - # Allow earlier configure scripts to handle libc_cv_slibdir, libdir, - # and libc_cv_localedir. - test -n "$libc_cv_slibdir" || \ - case $machine in - riscv/rv32* ) - libc_cv_slibdir="/lib32" - if test "$libdir" = '${exec_prefix}/lib'; then - libdir='${exec_prefix}/lib32'; - # Locale data can be shared between 32bit and 64bit libraries - libc_cv_localedir='${exec_prefix}/lib/locale' - fi - ;; - *) - libc_cv_slibdir="/lib" - ;; - esac -esac - -if test -z "$arch_minimum_kernel"; then - arch_minimum_kernel=2.4.1 - libc_cv_gcc_unwind_find_fde=no -fi diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/configure.in b/glibc/sysdeps/unix/sysv/linux/riscv/configure.in deleted file mode 100644 index 87d0cd3..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/configure.in +++ /dev/null @@ -1,29 +0,0 @@ -sinclude(./aclocal.m4)dnl Autoconf lossage -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/unix/sysv/linux/riscv. - -case "$prefix" in -/usr | /usr/) - # 32-bit libraries on bi-arch platforms go in /lib32 instead of /lib. - # Allow earlier configure scripts to handle libc_cv_slibdir, libdir, - # and libc_cv_localedir. - test -n "$libc_cv_slibdir" || \ - case $machine in - riscv/rv32* ) - libc_cv_slibdir="/lib32" - if test "$libdir" = '${exec_prefix}/lib'; then - libdir='${exec_prefix}/lib32'; - # Locale data can be shared between 32bit and 64bit libraries - libc_cv_localedir='${exec_prefix}/lib/locale' - fi - ;; - *) - libc_cv_slibdir="/lib" - ;; - esac -esac - -if test -z "$arch_minimum_kernel"; then - arch_minimum_kernel=2.4.1 - libc_cv_gcc_unwind_find_fde=no -fi diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/dl-cache.h b/glibc/sysdeps/unix/sysv/linux/riscv/dl-cache.h deleted file mode 100644 index 8ef4822..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/dl-cache.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Support for reading /etc/ld.so.cache files written by Linux ldconfig. - Copyright (C) 2003, 2007 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <ldconfig.h> - -#define add_system_dir(dir) \ - do \ - { \ - size_t len = strlen (dir); \ - char path[len + 3]; \ - memcpy (path, dir, len + 1); \ - if (len >= 6 \ - && (! memcmp (path + len - 6, "/lib64", 6) \ - || ! memcmp (path + len - 6, "/lib32", 6))) \ - { \ - len -= 2; \ - path[len] = '\0'; \ - } \ - add_dir (path); \ - if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4)) \ - { \ - memcpy (path + len, "32", 3); \ - add_dir (path); \ - memcpy (path + len, "64", 3); \ - add_dir (path); \ - } \ - } while (0) - -#include_next <dl-cache.h> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/dl-static.c b/glibc/sysdeps/unix/sysv/linux/riscv/dl-static.c deleted file mode 100644 index 273552c..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/dl-static.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Variable initialization. MIPS version. - Copyright (C) 2001, 2002, 2003, 2005 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <ldsodefs.h> - -#ifdef SHARED - -void -_dl_var_init (void *array[]) -{ - /* It has to match "variables" below. */ - enum - { - DL_PAGESIZE = 0 - }; - - GLRO(dl_pagesize) = *((size_t *) array[DL_PAGESIZE]); -} - -#else - -static void *variables[] = -{ - &GLRO(dl_pagesize) -}; - -static void -_dl_unprotect_relro (struct link_map *l) -{ - ElfW(Addr) start = ((l->l_addr + l->l_relro_addr) - & ~(GLRO(dl_pagesize) - 1)); - ElfW(Addr) end = ((l->l_addr + l->l_relro_addr + l->l_relro_size) - & ~(GLRO(dl_pagesize) - 1)); - - if (start != end) - __mprotect ((void *) start, end - start, PROT_READ | PROT_WRITE); -} - -void -_dl_static_init (struct link_map *l) -{ - struct link_map *rtld_map = l; - struct r_scope_elem **scope; - const ElfW(Sym) *ref = NULL; - lookup_t loadbase; - void (*f) (void *[]); - size_t i; - - loadbase = _dl_lookup_symbol_x ("_dl_var_init", l, &ref, l->l_local_scope, - NULL, 0, 1, NULL); - - for (scope = l->l_local_scope; *scope != NULL; scope++) - for (i = 0; i < (*scope)->r_nlist; i++) - if ((*scope)->r_list[i] == loadbase) - { - rtld_map = (*scope)->r_list[i]; - break; - } - - if (ref != NULL) - { - f = (void (*) (void *[])) DL_SYMBOL_ADDRESS (loadbase, ref); - _dl_unprotect_relro (rtld_map); - f (variables); - _dl_protect_relro (rtld_map); - } -} - -#endif diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/getcontext.S b/glibc/sysdeps/unix/sysv/linux/riscv/getcontext.S deleted file mode 100644 index 9598ea2..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/getcontext.S +++ /dev/null @@ -1,82 +0,0 @@ -/* Save current context. - Copyright (C) 2009 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maciej W. Rozycki <macro@codesourcery.com>. - - 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, write to the Free - Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA - 02110-1301, USA. */ - -#include <sysdep.h> -#include <sys/asm.h> - -#include "ucontext_i.h" - -/* int getcontext (ucontext_t *ucp) */ - - .text -LEAF (__getcontext) - REG_S ra, MCONTEXT_PC(a0) - REG_S ra, ( 1 * SZREG + MCONTEXT_GREGS)(a0) - REG_S sp, ( 2 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s0, ( 8 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s1, ( 9 * SZREG + MCONTEXT_GREGS)(a0) - REG_S x0, (10 * SZREG + MCONTEXT_GREGS)(a0) /* return 0 */ - REG_S s2, (18 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s3, (19 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s4, (20 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s5, (21 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s6, (22 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s7, (23 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s8, (24 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s9, (25 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s10,(26 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s11,(27 * SZREG + MCONTEXT_GREGS)(a0) - -#ifdef __riscv_hard_float - frsr a1 - - fsd fs0, ( 8 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs1, ( 9 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs2, (18 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs3, (19 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs4, (20 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs5, (21 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs6, (22 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs7, (23 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs8, (24 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs9, (25 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs10,(26 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs11,(27 * 8 + MCONTEXT_FPREGS)(a0) - - sw a1, MCONTEXT_FSR(a0) -#endif /* __mips_hard_float */ - -/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */ - li a3, _NSIG8 - add a2, a0, UCONTEXT_SIGMASK - move a1, zero - li a0, SIG_BLOCK - - li a7, SYS_ify (rt_sigprocmask) - scall - bltz a0, 99f - - ret - -99: j __syscall_error - -PSEUDO_END (__getcontext) - -weak_alias (__getcontext, getcontext) diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/getmsg.c b/glibc/sysdeps/unix/sysv/linux/riscv/getmsg.c deleted file mode 100644 index 3a1fa08..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/getmsg.c +++ /dev/null @@ -1 +0,0 @@ -#include <sysdeps/unix/sysv/linux/i386/getmsg.c> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h b/glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h deleted file mode 100644 index c3e5a50..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#define __ASSUME_ACCEPT4_SYSCALL 1 -#define __ASSUME_RECVMMSG_SYSCALL 1 -#define __ASSUME_SENDMMSG_SYSCALL 1 - -#include_next <kernel-features.h> - -/* Define this if your 32-bit syscall API requires 64-bit register - pairs to start with an even-number register. */ -#define __ASSUME_ALIGNED_REGISTER_PAIRS 1 diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/ldsodefs.h b/glibc/sysdeps/unix/sysv/linux/riscv/ldsodefs.h deleted file mode 100644 index 8d5efec..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/ldsodefs.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Run-time dynamic linker data structures for loaded ELF shared objects. MIPS. - Copyright (C) 2001, 2003 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _LDSODEFS_H - -/* Get the real definitions. */ -#include_next <ldsodefs.h> - -/* Now define our stuff. */ - -/* We need special support to initialize DSO loaded for statically linked - binaries. */ -extern void _dl_static_init (struct link_map *map); -#undef DL_STATIC_INIT -#define DL_STATIC_INIT(map) _dl_static_init (map) - -#endif /* ldsodefs.h */ diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/libc-abis b/glibc/sysdeps/unix/sysv/linux/riscv/libc-abis deleted file mode 100644 index f180a03..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/libc-abis +++ /dev/null @@ -1,13 +0,0 @@ -# See the copy of this file in libc for detailed explanations. This -# copy needs to include all libc definitions applicable to MIPS; only -# one copy will be used. -# -# Feature Name Configuration -# ------------ ------------- -# -# MIPS PLTs. -MIPS_PLT mips*-*-linux* -# -# Unique symbol definitions for C++. -# Architecture independent, all ELF targets (== all targets) -UNIQUE diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/makecontext.c b/glibc/sysdeps/unix/sysv/linux/riscv/makecontext.c deleted file mode 100644 index a3836ce..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/makecontext.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <sysdep.h> -#include <sys/asm.h> -#include <sys/ucontext.h> -#include <stdarg.h> -#include <assert.h> - -void __makecontext (ucontext_t *ucp, void (*func) (void), int argc, - long a0, long a1, long a2, long a3, long a4, ...) -{ - extern void __start_context(void) attribute_hidden; - long i, sp; - - assert(REG_NARGS == 8); - - /* Set up the stack. */ - sp = ((long)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & ALMASK; - - /* Set up the register context. - ra = s0 = 0, terminating the stack for backtracing purposes. - s1 = the function we must call. - s2 = the subsequent context to run. */ - ucp->uc_mcontext.gregs[REG_RA] = 0; - ucp->uc_mcontext.gregs[REG_S0 + 0] = 0; - ucp->uc_mcontext.gregs[REG_S0 + 1] = (long)func; - ucp->uc_mcontext.gregs[REG_S0 + 2] = (long)ucp->uc_link; - ucp->uc_mcontext.gregs[REG_SP] = sp; - ucp->uc_mcontext.gregs[REG_PC] = (long)&__start_context; - - /* Put args in a0-a7, then put any remaining args on the stack. */ - ucp->uc_mcontext.gregs[REG_A0 + 0] = a0; - ucp->uc_mcontext.gregs[REG_A0 + 1] = a1; - ucp->uc_mcontext.gregs[REG_A0 + 2] = a2; - ucp->uc_mcontext.gregs[REG_A0 + 3] = a3; - ucp->uc_mcontext.gregs[REG_A0 + 4] = a4; - - if (__builtin_expect (argc > 5, 0)) - { - va_list vl; - va_start(vl, a4); - - long reg_args = argc < REG_NARGS ? argc : REG_NARGS; - sp = (sp - (argc - reg_args) * sizeof(long)) & ALMASK; - for (i = 5; i < reg_args; i++) - ucp->uc_mcontext.gregs[REG_A0 + i] = va_arg(vl, long); - for (i = 0; i < argc - reg_args; i++) - ((long*)sp)[i] = va_arg(vl, long); - - va_end(vl); - } -} - -weak_alias (__makecontext, makecontext) diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/profil-counter.h b/glibc/sysdeps/unix/sysv/linux/riscv/profil-counter.h deleted file mode 100644 index 8a6a0bc..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/profil-counter.h +++ /dev/null @@ -1,2 +0,0 @@ -/* We can use the ix86 version. */ -#include <sysdeps/unix/sysv/linux/i386/profil-counter.h> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/putmsg.c b/glibc/sysdeps/unix/sysv/linux/riscv/putmsg.c deleted file mode 100644 index ebc1680..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/putmsg.c +++ /dev/null @@ -1 +0,0 @@ -#include <sysdeps/unix/sysv/linux/i386/putmsg.c> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/register-dump.h b/glibc/sysdeps/unix/sysv/linux/riscv/register-dump.h deleted file mode 100644 index b81740c..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/register-dump.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Dump registers. - Copyright (C) 2000, 2001, 2002, 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 2000. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <unistd.h> -#include <string.h> -#include <_itoa.h> - -static void -hexvalue (unsigned long int value, char *buf, size_t len) -{ - char *cp = _itoa_word (value, buf + len, 16, 0); - while (cp > buf) - *--cp = '0'; -} - -#define REGDUMP_NREGS 32 -#define REGDUMP_PER_LINE (80 / (__WORDSIZE/4 + 4)) - -static void -register_dump (int fd, struct ucontext *ctx) -{ - int i; - char regvalue[__WORDSIZE/4 + 1]; - char str[82 * ((REGDUMP_NREGS + REGDUMP_PER_LINE - 1) / REGDUMP_PER_LINE)]; - - static const char names[REGDUMP_NREGS][4] = { - "pc", "ra", "sp", "gp", "tp", "t0", "t1", "t2", - "s0", "s1", "a0", "a1", "a2", "a3", "a4", "a5", - "a6", "a7", "s2", "s3", "s4", "s5", "s6", "s7", - "s8", "s9", "sA", "sB", "t3", "t4", "t5", "t6" - }; - - str[0] = 0; - for (i = 0; i < REGDUMP_NREGS; i++) - { - strcat (str, names[i]); - strcat (str, " "); - hexvalue (ctx->uc_mcontext.gregs[i], regvalue, __WORDSIZE/4); - strcat (str, regvalue); - - if ((i + 1) % REGDUMP_PER_LINE == 0) - strcat (str, "\n"); - } - - write (fd, str, strlen (str)); -} - -#define REGISTER_DUMP register_dump (fd, ctx) diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/rv32/Implies b/glibc/sysdeps/unix/sysv/linux/riscv/rv32/Implies deleted file mode 100644 index 8b7deb3..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/rv32/Implies +++ /dev/null @@ -1,3 +0,0 @@ -unix/sysv/linux/riscv -unix/sysv/linux/generic/wordsize-32 -unix/sysv/linux/generic diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/rv32/lockf64.c b/glibc/sysdeps/unix/sysv/linux/riscv/rv32/lockf64.c deleted file mode 100644 index a88f5a7..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/rv32/lockf64.c +++ /dev/null @@ -1 +0,0 @@ -#include <sysdeps/unix/sysv/linux/i386/lockf64.c> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/rv32/readahead.c b/glibc/sysdeps/unix/sysv/linux/riscv/rv32/readahead.c deleted file mode 100644 index 80170c3..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/rv32/readahead.c +++ /dev/null @@ -1 +0,0 @@ -#include <sysdeps/unix/sysv/linux/arm/readahead.c> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/rv32/sync_file_range.c b/glibc/sysdeps/unix/sysv/linux/riscv/rv32/sync_file_range.c deleted file mode 100644 index 4213dce..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/rv32/sync_file_range.c +++ /dev/null @@ -1 +0,0 @@ -#include <sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/rv64/Implies b/glibc/sysdeps/unix/sysv/linux/riscv/rv64/Implies deleted file mode 100644 index f042343..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/rv64/Implies +++ /dev/null @@ -1,3 +0,0 @@ -unix/sysv/linux/riscv -unix/sysv/linux/generic -unix/sysv/linux/wordsize-64 diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/rv64/Makefile b/glibc/sysdeps/unix/sysv/linux/riscv/rv64/Makefile deleted file mode 100644 index 0a37c5b..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/rv64/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -ifeq ($(subdir),socket) -CFLAGS-recv.c += -fexceptions -CFLAGS-send.c += -fexceptions -endif - -ifeq ($(subdir),nptl) -CFLAGS-recv.c += -fexceptions -CFLAGS-send.c += -fexceptions -endif diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/rv64/ldconfig.h b/glibc/sysdeps/unix/sysv/linux/riscv/rv64/ldconfig.h deleted file mode 100644 index 43fca83..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/rv64/ldconfig.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 2001, 2002, 2003 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <sysdeps/generic/ldconfig.h> - -#define SYSDEP_KNOWN_INTERPRETER_NAMES \ - { "/lib32/ld.so.1", FLAG_ELF_LIBC6 }, \ - { "/lib/ld.so.1", FLAG_ELF_LIBC6 }, -#define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/rv64/ldd-rewrite.sed b/glibc/sysdeps/unix/sysv/linux/riscv/rv64/ldd-rewrite.sed deleted file mode 100644 index 2c32732..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/rv64/ldd-rewrite.sed +++ /dev/null @@ -1 +0,0 @@ -s_^\(RTLDLIST=\)\(.*lib\)\(\|32\|64\)\(/[^/]*\.so\.[0-9.]*\)[ ]*$_\1"\232\4 \264\4 \2\4"_ diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/setcontext.S b/glibc/sysdeps/unix/sysv/linux/riscv/setcontext.S deleted file mode 100644 index 9748812..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/setcontext.S +++ /dev/null @@ -1,126 +0,0 @@ -/* Set current context. - Copyright (C) 2009 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maciej W. Rozycki <macro@codesourcery.com>. - - 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, write to the Free - Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA - 02110-1301, USA. */ - -#include <sysdep.h> -#include <sys/asm.h> - -#include "ucontext_i.h" - -#define RESTORE_FP_REG(name, num, base) \ - fld name, ((num) * 8 + MCONTEXT_FPREGS)(base) - -#define RESTORE_FP_REG_CFI(name, num, base) \ - RESTORE_FP_REG (name, num, base); \ - cfi_offset (name, (num) * SZREG + MCONTEXT_GREGS) - -#define RESTORE_INT_REG(name, num, base) \ - REG_L name, ((num) * SZREG + MCONTEXT_GREGS)(base) - -#define RESTORE_INT_REG_CFI(name, num, base) \ - RESTORE_INT_REG (name, num, base); \ - cfi_offset (name, (num) * SZREG + MCONTEXT_GREGS) - -/* int setcontext (const ucontext_t *ucp) */ - - .text -LEAF (__setcontext) - - mv t0, a0 /* t0 <- ucp */ - -/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */ - li a3, _NSIG8 - move a2, zero - add a1, a0, UCONTEXT_SIGMASK - li a0, SIG_SETMASK - - li a7, SYS_ify (rt_sigprocmask) - scall - - bltz a0, 99f - - cfi_def_cfa (t0, 0) - -#ifdef __riscv_hard_float - lw t1, MCONTEXT_FSR(t0) - - RESTORE_FP_REG_CFI (fs0, 8, t0) - RESTORE_FP_REG_CFI (fs1, 9, t0) - RESTORE_FP_REG_CFI (fs2, 18, t0) - RESTORE_FP_REG_CFI (fs3, 19, t0) - RESTORE_FP_REG_CFI (fs4, 20, t0) - RESTORE_FP_REG_CFI (fs5, 21, t0) - RESTORE_FP_REG_CFI (fs6, 22, t0) - RESTORE_FP_REG_CFI (fs7, 23, t0) - RESTORE_FP_REG_CFI (fs8, 24, t0) - RESTORE_FP_REG_CFI (fs9, 25, t0) - RESTORE_FP_REG_CFI (fs10, 26, t0) - RESTORE_FP_REG_CFI (fs11, 27, t0) - - fssr t1 -#endif /* __riscv_hard_float */ - - /* Note the contents of argument registers will be random - unless makecontext() has been called. */ - REG_L t1, MCONTEXT_PC(t0) - RESTORE_INT_REG_CFI (ra, 1, t0) - RESTORE_INT_REG (sp, 2, t0) - RESTORE_INT_REG_CFI (s0, 8, t0) - RESTORE_INT_REG_CFI (s1, 9, t0) - RESTORE_INT_REG (a0, 10, t0) - RESTORE_INT_REG (a1, 11, t0) - RESTORE_INT_REG (a2, 12, t0) - RESTORE_INT_REG (a3, 13, t0) - RESTORE_INT_REG (a4, 14, t0) - RESTORE_INT_REG (a5, 15, t0) - RESTORE_INT_REG (a6, 16, t0) - RESTORE_INT_REG (a7, 17, t0) - RESTORE_INT_REG_CFI (s2, 18, t0) - RESTORE_INT_REG_CFI (s3, 19, t0) - RESTORE_INT_REG_CFI (s4, 20, t0) - RESTORE_INT_REG_CFI (s5, 21, t0) - RESTORE_INT_REG_CFI (s6, 22, t0) - RESTORE_INT_REG_CFI (s7, 23, t0) - RESTORE_INT_REG_CFI (s8, 24, t0) - RESTORE_INT_REG_CFI (s9, 25, t0) - RESTORE_INT_REG_CFI (s10, 26, t0) - RESTORE_INT_REG_CFI (s11, 27, t0) - - jr t1 - -99: j __syscall_error - -PSEUDO_END (__setcontext) -weak_alias (__setcontext, setcontext) - -LEAF (__start_context) - - /* Terminate call stack by noting ra == 0. Happily, s0 == 0 here. */ - cfi_register (ra, s0) - - /* Call the function passed to makecontext. */ - jalr s1 - - /* Invoke subsequent context if present, else exit(0). */ - mv a0, s2 - beqz s2, 1f - jal __setcontext -1: j exit - -PSEUDO_END (__start_context) diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/shlib-versions b/glibc/sysdeps/unix/sysv/linux/riscv/shlib-versions deleted file mode 100644 index 7e837a2..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/shlib-versions +++ /dev/null @@ -1 +0,0 @@ -DEFAULT GLIBC_2.20 diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h b/glibc/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h deleted file mode 100644 index ea01f8e..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andreas Jaeger <aj@suse.de>, 2000. - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <sys/ucontext.h> - -#define SIGCONTEXT siginfo_t *_si, struct ucontext * -#define SIGCONTEXT_EXTRA_ARGS _si, -#define GET_PC(ctx) ((void *) ctx->uc_mcontext.gregs[REG_PC]) -#define GET_FRAME(ctx) ((void *) ctx->uc_mcontext.gregs[REG_S0]) -#define GET_STACK(ctx) ((void *) ctx->uc_mcontext.gregs[REG_SP]) - -#define CALL_SIGHANDLER(handler, signo, ctx) \ - (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/swapcontext.S b/glibc/sysdeps/unix/sysv/linux/riscv/swapcontext.S deleted file mode 100644 index c09ad21..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/swapcontext.S +++ /dev/null @@ -1,130 +0,0 @@ -/* Save and set current context. - Copyright (C) 2009 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maciej W. Rozycki <macro@codesourcery.com>. - - 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, write to the Free - Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA - 02110-1301, USA. */ - -#include <sysdep.h> -#include <sys/asm.h> - -#include "ucontext_i.h" - -/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */ - -LEAF (__swapcontext) - mv t0, a1 /* t0 <- ucp */ - - REG_S ra, MCONTEXT_PC(a0) - REG_S ra, ( 1 * SZREG + MCONTEXT_GREGS)(a0) - REG_S sp, ( 2 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s0, ( 8 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s1, ( 9 * SZREG + MCONTEXT_GREGS)(a0) - REG_S x0, (10 * SZREG + MCONTEXT_GREGS)(a0) /* return 0 */ - REG_S s2, (18 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s3, (19 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s4, (20 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s5, (21 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s6, (22 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s7, (23 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s8, (24 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s9, (25 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s10,(26 * SZREG + MCONTEXT_GREGS)(a0) - REG_S s11,(27 * SZREG + MCONTEXT_GREGS)(a0) - -#ifdef __riscv_hard_float - frsr a1 - - fsd fs0, ( 8 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs1, ( 9 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs2, (18 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs3, (19 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs4, (20 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs5, (21 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs6, (22 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs7, (23 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs8, (24 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs9, (25 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs10,(26 * 8 + MCONTEXT_FPREGS)(a0) - fsd fs11,(27 * 8 + MCONTEXT_FPREGS)(a0) - - sw a1, MCONTEXT_FSR(a0) -#endif /* __riscv_hard_float */ - -/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */ - li a3, _NSIG8 - move a2, zero - add a1, a0, UCONTEXT_SIGMASK - li a0, SIG_SETMASK - - li a7, SYS_ify (rt_sigprocmask) - scall - - bltz a0, 99f - -#ifdef __riscv_hard_float - lw t1, MCONTEXT_FSR(t0) - - fld fs0, ( 8 * 8 + MCONTEXT_FPREGS)(t0) - fld fs1, ( 9 * 8 + MCONTEXT_FPREGS)(t0) - fld fs2, (18 * 8 + MCONTEXT_FPREGS)(t0) - fld fs3, (19 * 8 + MCONTEXT_FPREGS)(t0) - fld fs4, (20 * 8 + MCONTEXT_FPREGS)(t0) - fld fs5, (21 * 8 + MCONTEXT_FPREGS)(t0) - fld fs6, (22 * 8 + MCONTEXT_FPREGS)(t0) - fld fs7, (23 * 8 + MCONTEXT_FPREGS)(t0) - fld fs8, (24 * 8 + MCONTEXT_FPREGS)(t0) - fld fs9, (25 * 8 + MCONTEXT_FPREGS)(t0) - fld fs10,(26 * 8 + MCONTEXT_FPREGS)(t0) - fld fs11,(27 * 8 + MCONTEXT_FPREGS)(t0) - - fssr t1 -#endif /* __riscv_hard_float */ - - /* Note the contents of argument registers will be random - unless makecontext() has been called. */ - REG_L t1, MCONTEXT_PC(t0) - REG_L ra, ( 1 * SZREG + MCONTEXT_GREGS)(t0) - REG_L sp, ( 2 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s0, ( 8 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s1, ( 9 * SZREG + MCONTEXT_GREGS)(t0) - REG_L a0, (10 * SZREG + MCONTEXT_GREGS)(t0) - REG_L a1, (11 * SZREG + MCONTEXT_GREGS)(t0) - REG_L a2, (12 * SZREG + MCONTEXT_GREGS)(t0) - REG_L a3, (13 * SZREG + MCONTEXT_GREGS)(t0) - REG_L a4, (14 * SZREG + MCONTEXT_GREGS)(t0) - REG_L a5, (15 * SZREG + MCONTEXT_GREGS)(t0) - REG_L a6, (16 * SZREG + MCONTEXT_GREGS)(t0) - REG_L a7, (17 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s2, (18 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s3, (19 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s4, (20 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s5, (21 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s6, (22 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s7, (23 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s8, (24 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s9, (25 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s10,(26 * SZREG + MCONTEXT_GREGS)(t0) - REG_L s11,(27 * SZREG + MCONTEXT_GREGS)(t0) - - jr t1 - - -99: j __syscall_error - -PSEUDO_END (__swapcontext) - -weak_alias (__swapcontext, swapcontext) diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/sys/procfs.h b/glibc/sysdeps/unix/sysv/linux/riscv/sys/procfs.h deleted file mode 100644 index c68d112..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/sys/procfs.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SYS_PROCFS_H -#define _SYS_PROCFS_H 1 - -/* This is somehow modelled after the file of the same name on SysVr4 - systems. It provides a definition of the core file format for ELF - used on Linux. */ - -#include <features.h> -#include <sys/time.h> -#include <sys/types.h> -#include <sys/user.h> -#include <sys/ucontext.h> - -/* ELF register definitions */ -#define ELF_NGREG NGREG -#define ELF_NFPREG NFPREG - -typedef greg_t elf_greg_t; -typedef gregset_t elf_gregset_t; -typedef fpreg_t elf_fpreg_t; -typedef fpregset_t elf_fpregset_t; - -__BEGIN_DECLS - -struct elf_siginfo - { - int si_signo; /* Signal number. */ - int si_code; /* Extra code. */ - int si_errno; /* Errno. */ - }; - - -/* Definitions to generate Intel SVR4-like core files. These mostly - have the same names as the SVR4 types with "elf_" tacked on the - front to prevent clashes with linux definitions, and the typedef - forms have been avoided. This is mostly like the SVR4 structure, - but more Linuxy, with things that Linux does not support and which - gdb doesn't really use excluded. Fields present but not used are - marked with "XXX". */ -struct elf_prstatus - { - struct elf_siginfo pr_info; /* Info associated with signal. */ - short int pr_cursig; /* Current signal. */ - unsigned long int pr_sigpend; /* Set of pending signals. */ - unsigned long int pr_sighold; /* Set of held signals. */ - __pid_t pr_pid; - __pid_t pr_ppid; - __pid_t pr_pgrp; - __pid_t pr_sid; - struct timeval pr_utime; /* User time. */ - struct timeval pr_stime; /* System time. */ - struct timeval pr_cutime; /* Cumulative user time. */ - struct timeval pr_cstime; /* Cumulative system time. */ - elf_gregset_t pr_reg; /* GP registers. */ - int pr_fpvalid; /* True if math copro being used. */ - }; - - -#define ELF_PRARGSZ (80) /* Number of chars for args */ - -struct elf_prpsinfo - { - char pr_state; /* Numeric process state. */ - char pr_sname; /* Char for pr_state. */ - char pr_zomb; /* Zombie. */ - char pr_nice; /* Nice val. */ - unsigned long int pr_flag; /* Flags. */ - long pr_uid; - long pr_gid; - int pr_pid, pr_ppid, pr_pgrp, pr_sid; - /* Lots missing */ - char pr_fname[16]; /* Filename of executable. */ - char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ - }; - - -/* Addresses. */ -typedef void *psaddr_t; - -/* Register sets. Linux has different names. */ -typedef elf_gregset_t prgregset_t; -typedef elf_fpregset_t prfpregset_t; - -/* We don't have any differences between processes and threads, - therefore habe only ine PID type. */ -typedef __pid_t lwpid_t; - - -typedef struct elf_prstatus prstatus_t; -typedef struct elf_prpsinfo prpsinfo_t; - -__END_DECLS - -#endif /* sys/procfs.h */ diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/glibc/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h deleted file mode 100644 index 3dd9bd7..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 1997, 1998, 2000, 2003, 2004, 2006, 2009 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* 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 <features.h> -#include <signal.h> - -/* We need the signal context definitions even if they are not used - included in <signal.h>. */ -#include <bits/sigcontext.h> - -/* Type for general register. Even in o32 we assume 64-bit registers, - like the kernel. */ -__extension__ typedef unsigned long long int greg_t; -typedef double fpreg_t; - -/* Number of general registers. */ -#define NGREG 32 -#define NFPREG 32 - -#define REG_PC 0 -#define REG_RA 1 -#define REG_SP 2 -#define REG_TP 4 -#define REG_S0 8 -#define REG_A0 10 -#define REG_NARGS 8 - -/* Container for all general registers. */ -typedef greg_t gregset_t[NGREG]; - -/* Container for all FPU registers. */ -typedef fpreg_t fpregset_t[NFPREG]; - -/* Context to describe whole processor state. */ -typedef struct sigcontext mcontext_t; - -/* Userlevel context. */ -typedef struct ucontext - { - unsigned long int uc_flags; - struct ucontext *uc_link; - stack_t uc_stack; - mcontext_t uc_mcontext; - __sigset_t uc_sigmask; - } ucontext_t; - -#endif /* sys/ucontext.h */ diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/sys/user.h b/glibc/sysdeps/unix/sysv/linux/riscv/sys/user.h deleted file mode 100644 index faf3079..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/sys/user.h +++ /dev/null @@ -1,2 +0,0 @@ -/* x86 puts "struct user_regs_struct" in here, this is just a shim. */ -#include <asm/ptrace.h> diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/syscall.c b/glibc/sysdeps/unix/sysv/linux/riscv/syscall.c deleted file mode 100644 index 2ebd7ee..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/syscall.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2001, 2002, 2003, 2005 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <sysdep.h> - -long syscall (long syscall_number, long arg1, long arg2, long arg3, - long arg4, long arg5, long arg6, long arg7) -{ - long ret; - INTERNAL_SYSCALL_DECL (err); - - ret = INTERNAL_SYSCALL_NCS(syscall_number, err, 7, arg1, arg2, arg3, arg4, - arg5, arg6, arg7); - - if (INTERNAL_SYSCALL_ERROR_P (ret, err)) - { - extern long __syscall_error (void) attribute_hidden; - return __syscall_error(); - } - - return ret; -} diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.c b/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.c deleted file mode 100644 index 85829d9..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2015 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Andrew Waterman (waterman@cs.berkeley.edu). - - 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <sysdep.h> -#include <errno.h> - -long __syscall_error(long a0) -{ - /* We got here because a0 < 0, but only codes in the range [-4095, -1] - represent errors. Otherwise, just return the result normally. */ - if (a0 <= -4096) - return a0; - - errno = -a0; - return -1; -} diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h b/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h deleted file mode 100644 index 40de621..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ /dev/null @@ -1,260 +0,0 @@ -/* Copyright (C) 2011-2014 - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _LINUX_RISCV_SYSDEP_H -#define _LINUX_RISCV_SYSDEP_H 1 - -#include <sysdeps/unix/sysv/linux/generic/sysdep.h> -#include <tls.h> - -#ifdef __ASSEMBLER__ - -#include <sys/asm.h> - -#define ENTRY(name) LEAF(name) - -#undef PSEUDO_END -#define PSEUDO_END(sym) END(sym) - -#define PSEUDO_NOERRNO(name, syscall_name, args) \ - .align 2; \ - ENTRY(name) \ - li a7, SYS_ify(syscall_name); \ - scall - -#define ret_NOERRNO ret - -#define PSEUDO_ERRVAL(name, syscall_name, args) \ - PSEUDO_NOERRNO(name, syscall_name, args) - -#define ret_ERRVAL ret - -#define r0 a0 -#define r1 a1 -#define MOVE(x,y) move y , x - -#define L(label) .L ## label - -#define PSEUDO(name, syscall_name, args) \ - .align 2; \ - 99: j __syscall_error; \ - ENTRY(name) \ - li a7, SYS_ify(syscall_name); \ - scall; \ - bltz a0, 99b; \ -L(syse1): - -#endif /* __ASSEMBLER__ */ - -#include <sysdeps/unix/sysdep.h> - -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name - -#ifndef __ASSEMBLER__ - -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL(err); \ - long result_var = INTERNAL_SYSCALL (name, err, nr, args); \ - if (result_var < 0) \ - { \ - /* __syscall_error handles result_var <= -4096 corner case */ \ - extern long __syscall_error (long) attribute_hidden; \ - result_var = __syscall_error (result_var); \ - } \ - result_var; }) - -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((unsigned long) (val) > -4096UL) - -#define INTERNAL_SYSCALL_ERRNO(val, err) (-val) - -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - internal_syscall##nr (SYS_ify (name), err, args) - -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - internal_syscall##nr (number, err, args) - -#define internal_syscall0(number, err, dummy...) \ -({ \ - long _sys_result; \ - \ - { \ - register long __a7 asm("a7") = number; \ - register long __a0 asm("a0"); \ - __asm__ volatile ( \ - "scall\n\t" \ - : "=r" (__a0) \ - : "r" (__a7) \ - : __SYSCALL_CLOBBERS); \ - _sys_result = __a0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall1(number, err, arg0) \ -({ \ - long _sys_result; \ - \ - { \ - register long __a7 asm("a7") = number; \ - register long __a0 asm("a0") = (long) (arg0); \ - __asm__ volatile ( \ - "scall\n\t" \ - : "+r" (__a0) \ - : "r" (__a7) \ - : __SYSCALL_CLOBBERS); \ - _sys_result = __a0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall2(number, err, arg0, arg1) \ -({ \ - long _sys_result; \ - \ - { \ - register long __a7 asm("a7") = number; \ - register long __a0 asm("a0") = (long) (arg0); \ - register long __a1 asm("a1") = (long) (arg1); \ - __asm__ volatile ( \ - "scall\n\t" \ - : "+r" (__a0) \ - : "r" (__a7), "r"(__a1) \ - : __SYSCALL_CLOBBERS); \ - _sys_result = __a0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall3(number, err, arg0, arg1, arg2) \ -({ \ - long _sys_result; \ - \ - { \ - register long __a7 asm("a7") = number; \ - register long __a0 asm("a0") = (long) (arg0); \ - register long __a1 asm("a1") = (long) (arg1); \ - register long __a2 asm("a2") = (long) (arg2); \ - __asm__ volatile ( \ - "scall\n\t" \ - : "+r" (__a0) \ - : "r" (__a7), "r"(__a1), "r"(__a2) \ - : __SYSCALL_CLOBBERS); \ - _sys_result = __a0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall4(number, err, arg0, arg1, arg2, arg3) \ -({ \ - long _sys_result; \ - \ - { \ - register long __a7 asm("a7") = number; \ - register long __a0 asm("a0") = (long) (arg0); \ - register long __a1 asm("a1") = (long) (arg1); \ - register long __a2 asm("a2") = (long) (arg2); \ - register long __a3 asm("a3") = (long) (arg3); \ - __asm__ volatile ( \ - "scall\n\t" \ - : "+r" (__a0) \ - : "r" (__a7), "r"(__a1), "r"(__a2), "r"(__a3) \ - : __SYSCALL_CLOBBERS); \ - _sys_result = __a0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall5(number, err, arg0, arg1, arg2, arg3, arg4) \ -({ \ - long _sys_result; \ - \ - { \ - register long __a7 asm("a7") = number; \ - register long __a0 asm("a0") = (long) (arg0); \ - register long __a1 asm("a1") = (long) (arg1); \ - register long __a2 asm("a2") = (long) (arg2); \ - register long __a3 asm("a3") = (long) (arg3); \ - register long __a4 asm("a4") = (long) (arg4); \ - __asm__ volatile ( \ - "scall\n\t" \ - : "+r" (__a0) \ - : "r" (__a7), "r"(__a1), "r"(__a2), "r"(__a3), "r"(__a4) \ - : __SYSCALL_CLOBBERS); \ - _sys_result = __a0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall6(number, err, arg0, arg1, arg2, arg3, arg4, arg5) \ -({ \ - long _sys_result; \ - \ - { \ - register long __a7 asm("a7") = number; \ - register long __a0 asm("a0") = (long) (arg0); \ - register long __a1 asm("a1") = (long) (arg1); \ - register long __a2 asm("a2") = (long) (arg2); \ - register long __a3 asm("a3") = (long) (arg3); \ - register long __a4 asm("a4") = (long) (arg4); \ - register long __a5 asm("a5") = (long) (arg5); \ - __asm__ volatile ( \ - "scall\n\t" \ - : "+r" (__a0) \ - : "r" (__a7), "r"(__a1), "r"(__a2), "r"(__a3), "r"(__a4), "r"(__a5) \ - : __SYSCALL_CLOBBERS); \ - _sys_result = __a0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall7(number, err, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \ -({ \ - long _sys_result; \ - \ - { \ - register long __a7 asm("a7") = number; \ - register long __a0 asm("a0") = (long) (arg0); \ - register long __a1 asm("a1") = (long) (arg1); \ - register long __a2 asm("a2") = (long) (arg2); \ - register long __a3 asm("a3") = (long) (arg3); \ - register long __a4 asm("a4") = (long) (arg4); \ - register long __a5 asm("a5") = (long) (arg5); \ - register long __a6 asm("a6") = (long) (arg6); \ - __asm__ volatile ( \ - "scall\n\t" \ - : "+r" (__a0) \ - : "r" (__a7), "r"(__a1), "r"(__a2), "r"(__a3), "r"(__a4), "r"(__a5), "r"(__a6) \ - : __SYSCALL_CLOBBERS); \ - _sys_result = __a0; \ - } \ - _sys_result; \ -}) - -#define __SYSCALL_CLOBBERS "memory" -#endif /* ! __ASSEMBLER__ */ - -/* Pointer mangling is not supported. */ -#define PTR_MANGLE(var) (void) (var) -#define PTR_DEMANGLE(var) (void) (var) - -#endif /* linux/mips/sysdep.h */ diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym b/glibc/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym deleted file mode 100644 index 67f50d4..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym +++ /dev/null @@ -1,33 +0,0 @@ -#include <inttypes.h> -#include <signal.h> -#include <stddef.h> -#include <sys/ucontext.h> - --- Constants used by the rt_sigprocmask call. - -SIG_BLOCK -SIG_SETMASK - -_NSIG8 (_NSIG / 8) - --- Offsets of the fields in the ucontext_t structure. -#define ucontext(member) offsetof (ucontext_t, member) -#define stack(member) ucontext (uc_stack.member) -#define mcontext(member) ucontext (uc_mcontext.member) - -UCONTEXT_FLAGS ucontext (uc_flags) -UCONTEXT_LINK ucontext (uc_link) -UCONTEXT_STACK ucontext (uc_stack) -UCONTEXT_MCONTEXT ucontext (uc_mcontext) -UCONTEXT_SIGMASK ucontext (uc_sigmask) - -STACK_SP stack (ss_sp) -STACK_SIZE stack (ss_size) -STACK_FLAGS stack (ss_flags) - -MCONTEXT_GREGS mcontext (gregs) -MCONTEXT_FPREGS mcontext (fpregs) -MCONTEXT_PC mcontext (gregs) -MCONTEXT_FSR mcontext (fsr) - -UCONTEXT_SIZE sizeof (ucontext_t) diff --git a/glibc/sysdeps/unix/sysv/linux/riscv/vfork.S b/glibc/sysdeps/unix/sysv/linux/riscv/vfork.S deleted file mode 100644 index b15dd0c..0000000 --- a/glibc/sysdeps/unix/sysv/linux/riscv/vfork.S +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (C) 2005 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* vfork() is just a special case of clone(). */ - -#include <sys/asm.h> -#include <sysdep.h> -#define __ASSEMBLY__ -#include <linux/sched.h> -#include <asm/signal.h> - -#ifndef SAVE_PID -#define SAVE_PID -#endif - -#ifndef RESTORE_PID -#define RESTORE_PID -#endif - - -/* int vfork() */ - - .text -LEAF(__vfork) - - SAVE_PID - -#if (CLONE_VFORK | CLONE_VM | SIGCHLD) != 0x4111 -# error -#endif - li a0, (CLONE_VFORK | CLONE_VM | SIGCHLD) - move a1, sp - li a2, 0 - li a3, 0 - li a4, 0 - - /* Do the system call */ - li a7,__NR_clone - scall - - bltz a0,L(error) - - RESTORE_PID - - ret - - /* Something bad happened -- no child created. */ -L(error): - j __syscall_error - - END(__vfork) - -libc_hidden_def(__vfork) -weak_alias (__vfork, vfork) |