Browse Source

Upgrade to glibc 2.21

pull/30/head
Andrew Waterman 11 years ago
parent
commit
03805f499a
  1. 2
      Makefile.in
  2. 13
      glibc/sysdeps/riscv/bits/atomic.h
  3. 2
      glibc/sysdeps/riscv/bits/link.h
  4. 6
      glibc/sysdeps/riscv/dl-machine.h
  5. 6
      glibc/sysdeps/riscv/fpu/fegetenv.c
  6. 6
      glibc/sysdeps/riscv/fpu/fegetround.c
  7. 12
      glibc/sysdeps/riscv/fpu/feholdexcpt.c
  8. 11
      glibc/sysdeps/riscv/fpu/fesetenv.c
  9. 7
      glibc/sysdeps/riscv/fpu/fesetround.c
  10. 15
      glibc/sysdeps/riscv/fpu/feupdateenv.c
  11. 2
      glibc/sysdeps/riscv/fpu/fgetexcptflg.c
  12. 7
      glibc/sysdeps/riscv/fpu/fraiseexcpt.c
  13. 8
      glibc/sysdeps/riscv/fpu/ftestexcept.c
  14. 145
      glibc/sysdeps/riscv/fpu/math_private.h
  15. 1
      glibc/sysdeps/riscv/memcpy.c
  16. 262
      glibc/sysdeps/riscv/nptl/lowlevellock.h
  17. 6
      glibc/sysdeps/riscv/nptl/sysdep-cancel.h
  18. 2
      glibc/sysdeps/riscv/setjmp.S
  19. 51
      glibc/sysdeps/riscv/sotruss-lib.c
  20. 3
      glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h
  21. 1
      glibc/sysdeps/unix/sysv/linux/riscv/shlib-versions
  22. 5
      glibc/sysdeps/unix/sysv/linux/riscv/syscall.c
  23. 1
      newlib/newlib/libc/machine/riscv/memcpy.c
  24. 10
      patches/glibc

2
Makefile.in

@ -5,7 +5,7 @@ INSTALL_DIR := @prefix@
PACKAGES := binutils gcc glibc newlib
gcc_version := 4.9.2
binutils_version := 2.25
glibc_version := 2.20
glibc_version := 2.21
newlib_version := 1.18.0
GNU_MIRROR := http://mirrors.kernel.org/gnu

13
glibc/sysdeps/riscv/bits/atomic.h

@ -42,6 +42,12 @@ typedef uintmax_t uatomic_max_t;
#ifdef __riscv_atomic
#ifdef __riscv64
# define __HAVE_64B_ATOMICS 1
#endif
#define USE_ATOMIC_COMPILER_BUILTINS 1
#define asm_amo(which, ordering, mem, value) ({ \
typeof(*mem) __tmp; \
if (sizeof(__tmp) == 4) \
@ -110,6 +116,11 @@ typedef uintmax_t uatomic_max_t;
atomic_exchange_and_add(mem, value)
#define catomic_max(mem, value) atomic_max(mem, value)
#endif /* __riscv_atomic */
#else /* __riscv_atomic */
#define __HAVE_64B_ATOMICS 0
#define USE_ATOMIC_COMPILER_BUILTINS 0
#endif /* !__riscv_atomic */
#endif /* bits/atomic.h */

2
glibc/sysdeps/riscv/bits/link.h

@ -28,7 +28,7 @@ typedef struct La_riscv_regs
unsigned long lr_sp;
} La_riscv_regs;
/* Return values for calls from PLT on MIPS. */
/* Return values for calls from PLT on RISC-V. */
typedef struct La_riscv_retval
{
unsigned long lrv_a0;

6
glibc/sysdeps/riscv/dl-machine.h

@ -136,7 +136,7 @@ elf_machine_load_address (void)
add a3, a3, a2\n\
add a3, a3, " STRINGXP (SZREG) "\n\
# Call the function to run the initializers.\n\
jal _dl_init_internal\n\
jal _dl_init\n\
# Pass our finalizer function to _start.\n\
lla a0, _dl_fini\n\
# Jump to the user entry point.\n\
@ -176,7 +176,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
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 refsym = sym;
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)
@ -216,7 +216,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
/* 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 += sym_map->l_tls_initimage - sym_map->l_addr;
value += (ElfW(Addr)) sym_map->l_tls_initimage - sym_map->l_addr;
}
size_t size = sym->st_size;

6
glibc/sysdeps/riscv/fpu/fegetenv.c

@ -22,11 +22,13 @@
#include <fpu_control.h>
int
fegetenv (fenv_t *envp)
__fegetenv (fenv_t *envp)
{
_FPU_GETCW (*envp);
/* Success. */
return 0;
}
libm_hidden_def (fegetenv)
libm_hidden_def (__fegetenv)
weak_alias (__fegetenv, fegetenv)
libm_hidden_weak (fegetenv)

6
glibc/sysdeps/riscv/fpu/fegetround.c

@ -22,10 +22,12 @@
#include <fpu_control.h>
int
fegetround (void)
__fegetround (void)
{
int round;
_FPU_GETROUND (round);
return round;
}
libm_hidden_def (fegetround)
libm_hidden_def (__fegetround)
weak_alias (__fegetround, fegetround)
libm_hidden_weak (fegetround)

12
glibc/sysdeps/riscv/fpu/feholdexcpt.c

@ -19,14 +19,14 @@
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
#include <math_private.h>
int
feholdexcept (fenv_t *envp)
__feholdexcept (fenv_t *envp)
{
_FPU_GETCW (*envp);
_FPU_SETFLAGS (0);
libc_feholdexcept_riscv (envp);
return 0;
}
libm_hidden_def (feholdexcept)
libm_hidden_def (__feholdexcept)
weak_alias (__feholdexcept, feholdexcept)
libm_hidden_weak (feholdexcept)

11
glibc/sysdeps/riscv/fpu/fesetenv.c

@ -19,13 +19,14 @@
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
#include <math_private.h>
int
fesetenv (const fenv_t *envp)
__fesetenv (const fenv_t *envp)
{
_FPU_SETCW (envp == FE_DFL_ENV ? 0 : *envp);
libc_fesetenv_riscv (envp);
return 0;
}
libm_hidden_def (fesetenv)
libm_hidden_def (__fesetenv)
weak_alias (__fesetenv, fesetenv)
libm_hidden_weak (fesetenv)

7
glibc/sysdeps/riscv/fpu/fesetround.c

@ -22,7 +22,7 @@
#include <fpu_control.h>
int
fesetround (int round)
__fesetround (int round)
{
switch (round)
{
@ -36,5 +36,6 @@ fesetround (int round)
return round; /* a nonzero value */
}
}
libm_hidden_def (fesetround)
libm_hidden_def (__fesetround)
weak_alias (__fesetround, fesetround)
libm_hidden_weak (fesetround)

15
glibc/sysdeps/riscv/fpu/feupdateenv.c

@ -19,17 +19,14 @@
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
#include <math_private.h>
int
feupdateenv (const fenv_t *envp)
__feupdateenv (const fenv_t *envp)
{
fenv_t env = *envp;
/* rm = 0; rm |= fenv.rm; flags |= fenv.flags */
_FPU_SETROUND (0);
asm volatile ("csrs fcsr, %0" : : "r"(env));
libc_feupdateenv_riscv (envp);
return 0;
}
libm_hidden_def (feupdateenv)
libm_hidden_def (__feupdateenv)
weak_alias (__feupdateenv, feupdateenv)
libm_hidden_weak (feupdateenv)

2
glibc/sysdeps/riscv/fpu/fgetexcptflg.c

@ -24,8 +24,6 @@
int
fegetexceptflag (fexcept_t *flagp, int excepts)
{
fpu_control_t temp;
/* Get the current exceptions. */
_FPU_GETFLAGS (*flagp);
*flagp &= excepts;

7
glibc/sysdeps/riscv/fpu/fraiseexcpt.c

@ -22,10 +22,11 @@
#include <fpu_control.h>
int
feraiseexcept (int excepts)
__feraiseexcept (int excepts)
{
asm volatile ("csrs fflags, %0" : : "r"(excepts));
return 0;
}
libm_hidden_def (feraiseexcept)
libm_hidden_def (__feraiseexcept)
weak_alias (__feraiseexcept, feraiseexcept)
libm_hidden_weak (feraiseexcept)

8
glibc/sysdeps/riscv/fpu/ftestexcept.c

@ -19,15 +19,11 @@
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
#include <math_private.h>
int
fetestexcept (int excepts)
{
int cw;
_FPU_GETFLAGS (cw);
return cw & excepts;
return libc_fetestexcept_riscv (excepts);
}
libm_hidden_def (fetestexcept)

145
glibc/sysdeps/riscv/fpu/math_private.h

@ -0,0 +1,145 @@
/* 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

1
glibc/sysdeps/riscv/memcpy.c

@ -58,7 +58,6 @@ small:
while (la < lend)
BODY(la, lb, long);
maybe_done:
a = (char*)la;
b = (const char*)lb;
if (__builtin_expect(a < end, 0))

262
glibc/sysdeps/riscv/nptl/lowlevellock.h

@ -1,262 +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. */
#ifndef _LOWLEVELLOCK_H
#define _LOWLEVELLOCK_H 1
#include <time.h>
#include <sys/param.h>
#include <bits/pthreadtypes.h>
#include <atomic.h>
#include <sysdep.h>
#include <kernel-features.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_REQUEUE 3
#define FUTEX_CMP_REQUEUE 4
#define FUTEX_WAKE_OP 5
#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE ((4 << 24) | 1)
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_WAIT_BITSET 9
#define FUTEX_WAKE_BITSET 10
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
#define FUTEX_BITSET_MATCH_ANY 0xffffffff
/* Values for 'private' parameter of locking macros. Yes, the
definition seems to be backwards. But it is not. The bit will be
reversed before passing to the system call. */
#define LLL_PRIVATE 0
#define LLL_SHARED FUTEX_PRIVATE_FLAG
#if !defined NOT_IN_libc || defined IS_IN_rtld
/* In libc.so or ld.so all futexes are private. */
# ifdef __ASSUME_PRIVATE_FUTEX
# define __lll_private_flag(fl, private) \
((fl) | FUTEX_PRIVATE_FLAG)
# else
# define __lll_private_flag(fl, private) \
((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex))
# endif
#else
# ifdef __ASSUME_PRIVATE_FUTEX
# define __lll_private_flag(fl, private) \
(((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
# else
# define __lll_private_flag(fl, private) \
(__builtin_constant_p (private) \
? ((private) == 0 \
? ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex)) \
: (fl)) \
: ((fl) | (((private) ^ FUTEX_PRIVATE_FLAG) \
& THREAD_GETMEM (THREAD_SELF, header.private_futex))))
# endif
#endif
#define lll_futex_wait(futexp, val, private) \
lll_futex_timed_wait(futexp, val, NULL, private)
#define lll_futex_timed_wait(futexp, val, timespec, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
__ret = INTERNAL_SYSCALL (futex, __err, 4, (long) (futexp), \
__lll_private_flag (FUTEX_WAIT, private), \
(val), (timespec)); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
#define lll_futex_wake(futexp, nr, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
__ret = INTERNAL_SYSCALL (futex, __err, 4, (long) (futexp), \
__lll_private_flag (FUTEX_WAKE, private), \
(nr), 0); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
#define lll_robust_dead(futexv, private) \
do \
{ \
int *__futexp = &(futexv); \
atomic_or (__futexp, FUTEX_OWNER_DIED); \
lll_futex_wake (__futexp, 1, private); \
} \
while (0)
/* Returns non-zero if error happened, zero if success. */
#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
__ret = INTERNAL_SYSCALL (futex, __err, 6, (long) (futexp), \
__lll_private_flag (FUTEX_CMP_REQUEUE, private),\
(nr_wake), (nr_move), (mutex), (val)); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
/* Returns non-zero if error happened, zero if success. */
#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
\
__ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
__lll_private_flag (FUTEX_WAKE_OP, private), \
(nr_wake), (nr_wake2), (futexp2), \
FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
#define lll_trylock(futex) \
({ \
atomic_compare_and_exchange_val_acq (&(futex), 1, 0) != 0; \
})
#define lll_cond_trylock(futex) \
({ \
atomic_compare_and_exchange_val_acq (&(futex), 2, 0) != 0; \
})
#define lll_robust_trylock(futex, id) \
({ \
atomic_compare_and_exchange_val_acq (&(futex), id, 0) != 0; \
})
extern void __lll_lock_wait_private (int *futex) attribute_hidden;
extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
#define lll_lock(futex, private) \
({ \
int val = atomic_compare_and_exchange_val_acq (&(futex), 1, 0); \
\
if (__builtin_expect (val != 0, 0)) \
{ \
if (__builtin_constant_p (private) && private == LLL_PRIVATE) \
__lll_lock_wait_private (&(futex)); \
else \
__lll_lock_wait (&(futex), private); \
} \
})
#define lll_robust_lock(futex, id, private) \
({ \
int result = 0; \
if (atomic_compare_and_exchange_bool_acq (&(futex), id, 0) != 0) \
result = __lll_robust_lock_wait (&(futex), private); \
result; \
})
#define lll_cond_lock(futex, private) \
({ \
int val = atomic_compare_and_exchange_val_acq (&(futex), 2, 0); \
\
if (__builtin_expect (val != 0, 0)) \
__lll_lock_wait (&(futex), private); \
})
#define lll_robust_cond_lock(futex, id, private) \
lll_robust_lock (futex, (id) | FUTEX_WAITERS, private)
extern int __lll_timedlock_wait (int *futex, const struct timespec *,
int private) attribute_hidden;
extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *,
int private) attribute_hidden;
#define lll_timedlock(futex, abstime, private) \
({ \
int val = atomic_compare_and_exchange_val_acq (&(futex), 1, 0); \
int result = 0; \
\
if (__builtin_expect (val != 0, 0)) \
result = __lll_timedlock_wait (&(futex), abstime, private); \
result; \
})
#define lll_robust_timedlock(futex, abstime, id, private) \
({ \
int result = 0; \
if (atomic_compare_and_exchange_bool_acq (&(futex), id, 0) != 0) \
result = __lll_robust_timedlock_wait (&(futex), abstime, private); \
result; \
})
#define lll_unlock(lock, private) \
((void) ({ \
int *__futex = &(lock); \
int __val = atomic_exchange_rel (__futex, 0); \
if (__builtin_expect (__val > 1, 0)) \
lll_futex_wake (__futex, 1, private); \
}))
#define lll_robust_unlock(lock, private) \
((void) ({ \
int *__futex = &(lock); \
int __val = atomic_exchange_rel (__futex, 0); \
if (__builtin_expect (__val & FUTEX_WAITERS, 0)) \
lll_futex_wake (__futex, 1, private); \
}))
#define lll_islocked(futex) \
(futex != 0)
/* Our internal lock implementation is identical to the binary-compatible
mutex implementation. */
/* Initializers for lock. */
#define LLL_LOCK_INITIALIZER (0)
#define LLL_LOCK_INITIALIZER_LOCKED (1)
/* The states of a lock are:
0 - untaken
1 - taken by one user
>1 - taken by more users */
/* The kernel notifies a process which uses CLONE_CLEARTID via futex
wakeup when the clone terminates. The memory location contains the
thread ID while the clone is running and is reset to zero
afterwards. */
#define lll_wait_tid(tid) \
do { \
__typeof (tid) __tid; \
while ((__tid = (tid)) != 0) \
lll_futex_wait (&(tid), __tid, LLL_SHARED); \
} while (0)
extern int __lll_timedwait_tid (int *, const struct timespec *)
attribute_hidden;
#define lll_timedwait_tid(tid, abstime) \
({ \
int __res = 0; \
if ((tid) != 0) \
__res = __lll_timedwait_tid (&(tid), (abstime)); \
__res; \
})
#endif /* lowlevellock.h */

6
glibc/sysdeps/riscv/nptl/sysdep-cancel.h

@ -28,7 +28,7 @@
happen before any instructions. So we use cfi_same_value instead of
cfi_restore. */
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
#if IS_IN (libc) || IS_IN (libpthread) || IS_IN (librt)
# undef PSEUDO
# define PSEUDO(name, syscall_name, args) \
@ -93,10 +93,10 @@
# define STKOFF_RA (STKOFF_SVMSK + SZREG)
# define STKSPACE (STKOFF_RA + SZREG)
# ifdef IS_IN_libpthread
# if IS_IN (libpthread)
# define CENABLE call __pthread_enable_asynccancel
# define CDISABLE call __pthread_disable_asynccancel
# elif defined IS_IN_librt
# elif IS_IN (librt)
# define CENABLE call __librt_enable_asynccancel
# define CDISABLE call __librt_disable_asynccancel
# else

2
glibc/sysdeps/riscv/setjmp.S

@ -63,7 +63,7 @@ ENTRY (__sigsetjmp)
REG_S a3, 15*SZREG(a0)
#endif
#if defined NOT_IN_libc && defined IS_IN_rtld
#if !IS_IN (libc) && IS_IN (rtld)
/* In ld.so we never save the signal mask. */
li a0, 0
ret

51
glibc/sysdeps/riscv/sotruss-lib.c

@ -0,0 +1,51 @@
/* 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;
}

3
glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h

@ -21,9 +21,6 @@
#include_next <kernel-features.h>
/* asm-generic architectures do not have the utimes syscall. */
#undef __ASSUME_UTIMES
/* 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

1
glibc/sysdeps/unix/sysv/linux/riscv/shlib-versions

@ -0,0 +1 @@
DEFAULT GLIBC_2.20

5
glibc/sysdeps/unix/sysv/linux/riscv/syscall.c

@ -21,14 +21,15 @@
long syscall (long syscall_number, long arg1, long arg2, long arg3,
long arg4, long arg5, long arg6, long arg7)
{
long ret, err;
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() attribute_hidden;
extern long __syscall_error (void) attribute_hidden;
return __syscall_error();
}

1
newlib/newlib/libc/machine/riscv/memcpy.c

@ -58,7 +58,6 @@ small:
while (la < lend)
BODY(la, lb, long);
maybe_done:
a = (char*)la;
b = (const char*)lb;
if (__builtin_expect(a < end, 0))

10
patches/glibc

@ -8,16 +8,6 @@
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
--- original-glibc/shlib-versions
+++ glibc/shlib-versions
@@ -25,6 +25,7 @@ s390x-.*-linux.* DEFAULT GLIBC_
powerpc64-.*-linux.* DEFAULT GLIBC_2.3
powerpc.*le-.*-linux.* DEFAULT GLIBC_2.17
.*-.*-gnu-gnu.* DEFAULT GLIBC_2.2.6
+riscv.*-.*-linux.* DEFAULT GLIBC_2.20
# Configuration Library=version Earliest symbol set (optional)
# ------------- --------------- ------------------------------
--- original-glibc/sunrpc/rpc_main.c
+++ glibc/sunrpc/rpc_main.c
@@ -38,7 +38,9 @@

Loading…
Cancel
Save