Newlib: implement locks
* Dynamically allocate arc4random data. Saves about 1k off the bss.
This commit is contained in:
parent
89c6c410ff
commit
e9d9201527
24 changed files with 3442 additions and 44 deletions
|
|
@ -1 +1,32 @@
|
|||
/* Use default implementation, see arc4random.h */
|
||||
/*
|
||||
* Copyright (c) 2017
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
void _arc4random_getentropy_fail(void);
|
||||
|
||||
#define _ARC4RANDOM_DATA
|
||||
|
||||
#define _ARC4RANDOM_GETENTROPY_FAIL() _arc4random_getentropy_fail()
|
||||
|
||||
#define _ARC4RANDOM_ALLOCATE(rsp, rsxp) \
|
||||
do { *rsp = malloc(sizeof(**rsp)); \
|
||||
*rsxp = malloc(sizeof(**rsxp)); } \
|
||||
while (0)
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
|||
|
|
@ -48,6 +48,23 @@
|
|||
This represents what type a float arg is passed as. It is used when the type is
|
||||
not promoted to double.
|
||||
|
||||
|
||||
__OBSOLETE_MATH_DEFAULT
|
||||
|
||||
Default value for __OBSOLETE_MATH if that's not set by the user.
|
||||
It should be set here based on predefined feature macros.
|
||||
|
||||
__OBSOLETE_MATH
|
||||
|
||||
If set to 1 then some new math code will be disabled and older libm
|
||||
code will be used instead. This is necessary because the new math
|
||||
code does not support all targets, it assumes that the toolchain has
|
||||
ISO C99 support (hexfloat literals, standard fenv semantics), the
|
||||
target has IEEE-754 conforming binary32 float and binary64 double
|
||||
(not mixed endian) representation, standard SNaN representation,
|
||||
double and single precision arithmetics has similar latency and it
|
||||
has no legacy SVID matherr support, only POSIX errno and fenv
|
||||
exception based error handling.
|
||||
*/
|
||||
|
||||
#if (defined(__arm__) || defined(__thumb__)) && !defined(__MAVERICK__)
|
||||
|
|
@ -61,6 +78,7 @@
|
|||
# else
|
||||
# define __IEEE_BIG_ENDIAN
|
||||
# endif
|
||||
# define __OBSOLETE_MATH_DEFAULT 0
|
||||
#else
|
||||
# define __IEEE_BIG_ENDIAN
|
||||
# ifdef __ARMEL__
|
||||
|
|
@ -75,6 +93,7 @@
|
|||
#else
|
||||
#define __IEEE_BIG_ENDIAN
|
||||
#endif
|
||||
#define __OBSOLETE_MATH_DEFAULT 0
|
||||
#endif
|
||||
|
||||
#ifdef __epiphany__
|
||||
|
|
@ -435,6 +454,14 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __OBSOLETE_MATH_DEFAULT
|
||||
/* Use old math code by default. */
|
||||
#define __OBSOLETE_MATH_DEFAULT 1
|
||||
#endif
|
||||
#ifndef __OBSOLETE_MATH
|
||||
#define __OBSOLETE_MATH __OBSOLETE_MATH_DEFAULT
|
||||
#endif
|
||||
|
||||
#ifndef __IEEE_BIG_ENDIAN
|
||||
#ifndef __IEEE_LITTLE_ENDIAN
|
||||
#error Endianess not declared!!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue