libc: update to a recent newlib version.

This commit is contained in:
Our Air Quality 2017-04-13 13:52:05 +10:00
parent cd23acaa4a
commit af4ac44cb5
77 changed files with 4496 additions and 9989 deletions

View file

@ -0,0 +1 @@
/* Use default implementation, see arc4random.h */

View file

@ -46,6 +46,9 @@ typedef __int64_t __int_least64_t;
typedef __uint64_t __uint_least64_t;
#define ___int_least64_t_defined
typedef __int64_t __intmax_t;
typedef __uint64_t __uintmax_t;
typedef __INTPTR_TYPE__ __intptr_t;
typedef __UINTPTR_TYPE__ __uintptr_t;

View file

@ -0,0 +1,35 @@
#ifndef __MACHINE_ENDIAN_H__
#error "must be included via <machine/endian.h>"
#endif /* !__MACHINE_ENDIAN_H__ */
#include <sys/config.h>
#ifdef __PPC__
/* Get rid of GCC builtin defines on PowerPC */
#ifdef _BIG_ENDIAN
#undef _BIG_ENDIAN
#endif
#ifdef _LITTLE_ENDIAN
#undef _LITTLE_ENDIAN
#endif
#endif /* __PPC__ */
#ifndef _LITTLE_ENDIAN
#define _LITTLE_ENDIAN 1234
#endif
#ifndef _BIG_ENDIAN
#define _BIG_ENDIAN 4321
#endif
#ifndef _PDP_ENDIAN
#define _PDP_ENDIAN 3412
#endif
#ifndef _BYTE_ORDER
#if defined(__IEEE_LITTLE_ENDIAN) || defined(__IEEE_BYTES_LITTLE_ENDIAN)
#define _BYTE_ORDER _LITTLE_ENDIAN
#else
#define _BYTE_ORDER _BIG_ENDIAN
#endif
#endif

View file

@ -0,0 +1,3 @@
#ifndef _SYS_TIME_H_
#error "must be included via <sys/time.h>"
#endif /* !_SYS_TIME_H_ */

View file

@ -1,20 +1,69 @@
#ifndef __MACHINE_ENDIAN_H__
#define __MACHINE_ENDIAN_H__
#include <sys/config.h>
#include <sys/cdefs.h>
#include <sys/_types.h>
#include <machine/_endian.h>
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif
#ifndef BYTE_ORDER
#if defined(__IEEE_LITTLE_ENDIAN) || defined(__IEEE_BYTES_LITTLE_ENDIAN)
#define BYTE_ORDER LITTLE_ENDIAN
#if _BYTE_ORDER == _LITTLE_ENDIAN
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
#else
#define BYTE_ORDER BIG_ENDIAN
#define _QUAD_HIGHWORD 0
#define _QUAD_LOWWORD 1
#endif
#if __BSD_VISIBLE
#define LITTLE_ENDIAN _LITTLE_ENDIAN
#define BIG_ENDIAN _BIG_ENDIAN
#define PDP_ENDIAN _PDP_ENDIAN
#define BYTE_ORDER _BYTE_ORDER
#endif
#ifdef __GNUC__
#define __bswap16(_x) __builtin_bswap16(_x)
#define __bswap32(_x) __builtin_bswap32(_x)
#define __bswap64(_x) __builtin_bswap64(_x)
#else /* __GNUC__ */
static __inline __uint16_t
__bswap16(__uint16_t _x)
{
return ((__uint16_t)((_x >> 8) | ((_x << 8) & 0xff00)));
}
static __inline __uint32_t
__bswap32(__uint32_t _x)
{
return ((__uint32_t)((_x >> 24) | ((_x >> 8) & 0xff00) |
((_x << 8) & 0xff0000) | ((_x << 24) & 0xff000000)));
}
static __inline __uint64_t
__bswap64(__uint64_t _x)
{
return ((__uint64_t)((_x >> 56) | ((_x >> 40) & 0xff00) |
((_x >> 24) & 0xff0000) | ((_x >> 8) & 0xff000000) |
((_x << 8) & ((__uint64_t)0xff << 32)) |
((_x << 24) & ((__uint64_t)0xff << 40)) |
((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))));
}
#endif /* !__GNUC__ */
#ifndef __machine_host_to_from_network_defined
#if _BYTE_ORDER == _LITTLE_ENDIAN
#define __htonl(_x) __bswap32(_x)
#define __htons(_x) __bswap16(_x)
#define __ntohl(_x) __bswap32(_x)
#define __ntohs(_x) __bswap16(_x)
#else
#define __htonl(_x) ((__uint32_t)(_x))
#define __htons(_x) ((__uint16_t)(_x))
#define __ntohl(_x) ((__uint32_t)(_x))
#define __ntohs(_x) ((__uint16_t)(_x))
#endif
#endif /* __machine_host_to_from_network_defined */
#endif /* __MACHINE_ENDIAN_H__ */

View file

@ -283,6 +283,10 @@
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __FT32__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __mcore__
#define __IEEE_BIG_ENDIAN
#endif
@ -415,6 +419,10 @@
# endif
#endif
#ifdef __VISIUM__
#define __IEEE_BIG_ENDIAN
#endif
#if (defined(__XTENSA__))
# ifdef __XTENSA_EB__
# define __IEEE_BIG_ENDIAN

View file

@ -92,6 +92,9 @@ _BEGIN_STD_C
# define _JBLEN (13 * 4)
# elif defined(__unix__) || defined(__rtems__)
# define _JBLEN 9
# elif defined(__iamcu__)
/* Intel MCU jmp_buf only covers callee-saved registers. */
# define _JBLEN 6
# else
# include "setjmp-dj.h"
# endif
@ -250,6 +253,10 @@ _BEGIN_STD_C
#define _JBLEN 10
#endif
#ifdef __FT32__
#define _JBLEN 27
#endif
#ifdef __iq2000__
#define _JBLEN 32
#endif
@ -258,6 +265,10 @@ _BEGIN_STD_C
#define _JBLEN 16
#endif
#ifdef __arc__
#define _JBLEN 25 /* r13-r30,blink,lp_count,lp_start,lp_end,mlo,mhi,status32 */
#endif
#ifdef __MMIX__
/* Using a layout compatible with GCC's built-in. */
#define _JBLEN 5
@ -314,6 +325,10 @@ _BEGIN_STD_C
#define _JBLEN 18
#endif
#ifdef __ia64
#define _JBLEN 64
#endif
#ifdef __lm32__
#define _JBLEN 19
#endif
@ -365,6 +380,11 @@ _BEGIN_STD_C
#define _JBLEN 0x44
#endif
#ifdef __VISIUM__
/* All call-saved GP registers: r11-r19,r21,r22,r23. */
#define _JBLEN 12
#endif
#ifdef _JBLEN
#ifdef _JBTYPE
typedef _JBTYPE jmp_buf[_JBLEN];
@ -403,6 +423,13 @@ typedef int sigjmp_buf[_JBLEN+1+(sizeof (sigset_t)/sizeof (int))];
#define __SIGMASK_FUNC sigprocmask
#endif
#ifdef __CYGWIN__
/* Per POSIX, siglongjmp has to be implemented as function. Cygwin
provides functions for both, siglongjmp and sigsetjmp since 2.2.0. */
extern void siglongjmp (sigjmp_buf, int) __attribute__ ((__noreturn__));
extern int sigsetjmp (sigjmp_buf, int);
#endif
#if defined(__GNUC__)
#define sigsetjmp(env, savemask) \
@ -440,8 +467,8 @@ typedef int sigjmp_buf[_JBLEN+1+(sizeof (sigset_t)/sizeof (int))];
are equivalent to sigsetjmp/siglongjmp when not saving the signal mask.
New applications should use sigsetjmp/siglongjmp instead. */
#ifdef __CYGWIN__
extern void _longjmp(jmp_buf, int);
extern int _setjmp(jmp_buf);
extern void _longjmp (jmp_buf, int) __attribute__ ((__noreturn__));
extern int _setjmp (jmp_buf);
#else
#define _setjmp(env) sigsetjmp ((env), 0)
#define _longjmp(env, val) siglongjmp ((env), (val))

View file

@ -1,19 +1,15 @@
#ifndef _MACHTIME_H_
#define _MACHTIME_H_
#if defined(__rtems__)
#define _CLOCKS_PER_SEC_ sysconf(_SC_CLK_TCK)
#else /* !__rtems__ */
#if defined(__aarch64__) || defined(__arm__) || defined(__thumb__)
#if defined(__rtems__) || defined(__VISIUM__)
#define _CLOCKS_PER_SEC_ 1000000
#elif defined(__aarch64__) || defined(__arm__) || defined(__thumb__)
#define _CLOCKS_PER_SEC_ 100
#endif
#endif /* !__rtems__ */
#ifdef __SPU__
#include <sys/types.h>
#include <sys/_timespec.h>
int nanosleep (const struct timespec *, struct timespec *);
#endif
#endif /* _MACHTIME_H_ */

View file

@ -1,30 +1,7 @@
#ifndef _MACHTYPES_H_
#define _MACHTYPES_H_
/*
* The following section is RTEMS specific and is needed to more
* closely match the types defined in the BSD machine/types.h.
* This is needed to let the RTEMS/BSD TCP/IP stack compile.
* Newlib targets may provide an own version of this file in their machine
* directory to add custom user types for <sys/types.h>.
*/
#if defined(__rtems__)
#include <machine/_types.h>
#endif
#define _CLOCK_T_ unsigned long /* clock() */
#define _TIME_T_ long /* time() */
#define _CLOCKID_T_ unsigned long
#define _TIMER_T_ unsigned long
#ifndef _HAVE_SYSTYPES
typedef long int __off_t;
typedef int __pid_t;
#ifdef __GNUC__
__extension__ typedef long long int __loff_t;
#else
typedef long int __loff_t;
#endif
#endif
#endif /* _MACHTYPES_H_ */
#ifndef _SYS_TYPES_H
#error "must be included via <sys/types.h>"
#endif /* !_SYS_TYPES_H */