diff -Nru libnewlib-nano-2.10.0/COPYING.NEWLIB libnewlib-nano-2.11.2/COPYING.NEWLIB --- libnewlib-nano-2.10.0/COPYING.NEWLIB 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/COPYING.NEWLIB 2018-11-14 22:26:13.000000000 +0000 @@ -760,9 +760,9 @@ SUCH DAMAGE. -(35) - ARM Ltd (arm and thumb variant targets only) +(35) - Arm Ltd - Copyright (c) 2009-2015 ARM Ltd + Copyright (c) 2009-2018 Arm Ltd All rights reserved. Redistribution and use in source and binary forms, with or without diff -Nru libnewlib-nano-2.10.0/debian/changelog libnewlib-nano-2.11.2/debian/changelog --- libnewlib-nano-2.10.0/debian/changelog 2018-08-04 10:37:23.000000000 +0000 +++ libnewlib-nano-2.11.2/debian/changelog 2018-10-15 05:26:58.000000000 +0000 @@ -1,3 +1,11 @@ +libnewlib-nano (2.11.2-1) unstable; urgency=medium + + * 2.11.2 upstream release + * Refactor meson and tinystdio changes + * Make tinystdio pass printf/scanf tests + + -- Keith Packard Sun, 14 Oct 2018 22:26:58 -0700 + libnewlib-nano (2.10.0-1) unstable; urgency=medium * Initial release diff -Nru libnewlib-nano-2.10.0/do-arm-configure libnewlib-nano-2.11.2/do-arm-configure --- libnewlib-nano-2.10.0/do-arm-configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/do-arm-configure 2018-11-14 22:26:13.000000000 +0000 @@ -8,8 +8,10 @@ -Dnewlib-reentrant-small=true\ -Dnewlib-wide-orient=false\ -Dnewlib-nano-malloc=true\ + -Dnewlib-reent-small=true\ -Dlite-exit=true\ -Dnewlib-global-atexit=true\ + -Dnewlib-global-errno=true\ -Dincludedir=lib/newlib-nano/$ARCH/include \ -Dlibdir=lib/newlib-nano/$ARCH/lib \ --cross-file $DIR/cross-$ARCH.txt \ diff -Nru libnewlib-nano-2.10.0/libgloss/aarch64/cpu-init/rdimon-aem-el3.S libnewlib-nano-2.11.2/libgloss/aarch64/cpu-init/rdimon-aem-el3.S --- libnewlib-nano-2.10.0/libgloss/aarch64/cpu-init/rdimon-aem-el3.S 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/libgloss/aarch64/cpu-init/rdimon-aem-el3.S 2018-11-14 22:26:13.000000000 +0000 @@ -145,6 +145,33 @@ dsb sy msr sctlr_el3, x0 isb + + /* Determine if SVE is available. */ + mrs x0, id_aa64pfr0_el1 + tbz x0, 32, .Lnosve + + /* set up CPTR_EL3.TZ to 1. */ + mrs x0, cptr_el3 + + /* TZ is bit 8 of CPTR_EL3. */ + orr x0, x0, #0x100 + msr cptr_el3, x0 + isb + + /* set up vector lenght in ZCR_EL3 (4 LSB). */ + mov x2, #0xF + + /* Try to set the maximum value supported by the architecture (2048). + SVE Arch. + + "If this field is set to a value that is not supported by the + implementation then reading the register must return the highest + supported vector length that is less than the value written." */ + mrs x1, s3_6_c1_c2_0 /* mrs x1, zcr_el3. */ + bfi x1, x2, 0, 4 + msr s3_6_c1_c2_0, x1 /* msr zcr_el3, x1. */ + isb +.Lnosve: ret .data diff -Nru libnewlib-nano-2.10.0/libgloss/aarch64/syscalls.c libnewlib-nano-2.11.2/libgloss/aarch64/syscalls.c --- libnewlib-nano-2.10.0/libgloss/aarch64/syscalls.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/libgloss/aarch64/syscalls.c 2018-11-14 22:26:13.000000000 +0000 @@ -57,19 +57,19 @@ int _stat (const char *, struct stat *); int _fstat (int, struct stat *); int _swistat (int fd, struct stat * st); -caddr_t _sbrk (int); -int _getpid (int); +void * _sbrk (ptrdiff_t); +pid_t _getpid (void); int _close (int); clock_t _clock (void); int _swiclose (int); int _open (const char *, int, ...); int _swiopen (const char *, int); -int _write (int, char *, int); -int _swiwrite (int, char *, int); -int _lseek (int, int, int); -int _swilseek (int, int, int); -int _read (int, char *, int); -int _swiread (int, char *, int); +int _write (int, const char *, size_t); +int _swiwrite (int, const char *, size_t); +off_t _lseek (int, off_t, int); +off_t _swilseek (int, off_t, int); +int _read (int, void *, size_t); +int _swiread (int, void *, size_t); void initialise_monitor_handles (void); static int checkerror (int); @@ -349,7 +349,7 @@ len, is the length in bytes to read. Returns the number of bytes *not* written. */ int -_swiread (int fh, char *ptr, int len) +_swiread (int fh, void *ptr, size_t len) { param_block_t block[3]; @@ -364,7 +364,7 @@ Translates the return of _swiread into bytes read. */ int -_read (int fd, char *ptr, int len) +_read (int fd, void *ptr, size_t len) { int res; struct fdent *pfd; @@ -389,8 +389,8 @@ } /* fd, is a user file descriptor. */ -int -_swilseek (int fd, int ptr, int dir) +off_t +_swilseek (int fd, off_t ptr, int dir) { int res; struct fdent *pfd; @@ -449,7 +449,8 @@ return -1; } -_lseek (int fd, int ptr, int dir) +off_t +_lseek (int fd, off_t ptr, int dir) { return _swilseek (fd, ptr, dir); } @@ -457,7 +458,7 @@ /* fh, is a valid internal file handle. Returns the number of bytes *not* written. */ int -_swiwrite (int fh, char *ptr, int len) +_swiwrite (int fh, const char *ptr, size_t len) { param_block_t block[3]; @@ -470,7 +471,7 @@ /* fd, is a user file descriptor. */ int -_write (int fd, char *ptr, int len) +_write (int fd, const char *ptr, size_t len) { int res; struct fdent *pfd; @@ -620,7 +621,7 @@ } int __attribute__((weak)) -_getpid (int n __attribute__ ((unused))) +_getpid (void) { return 1; } @@ -628,8 +629,8 @@ /* Heap limit returned from SYS_HEAPINFO Angel semihost call. */ ulong __heap_limit __attribute__ ((aligned (8))) = 0xcafedead; -caddr_t -_sbrk (int incr) +void * +_sbrk (ptrdiff_t incr) { extern char end asm ("end"); /* Defined by the linker. */ static char *heap_end; @@ -642,7 +643,7 @@ if ((heap_end + incr > stack_ptr) /* Honour heap limit if it's valid. */ - || ((__heap_limit != 0xcafedead) && (heap_end + incr > __heap_limit))) + || ((__heap_limit != 0xcafedead) && (heap_end + incr > (char *)__heap_limit))) { /* Some of the libstdc++-v3 tests rely upon detecting out of memory errors, so do not abort here. */ diff -Nru libnewlib-nano-2.10.0/libgloss/arm/_exit.c libnewlib-nano-2.11.2/libgloss/arm/_exit.c --- libnewlib-nano-2.10.0/libgloss/arm/_exit.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/libgloss/arm/_exit.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,6 +1,6 @@ #include <_ansi.h> -int _kill (int, int); +int _kill (int, int) __attribute__((__noreturn__)); void _exit (int); void diff -Nru libnewlib-nano-2.10.0/libgloss/arm/_kill.c libnewlib-nano-2.11.2/libgloss/arm/_kill.c --- libnewlib-nano-2.10.0/libgloss/arm/_kill.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/libgloss/arm/_kill.c 2018-11-14 22:26:13.000000000 +0000 @@ -2,7 +2,7 @@ #include #include "swi.h" -int _kill (int, int); +int _kill (int, int) __attribute__((__noreturn__)); int _kill (int pid, int sig) @@ -41,12 +41,14 @@ #if SEMIHOST_V2 if (_has_ext_exit_extended ()) - return do_AngelSWI (insn, block); + do_AngelSWI (insn, block); else #endif - return do_AngelSWI (insn, (void*)block[0]); + do_AngelSWI (insn, (void*)block[0]); #else asm ("swi %a0" :: "i" (SWI_Exit)); #endif + + __builtin_unreachable(); } diff -Nru libnewlib-nano-2.10.0/libgloss/cris/gensyscalls libnewlib-nano-2.11.2/libgloss/cris/gensyscalls --- libnewlib-nano-2.10.0/libgloss/cris/gensyscalls 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/libgloss/cris/gensyscalls 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2005 Axis Communications. +# Copyright (C) 2005, 2018 Axis Communications. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -93,8 +93,16 @@ $lu#include #include int -_gettimeofday (struct timeval *tp, void *tzp -${r}gettimeofday (tp, tzp)) +_gettimeofday (struct timeval *tp, void *tzp) +{ + struct kernel_timeval kt; + int retval = _Sys_gettimeofday(&kt, tzp); + if (retval == 0) + { + tp->tv_sec = kt.tv_sec; + tp->tv_usec = kt.tv_usec; + } + R (retval) EOF cat > isatty.c <_errno = ENOSYS; + __errno_r(reent) = ENOSYS; return -1; } @@ -60,7 +60,7 @@ _execve_r(struct _reent *reent, const char *name, char * const *argv, char * const *env) { - reent->_errno = ENOSYS; + __errno_r(reent) = ENOSYS; return -1; } @@ -74,42 +74,42 @@ int _fstat_r(struct _reent *reent, int fildes, struct stat *st) { - reent->_errno = ENOSYS; + __errno_r(reent) = ENOSYS; return -1; } int _getpid_r(struct _reent *reent) { - reent->_errno = ENOSYS; + __errno_r(reent) = ENOSYS; return -1; } int _gettimeofday(struct _reent *reent, struct timeval *ptimeval, void *ptimezone) { - reent->_errno = ENOSYS; + __errno_r(reent) = ENOSYS; return -1; } int _isatty_r(struct _reent *reent, int file) { - reent->_errno = ENOSYS; + __errno_r(reent) = ENOSYS; return 0; } int _kill_r(struct _reent *reent, int pid, int sig) { - reent->_errno = ENOSYS; + __errno_r(reent) = ENOSYS; return -1; } int _link_r(struct _reent *reent, const char *existing, const char *new) { - reent->_errno = ENOSYS; + __errno_r(reent) = ENOSYS; return -1; } @@ -123,35 +123,35 @@ int _open_r(struct _reent *reent, const char *file, int flags, int mode) { - reent->_errno = ENOSYS; + __errno_r(reent) = ENOSYS; return -1; } _ssize_t _read_r(struct _reent *reent, int file, void *ptr, size_t len) { - reent->_errno = ENOSYS; + __errno_r(reent) = ENOSYS; return -1; } int _readlink_r(struct _reent *reent, const char *path, char *buf, size_t bufsize) { - reent->_errno = ENOSYS; + __errno_r(reent) = ENOSYS; return -1; } int _stat_r(struct _reent *reent, const char *path, struct stat *buf) { - reent->_errno = EIO; + __errno_r(reent) = EIO; return -1; } int _unlink_r(struct _reent *reent, const char * path) { - reent->_errno = EIO; + __errno_r(reent) = EIO; return (-1); } diff -Nru libnewlib-nano-2.10.0/libgloss/riscv/internal_syscall.h libnewlib-nano-2.11.2/libgloss/riscv/internal_syscall.h --- libnewlib-nano-2.10.0/libgloss/riscv/internal_syscall.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/libgloss/riscv/internal_syscall.h 2018-11-14 22:26:13.000000000 +0000 @@ -40,13 +40,18 @@ asm volatile ("scall" : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(syscall_id)); + return a0; +} + +static inline long +syscall_errno(long n, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5) +{ + long a0 = __internal_syscall (n, _a0, _a1, _a2, _a3, _a4, _a5); + if (a0 < 0) return __syscall_error (a0); else return a0; } -#define syscall_errno(n, a, b, c, d, e, f) \ - __internal_syscall(n, (long)(a), (long)(b), (long)(c), (long)(d), (long)(e), (long)(f)) - #endif diff -Nru libnewlib-nano-2.10.0/libgloss/riscv/sys_sbrk.c libnewlib-nano-2.11.2/libgloss/riscv/sys_sbrk.c --- libnewlib-nano-2.10.0/libgloss/riscv/sys_sbrk.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/libgloss/riscv/sys_sbrk.c 2018-11-14 22:26:13.000000000 +0000 @@ -41,14 +41,14 @@ if (heap_end == 0) { - long brk = syscall_errno (SYS_brk, 0, 0, 0, 0, 0, 0); + long brk = __internal_syscall (SYS_brk, 0, 0, 0, 0, 0, 0); if (brk == -1) - return (void *)-1; + return (void *)__syscall_error (-ENOMEM); heap_end = brk; } - if (syscall_errno (SYS_brk, heap_end + incr, 0, 0, 0, 0, 0) != heap_end + incr) - return (void *)-1; + if (__internal_syscall (SYS_brk, heap_end + incr, 0, 0, 0, 0, 0) != heap_end + incr) + return (void *)__syscall_error (-ENOMEM); heap_end += incr; return (void *)(heap_end - incr); diff -Nru libnewlib-nano-2.10.0/libgloss/riscv/sys_times.c libnewlib-nano-2.11.2/libgloss/riscv/sys_times.c --- libnewlib-nano-2.10.0/libgloss/riscv/sys_times.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/libgloss/riscv/sys_times.c 2018-11-14 22:26:13.000000000 +0000 @@ -23,7 +23,7 @@ { // when called for the first time, initialize t0 static struct timeval t0; - if (t0.tv_sec == 0) + if (t0.tv_sec == 0 && t0.tv_usec == 0) _gettimeofday (&t0, 0); struct timeval t; @@ -33,5 +33,5 @@ buf->tms_utime = utime * CLOCKS_PER_SEC / 1000000; buf->tms_stime = buf->tms_cstime = buf->tms_cutime = 0; - return -1; + return buf->tms_utime; } diff -Nru libnewlib-nano-2.10.0/libgloss/rs6000/sim-errno.c libnewlib-nano-2.11.2/libgloss/rs6000/sim-errno.c --- libnewlib-nano-2.10.0/libgloss/rs6000/sim-errno.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/libgloss/rs6000/sim-errno.c 2018-11-14 22:26:13.000000000 +0000 @@ -23,6 +23,6 @@ _cerror (e) int e; { - _REENT->_errno = e; + __errno_r(_REENT) = e; return -1; } diff -Nru libnewlib-nano-2.10.0/meson.build libnewlib-nano-2.11.2/meson.build --- libnewlib-nano-2.10.0/meson.build 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -8,32 +8,10 @@ targets = [] -foreach target : run_command(meson.get_compiler('c'), '--print-multi-lib').stdout().strip().split('\n') - tmp = target.split(';') - flags = [] - if tmp.length() > 1 - foreach flag : tmp[1].strip('@').split('@') - if flag != '' - flags += '-' + flag - endif - endforeach - if tmp[0] == '.' - name = '' - else - name = '_' + tmp[0].underscorify() - endif - else - name = '' - endif - targets += name - value = [tmp[0], flags] - set_variable('target_' + name, value) - message(name) -endforeach - +enable_multilib = get_option('multilib') enable_tests = get_option('tests') newlib_tinystdio = get_option('newlib-tinystdio') - +have_alias_attribute_option = get_option('have-alias-attribute') newlib_io_pos_args = get_option('newlib-io-pos-args') newlib_io_c99_formats = get_option('newlib-io-c99-formats') newlib_register_fini = get_option('newlib-register-fini') @@ -50,25 +28,91 @@ newlib_global_stdio_streams = get_option('newlib-global-stdio-streams') newlib_fvwrite_in_streamio = get_option('newlib-fvwrite-in-streamio') newlib_fseek_optimization = get_option('newlib-fseek-optimization') -newlib_wide_orient = get_option('newlib_wide_orient') +newlib_wide_orient = get_option('newlib-wide-orient') newlib_nano_malloc = get_option('newlib-nano-malloc') newlib_unbuf_stream_opt = get_option('newlib-unbuf-stream-opt') lite_exit = get_option('lite-exit') -newlib_nano_formatted_io = get_option('newlib_nano_formatted_io') +newlib_nano_formatted_io = get_option('newlib-nano-formatted-io') newlib_retargetable_locking = get_option('newlib-retargetable-locking') newlib_long_time_t = get_option('newlib-long-time_t') newlib_multithread = get_option('newlib-multithread') newlib_iconv = get_option('newlib-iconv') newlib_io_float = get_option('newlib-io-float') newlib_supplied_syscalls = get_option('newlib-supplied-syscalls') +newlib_elix_level = get_option('newlib-elix-level') +target_optspace = get_option('target-optspace') +newlib_reentrant_syscalls_provided = get_option('newlib-reentrant-syscalls-provided') +newlib_missing_syscall_names = get_option('newlib-missing-syscall-names') +newlib_locale_info = get_option('newlib-locale-info') +newlib_locale_info_extended = get_option('newlib-locale-info-extended') +newlib_global_errno = get_option('newlib-global-errno') hw_fp = get_option('hw-fp') +host_cpu=host_machine.cpu() +if host_cpu == '' + host_cc_machine=run_command(meson.get_compiler('c'), '-dumpmachine').stdout().strip().split('-') + host_cpu=host_cc_machine[0] + message('Computed host_cpu as ' + host_cpu) +endif + +if have_alias_attribute_option == 'auto' + have_alias_attribute = meson.get_compiler('c').has_function_attribute('alias') +else + have_alias_attribute = have_alias_attribute_option == 'true' +endif + +long_double_code = ''' +#include +#ifndef LDBL_MANT_DIG +#error No long double support in float.h +#endif +long double test() +{ + long double ld = 0.0L; + return ld; +} +''' +have_long_double = meson.get_compiler('c').compiles(long_double_code, name : 'long double check') + +if enable_multilib + foreach target : run_command(meson.get_compiler('c'), '--print-multi-lib').stdout().strip().split('\n') + tmp = target.split(';') + flags = [] + if tmp.length() > 1 + foreach flag : tmp[1].strip('@').split('@') + if flag != '' + flags += '-' + flag + endif + endforeach + if tmp[0] == '.' + name = '' + else + name = tmp[0].underscorify() + endif + else + name = '' + endif + targets += name + value = [tmp[0], flags] + set_variable('target_' + name, value) + endforeach +else + targets = [''] + target_ = ['.', []] +endif + conf_data = configuration_data() NEWLIB_MAJOR_VERSION=2 NEWLIB_MINOR_VERSION=10 NEWLIB_PATCHLEVEL_VERSION=0 +have_cc_inhibit_loop_to_libcall=meson.get_compiler('c').has_argument('-fno-tree-loop-distribute-patterns') +conf_data.set('_HAVE_CC_INHIBIT_LOOP_TO_LIBCALL', have_cc_inhibit_loop_to_libcall, + description: 'GCC flag to prevent detecting memcpy/memset patterns') +conf_data.set('HAVE_LONG_DOUBLE', have_long_double, + description: 'Compiler has long double type') +conf_data.set('HAVE_ALIAS_ATTRIBUTE', have_alias_attribute) conf_data.set('_WANT_IO_C99_FORMATS', newlib_io_c99_formats) conf_data.set('_WANT_REGISTER_FINI', newlib_register_fini) conf_data.set('_WANT_IO_LONG_LONG', newlib_io_long_long) @@ -96,6 +140,12 @@ conf_data.set('TINY_STDIO', newlib_tinystdio, description: 'Use tiny stdio from gcc avr') conf_data.set('__CUSTOM_FILE_IO__', newlib_tinystdio, description: 'Use tiny stdio FILE') conf_data.set('_IEEE_LIBM', true, description: 'math library only offers ieee semantics') +conf_data.set('PREFER_SIZE_OVER_SPEED', target_optspace, description: 'Optimize for space over speed') +conf_data.set('REENTRANT_SYSCALLS_PROVIDED', newlib_reentrant_syscalls_provided, description: 'Reentrant syscalls provided for us') +conf_data.set('MISSING_SYSCALL_NAMES', newlib_missing_syscall_names, description: 'use regular syscalls') +conf_data.set('__HAVE_LOCALE_INFO__', newlib_locale_info, description: 'locale support') +conf_data.set('__HAVE_LOCALE_INFO_EXTENDED__', newlib_locale_info_extended, description: 'extended locale support') +conf_data.set('NEWLIB_GLOBAL_ERRNO', newlib_global_errno, description: 'use global errno variable') version_data = configuration_data() @@ -130,7 +180,7 @@ install_dir: includedir) arguments = ['-g', '-ffunction-sections', '-fdata-sections'] -if get_option('target-optspace') +if target_optspace arguments += '-Os' endif diff -Nru libnewlib-nano-2.10.0/meson_options.txt libnewlib-nano-2.11.2/meson_options.txt --- libnewlib-nano-2.10.0/meson_options.txt 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/meson_options.txt 2018-11-14 22:26:13.000000000 +0000 @@ -1,10 +1,15 @@ option('target-optspace', type: 'boolean', value: false, description: 'Compile with -Os') +option('multilib', type: 'boolean', value: true, + description: 'Enable multilib compile') option('hw-fp', type: 'boolean', value: false, description: 'Turn on hardware floating point math') +option('have-alias-attribute', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', + description: 'Compiler supports __alias__ attribute') + option('tests', type: 'boolean', value: false, description: 'Enable tests') @@ -43,7 +48,7 @@ description: 'disable iov in streamio') option('newlib-fseek-optimization', type: 'boolean', value: false, description: 'disable fseek optimization') -option('newlib_wide_orient', type: 'boolean', value: false, +option('newlib-wide-orient', type: 'boolean', value: false, description: 'Turn off wide orientation in streamio') option('newlib-nano-malloc', type: 'boolean', value: false, description: 'use small-footprint nano-malloc implementation') @@ -51,7 +56,7 @@ description: 'enable unbuffered stream optimization in streamio') option('lite-exit', type: 'boolean', value: false, description: 'enable light weight exit') -option('newlib_nano_formatted_io', type: 'boolean', value: false, +option('newlib-nano-formatted-io', type: 'boolean', value: false, description: 'Use nano version formatted IO') option('newlib-retargetable-locking', type: 'boolean', value: false, description: 'Allow locking routines to be retargeted at link time') @@ -65,3 +70,15 @@ description: 'enable printf/scanf family float support') option('newlib-supplied-syscalls', type: 'boolean', value: false, description: 'enable newlib supplied syscalls') +option('newlib-elix-level', type: 'integer', value: 0, + description: 'desired elix library level (0-4)') +option('newlib-reentrant-syscalls-provided', type: 'boolean', value: false, + description: 'system provides reentrant syscall API') +option('newlib-missing-syscall-names', type: 'boolean', value: false, + description: 'system only provides regular syscall API') +option('newlib-locale-info', type: 'boolean', value: false, + description: 'locale support') +option('newlib-locale-info-extended', type: 'boolean', value: false, + description: 'extended locale support') +option('newlib-global-errno', type: 'boolean', value: false, + description: 'use global errnor variable') diff -Nru libnewlib-nano-2.10.0/newlib/acinclude.m4 libnewlib-nano-2.11.2/newlib/acinclude.m4 --- libnewlib-nano-2.10.0/newlib/acinclude.m4 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/acinclude.m4 2018-11-14 22:26:13.000000000 +0000 @@ -92,6 +92,16 @@ AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes) +dnl Support --disable-newlib-fno-builtin +AC_ARG_ENABLE(newlib-fno-builtin, +[ --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions], +[case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-fno-builtin option) ;; + esac], [newlib_fno_builtin=])dnl + + dnl We may get other options which we don't document: dnl --with-target-subdir, --with-multisrctop, --with-multisubdir @@ -202,8 +212,6 @@ . [$]{newlib_basedir}/configure.host -newlib_cflags="[$]{newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} AC_SUBST(NEWLIB_CFLAGS) diff -Nru libnewlib-nano-2.10.0/newlib/configure libnewlib-nano-2.11.2/newlib/configure --- libnewlib-nano-2.10.0/newlib/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/configure 2018-11-14 22:26:13.000000000 +0000 @@ -813,6 +813,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1487,6 +1488,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -3170,6 +3172,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -4016,8 +4030,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11828,7 +11840,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11831 "configure" +#line 11843 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11934,7 +11946,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11937 "configure" +#line 11949 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/configure.host libnewlib-nano-2.11.2/newlib/configure.host --- libnewlib-nano-2.10.0/newlib/configure.host 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/configure.host 2018-11-14 22:26:13.000000000 +0000 @@ -28,6 +28,7 @@ # newlib_io_long_long --enable-newlib-io-long-long ("yes", "no", "") # newlib_io_long_double --enable-newlib-io-long-double ("yes", "no", "") # newlib_global_stdio_streams --enable-global-stdio-streams ("yes", "no, "") +# newlib_fno_builtin --disable-newlib-fno-builtin ("yes", "no, "") # It sets the following shell variables: # newlib_cflags Special CFLAGS to use when building @@ -91,6 +92,19 @@ ;; esac +case "${newlib_fno_builtin}:${host}" in + yes:*) + newlib_cflags="${newlib_cflags} -fno-builtin" + ;; + no:*) + newlib_cflags="${newlib_cflags}" + ;; + *:*) + # For now, all targets default to using -fno-builtin until tested without + newlib_cflags="${newlib_cflags} -fno-builtin" + ;; +esac + # Get the source directories to use for the CPU type. # machine_dir should supply CPU dependent routines, such as setjmp. # newlib_cflags is passed to gcc when compiling. @@ -121,6 +135,12 @@ machine_dir=cr16 ;; cris | crisv32) + # The size of the (kernel_)time_t passed from or to a + # simulator or a Linux kernel is mandated by the + # gettimeofday and time system calls and fixed to 32 bits, the + # size of a long. Instead of churning as 64 bits what is anyway + # 32 bits, it makes more sense to default to long. + test -z "${enable_newlib_long_time_t}" && newlib_long_time_t=yes machine_dir=cris ;; crx*) @@ -259,6 +279,7 @@ ;; or1k*|or1knd*) machine_dir=or1k + have_init_fini=no ;; powerpc*) machine_dir=powerpc @@ -418,6 +439,9 @@ sys_dir=a29khif signal_dir= ;; + aarch64*-*-*) + newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB" + ;; arm*-*-*) newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB" sys_dir=arm @@ -614,6 +638,7 @@ *-*-rtems*) default_newlib_io_long_long="yes" default_newlib_io_c99_formats="yes" + newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections " newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB" newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC" # turn off unsupported items in posix directory diff -Nru libnewlib-nano-2.10.0/newlib/libc/configure libnewlib-nano-2.11.2/newlib/libc/configure --- libnewlib-nano-2.10.0/newlib/libc/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/configure 2018-11-14 22:26:13.000000000 +0000 @@ -808,6 +808,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1460,6 +1461,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2930,6 +2932,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3776,8 +3790,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11555,7 +11567,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11558 "configure" +#line 11570 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11661,7 +11673,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11664 "configure" +#line 11676 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libc/ctype/jp2uc.c libnewlib-nano-2.11.2/newlib/libc/ctype/jp2uc.c --- libnewlib-nano-2.10.0/newlib/libc/ctype/jp2uc.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/ctype/jp2uc.c 2018-11-14 22:26:13.000000000 +0000 @@ -166,7 +166,7 @@ wint_t _jp2uc_l (wint_t c, struct __locale_t * l) { - char * cs = l ? __locale_charset(l) : __current_locale_charset(); + const char * cs = l ? __locale_charset(l) : __current_locale_charset(); if (0 == strcmp (cs, "JIS")) c = __jp2uc (c, JP_JIS); else if (0 == strcmp (cs, "SJIS")) @@ -186,7 +186,7 @@ wint_t _uc2jp_l (wint_t c, struct __locale_t * l) { - char * cs = l ? __locale_charset(l) : __current_locale_charset(); + const char * cs = l ? __locale_charset(l) : __current_locale_charset(); if (0 == strcmp (cs, "JIS")) c = __uc2jp (c, JP_JIS); else if (0 == strcmp (cs, "SJIS")) diff -Nru libnewlib-nano-2.10.0/newlib/libc/ctype/towctrans.c libnewlib-nano-2.11.2/newlib/libc/ctype/towctrans.c --- libnewlib-nano-2.10.0/newlib/libc/ctype/towctrans.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/ctype/towctrans.c 2018-11-14 22:26:13.000000000 +0000 @@ -86,7 +86,7 @@ { // skipping this because it was causing trouble (cygwin crash) // and there is no errno specified for towctrans - //r->_errno = EINVAL; + //__errno_r(r) = EINVAL; return c; } } diff -Nru libnewlib-nano-2.10.0/newlib/libc/ctype/wctrans.c libnewlib-nano-2.11.2/newlib/libc/ctype/wctrans.c --- libnewlib-nano-2.10.0/newlib/libc/ctype/wctrans.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/ctype/wctrans.c 2018-11-14 22:26:13.000000000 +0000 @@ -84,7 +84,7 @@ return WCT_TOUPPER; else { - r->_errno = EINVAL; + __errno_r(r) = EINVAL; return 0; } } diff -Nru libnewlib-nano-2.10.0/newlib/libc/ctype/wctype.c libnewlib-nano-2.11.2/newlib/libc/ctype/wctype.c --- libnewlib-nano-2.10.0/newlib/libc/ctype/wctype.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/ctype/wctype.c 2018-11-14 22:26:13.000000000 +0000 @@ -128,7 +128,7 @@ } /* otherwise invalid */ - r->_errno = EINVAL; + __errno_r(r) = EINVAL; return 0; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/errno/errno.c libnewlib-nano-2.11.2/newlib/libc/errno/errno.c --- libnewlib-nano-2.10.0/newlib/libc/errno/errno.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/errno/errno.c 2018-11-14 22:26:13.000000000 +0000 @@ -5,12 +5,17 @@ #include #include +#ifdef NEWLIB_GLOBAL_ERRNO +int errno; +#else + #ifndef _REENT_ONLY int * __errno () { - return &_REENT->_errno; + return &__errno_r(_REENT); } #endif +#endif diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/ctype.h libnewlib-nano-2.11.2/newlib/libc/include/ctype.h --- libnewlib-nano-2.10.0/newlib/libc/include/ctype.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/ctype.h 2018-11-14 22:26:13.000000000 +0000 @@ -66,7 +66,7 @@ #define _X 0100 #define _B 0200 -#if _MB_CAPABLE +#ifdef __HAVE_LOCALE_INFO__ const char *__locale_ctype_ptr (void); #else #define __locale_ctype_ptr() _ctype_ @@ -105,7 +105,11 @@ #endif #if __POSIX_VISIBLE >= 200809 +#ifdef __HAVE_LOCALE_INFO__ const char *__locale_ctype_ptr_l (locale_t); +#else +#define __locale_ctype_ptr_l(l) _ctype_ +#endif #define __ctype_lookup_l(__c,__l) ((__locale_ctype_ptr_l(__l)+sizeof(""[__c]))[(int)(__c)]) #define isalpha_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_U|_L)) diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/dirent.h libnewlib-nano-2.11.2/newlib/libc/include/dirent.h --- libnewlib-nano-2.10.0/newlib/libc/include/dirent.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/dirent.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,8 +1,40 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)dirent.h 8.3 (Berkeley) 8/10/94 + * $FreeBSD: head/include/dirent.h 326024 2017-11-20 19:45:28Z pfg $ + */ + #ifndef _DIRENT_H_ -#define _DIRENT_H_ -#ifdef __cplusplus -extern "C" { -#endif +#define _DIRENT_H_ + #include #include @@ -10,7 +42,44 @@ #define MAXNAMLEN 1024 #endif -#ifdef __cplusplus -} +__BEGIN_DECLS +#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700 +int alphasort(const struct dirent **, const struct dirent **); +int dirfd(DIR *); +#endif +#if __BSD_VISIBLE +int fdclosedir(DIR *); +#endif +DIR *opendir(const char *); +DIR *fdopendir(int); +struct dirent * + readdir(DIR *); +#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500 +int readdir_r(DIR *__restrict, struct dirent *__restrict, + struct dirent **__restrict); +#endif +void rewinddir(DIR *); +#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700 +int scandir(const char *, struct dirent ***, + int (*)(const struct dirent *), int (*)(const struct dirent **, + const struct dirent **)); #endif +#ifdef _COMPILING_NEWLIB +void _seekdir(DIR *, long); +#endif +#if __MISC_VISIBLE || __XSI_VISIBLE +#ifndef __INSIDE_CYGWIN__ +void seekdir(DIR *, long); +long telldir(DIR *); +#endif +#endif +int closedir(DIR *); +#if __GNU_VISIBLE +int scandirat(int, const char *, struct dirent ***, + int (*) (const struct dirent *), int (*) (const struct dirent **, + const struct dirent **)); +int versionsort(const struct dirent **, const struct dirent **); +#endif +__END_DECLS + #endif /*_DIRENT_H_*/ diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/ieeefp.h libnewlib-nano-2.11.2/newlib/libc/include/ieeefp.h --- libnewlib-nano-2.10.0/newlib/libc/include/ieeefp.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/ieeefp.h 2018-11-14 22:26:13.000000000 +0000 @@ -143,11 +143,6 @@ #endif /* __IEEE_LITTLE_ENDIAN */ -#if LDBL_MANT_DIG == DBL_MANT_DIG && LDBL_MIN_EXP == DBL_MIN_EXP && \ - LDBL_MAX_EXP == DBL_MAX_EXP -#define _LDBL_EQ_DBL -#endif - #ifndef _LDBL_EQ_DBL #ifndef LDBL_MANT_DIG diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/langinfo.h libnewlib-nano-2.11.2/newlib/libc/include/langinfo.h --- libnewlib-nano-2.10.0/newlib/libc/include/langinfo.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/langinfo.h 2018-11-14 22:26:13.000000000 +0000 @@ -29,19 +29,18 @@ #ifndef _LANGINFO_H_ #define _LANGINFO_H_ -#include -#include #include +#include #if __POSIX_VISIBLE >= 200809 #include #endif #ifndef _NL_ITEM_DECLARED -typedef int nl_item; +typedef __nl_item nl_item; #define _NL_ITEM_DECLARED #endif -enum __nl_item +enum { /* POSIX and BSD defined items have to stick to the original values to maintain backward compatibility. */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/math.h libnewlib-nano-2.11.2/newlib/libc/include/math.h --- libnewlib-nano-2.10.0/newlib/libc/include/math.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/math.h 2018-11-14 22:26:13.000000000 +0000 @@ -4,7 +4,7 @@ #include #include -#include +#include #include "_ansi.h" _BEGIN_STD_C diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/stdio.h libnewlib-nano-2.11.2/newlib/libc/include/stdio.h --- libnewlib-nano-2.10.0/newlib/libc/include/stdio.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/stdio.h 2018-11-14 22:26:13.000000000 +0000 @@ -186,7 +186,7 @@ FILE * tmpfile (void); char * tmpnam (char *); #if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 -char * tempnam (const char *, const char *); +char * tempnam (const char *, const char *) __malloc_like __result_use_check; #endif int fclose (FILE *); int fflush (FILE *); diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/stdlib.h libnewlib-nano-2.11.2/newlib/libc/include/stdlib.h --- libnewlib-nano-2.10.0/newlib/libc/include/stdlib.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/stdlib.h 2018-11-14 22:26:13.000000000 +0000 @@ -282,7 +282,8 @@ #endif /* !__CYGWIN__ */ #if __POSIX_VISIBLE >= 200112 -int __nonnull ((1)) posix_memalign (void **, size_t, size_t); +int posix_memalign (void **, size_t, size_t) __nonnull((1)) + __result_use_check; #endif char * _dtoa_r (struct _reent *, double, int, int, int *, int*, char**); @@ -326,7 +327,7 @@ */ #if __ISO_C_VISIBLE >= 2011 void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1) - __alloc_size(2); + __alloc_size(2) __result_use_check; int at_quick_exit(void (*)(void)); _Noreturn void quick_exit(int); diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/string.h libnewlib-nano-2.11.2/newlib/libc/include/string.h --- libnewlib-nano-2.10.0/newlib/libc/include/string.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/string.h 2018-11-14 22:26:13.000000000 +0000 @@ -81,11 +81,11 @@ char *strchrnul (const char *, int); #endif #if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4 -char *strdup (const char *); +char *strdup (const char *) __malloc_like __result_use_check; #endif char *_strdup_r (struct _reent *, const char *); #if __POSIX_VISIBLE >= 200809 -char *strndup (const char *, size_t); +char *strndup (const char *, size_t) __malloc_like __result_use_check; #endif char *_strndup_r (struct _reent *, const char *, size_t); diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/sys/config.h libnewlib-nano-2.11.2/newlib/libc/include/sys/config.h --- libnewlib-nano-2.10.0/newlib/libc/include/sys/config.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/sys/config.h 2018-11-14 22:26:13.000000000 +0000 @@ -3,6 +3,7 @@ #include /* floating point macros */ #include /* POSIX defs */ +#include #ifdef __aarch64__ #define MALLOC_ALIGNMENT 16 @@ -108,7 +109,7 @@ #define _POINTER_INT short #endif -#ifdef __v850 +#if defined(__v850) && !defined(__rtems__) #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__sda__)) #endif @@ -297,4 +298,13 @@ #define _MB_EXTENDED_CHARSETS_WINDOWS 1 #endif +/* Figure out if long double is the same size as double. If the system + * doesn't provide long double, then those values will be undefined + * and cpp will substitute 0 for them in the test + */ +#if LDBL_MANT_DIG == DBL_MANT_DIG && LDBL_MIN_EXP == DBL_MIN_EXP && \ + LDBL_MAX_EXP == DBL_MAX_EXP +#define _LDBL_EQ_DBL +#endif + #endif /* __SYS_CONFIG_H__ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/sys/_default_fcntl.h libnewlib-nano-2.11.2/newlib/libc/include/sys/_default_fcntl.h --- libnewlib-nano-2.10.0/newlib/libc/include/sys/_default_fcntl.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/sys/_default_fcntl.h 2018-11-14 22:26:13.000000000 +0000 @@ -23,6 +23,19 @@ #define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ #define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */ #define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ +#if defined (__CYGWIN__) +#define _FBINARY 0x10000 +#define _FTEXT 0x20000 +#endif +#define _FNOINHERIT 0x40000 +#define _FDIRECT 0x80000 +#define _FNOFOLLOW 0x100000 +#define _FDIRECTORY 0x200000 +#define _FEXECSRCH 0x400000 +#if defined (__CYGWIN__) +#define _FTMPFILE 0x800000 +#define _FNOATIME 0x1000000 +#endif #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) @@ -43,35 +56,28 @@ /* O_NDELAY _FNBIO set in include/fcntl.h */ #define O_NONBLOCK _FNONBLOCK #define O_NOCTTY _FNOCTTY -/* For machines which care - */ -#if defined (__CYGWIN__) -#define _FBINARY 0x10000 -#define _FTEXT 0x20000 -#define _FNOINHERIT 0x40000 -#define _FDIRECT 0x80000 -#define _FNOFOLLOW 0x100000 -#define _FDIRECTORY 0x200000 -#define _FEXECSRCH 0x400000 -#define _FTMPFILE 0x800000 -#define _FNOATIME 0x1000000 +/* POSIX-1.2008 specific flags */ +#if __POSIX_VISIBLE >= 200809 +#define O_CLOEXEC _FNOINHERIT +#define O_NOFOLLOW _FNOFOLLOW +#define O_DIRECTORY _FDIRECTORY +#define O_EXEC _FEXECSRCH +#define O_SEARCH _FEXECSRCH +#endif + +#if __BSD_VISIBLE +#define O_DIRECT _FDIRECT +#endif + +#if defined (__CYGWIN__) #define O_BINARY _FBINARY #define O_TEXT _FTEXT #define O_DSYNC _FSYNC #define O_RSYNC _FSYNC -#define O_EXEC _FEXECSRCH -#define O_SEARCH _FEXECSRCH - -/* POSIX-1.2008 specific flags */ -#if __POSIX_VISIBLE >= 200809 -#define O_CLOEXEC _FNOINHERIT -#define O_NOFOLLOW _FNOFOLLOW -#define O_DIRECTORY _FDIRECTORY -#endif /* Linux-specific flags */ #if __GNU_VISIBLE -#define O_DIRECT _FDIRECT #define O_TMPFILE _FTMPFILE #define O_NOATIME _FNOATIME #endif diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/sys/errno.h libnewlib-nano-2.11.2/newlib/libc/include/sys/errno.h --- libnewlib-nano-2.10.0/newlib/libc/include/sys/errno.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/sys/errno.h 2018-11-14 22:26:13.000000000 +0000 @@ -10,11 +10,6 @@ #include -#ifndef _REENT_ONLY -#define errno (*__errno()) -extern int *__errno (void); -#endif - /* Please don't use these variables directly. Use strerror instead. */ extern __IMPORT const char * const _sys_errlist[]; @@ -26,7 +21,16 @@ extern __IMPORT char *program_invocation_short_name; #endif +#ifdef NEWLIB_GLOBAL_ERRNO +extern int errno; +#define __errno_r(ptr) (errno) +#else #define __errno_r(ptr) ((ptr)->_errno) +#ifndef _REENT_ONLY +#define errno (*__errno()) +extern int *__errno (void); +#endif +#endif #define EPERM 1 /* Not owner */ #define ENOENT 2 /* No such file or directory */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/sys/queue.h libnewlib-nano-2.11.2/newlib/libc/include/sys/queue.h --- libnewlib-nano-2.10.0/newlib/libc/include/sys/queue.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/sys/queue.h 2018-11-14 22:26:13.000000000 +0000 @@ -93,6 +93,7 @@ * _NEXT + + + + * _PREV - + - + * _LAST - - + + + * _LAST_FAST - - - + * _FOREACH + + + + * _FOREACH_FROM + + + + * _FOREACH_SAFE + + + + @@ -820,6 +821,16 @@ #define TAILQ_LAST(head, headname) \ (*(((struct headname *)((head)->tqh_last))->tqh_last)) +/* + * The FAST function is fast in that it causes no data access other + * then the access to the head. The standard LAST function above + * will cause a data access of both the element you want and + * the previous element. FAST is very useful for instances when + * you may want to prefetch the last data element. + */ +#define TAILQ_LAST_FAST(head, type, field) \ + (TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last, QUEUE_TYPEOF(type), field.tqe_next)) + #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) #define TAILQ_PREV(elm, headname, field) \ diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/sys/reent.h libnewlib-nano-2.11.2/newlib/libc/include/sys/reent.h --- libnewlib-nano-2.10.0/newlib/libc/include/sys/reent.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/sys/reent.h 2018-11-14 22:26:13.000000000 +0000 @@ -13,6 +13,7 @@ #include <_ansi.h> #include #include +#include #define _NULL 0 @@ -144,7 +145,7 @@ * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. */ -#if defined(_REENT_SMALL) && !defined(_REENT_GLOBAL_STDIO_STREAMS) +#if defined(_REENT_SMALL) && !defined(_REENT_GLOBAL_STDIO_STREAMS) && !defined(__CUSTOM_FILE_IO__) /* * struct __sFILE_fake is the start of a struct __sFILE, with only the * minimal fields allocated. In __sinit() we really allocate the 3 @@ -371,10 +372,13 @@ * ports with 16-bit int's but 32-bit pointers, align nicely. */ struct _reent { +# ifndef NEWLIB_GLOBAL_ERRNO /* As an exception to the above put _errno first for binary compatibility with non _REENT_SMALL targets. */ int _errno; /* local copy of errno */ +#endif +# ifndef TINY_STDIO /* FILE is a big struct and may change over time. To try to achieve binary compatibility with future versions, put stdin,stdout,stderr here. These are pointers into member __sf defined below. */ @@ -385,9 +389,12 @@ char *_emergency; int __sdidinit; /* 1 means stdio has been init'd */ +# endif +# ifdef __HAVE_LOCALE_INFO__ int _unspecified_locale_info; /* unused, reserved for locale stuff */ struct __locale_t *_locale;/* per-thread locale */ +# endif struct _mprec *_mp; @@ -501,8 +508,8 @@ #define __reent_assert(x) ((void)0) #endif -#ifdef __CUSTOM_FILE_IO__ -#error Custom FILE I/O and _REENT_SMALL not currently supported. +#if defined(__CUSTOM_FILE_IO__) && !defined(TINY_STDIO) +#error Custom FILE I/O and _REENT_SMALL not currently supported without TINY_STDIO #endif /* Generic _REENT check macro. */ @@ -607,7 +614,9 @@ struct _reent { +# ifndef NEWLIB_GLOBAL_ERRNO int _errno; /* local copy of errno */ +#endif /* FILE is a big struct and may change over time. To try to achieve binary compatibility with future versions, put stdin,stdout,stderr here. @@ -618,8 +627,10 @@ char _emergency[_REENT_EMERGENCY_SIZE]; /* TODO */ +# ifdef __HAVE_LOCALE_INFO__ int _unspecified_locale_info; /* unused, reserved for locale stuff */ struct __locale_t *_locale;/* per-thread locale */ +#endif int __sdidinit; /* 1 means stdio has been init'd */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/sys/signal.h libnewlib-nano-2.11.2/newlib/libc/include/sys/signal.h --- libnewlib-nano-2.10.0/newlib/libc/include/sys/signal.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/sys/signal.h 2018-11-14 22:26:13.000000000 +0000 @@ -161,11 +161,11 @@ #define SIG_BLOCK 1 /* set of signals to block */ #define SIG_UNBLOCK 2 /* set of signals to, well, unblock */ -int sigprocmask (int how, const sigset_t *set, sigset_t *oset); +int sigprocmask (int, const sigset_t *, sigset_t *); #endif #if __POSIX_VISIBLE >= 199506 -int pthread_sigmask (int how, const sigset_t *set, sigset_t *oset); +int pthread_sigmask (int, const sigset_t *, sigset_t *); #endif #ifdef _COMPILING_NEWLIB @@ -188,7 +188,7 @@ int sigemptyset (sigset_t *); int sigpending (sigset_t *); int sigsuspend (const sigset_t *); -int sigwait (const sigset_t *set, int *sig); +int sigwait (const sigset_t *, int *); #if !defined(__CYGWIN__) && !defined(__rtems__) /* These depend upon the type of sigset_t, which right now @@ -223,7 +223,7 @@ #endif #if __POSIX_VISIBLE >= 199506 -int pthread_kill (pthread_t thread, int sig); +int pthread_kill (pthread_t, int); #endif #if __POSIX_VISIBLE >= 199309 @@ -231,11 +231,10 @@ /* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 NOTE: P1003.1c/D10, p. 39 adds sigwait(). */ -int sigwaitinfo (const sigset_t *set, siginfo_t *info); -int sigtimedwait (const sigset_t *set, siginfo_t *info, - const struct timespec *timeout); +int sigwaitinfo (const sigset_t *, siginfo_t *); +int sigtimedwait (const sigset_t *, siginfo_t *, const struct timespec *); /* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */ -int sigqueue (pid_t pid, int signo, const union sigval value); +int sigqueue (pid_t, int, const union sigval); #endif /* __POSIX_VISIBLE >= 199309 */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/sys/_types.h libnewlib-nano-2.11.2/newlib/libc/include/sys/_types.h --- libnewlib-nano-2.10.0/newlib/libc/include/sys/_types.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/sys/_types.h 2018-11-14 22:26:13.000000000 +0000 @@ -210,6 +210,7 @@ typedef __uint32_t __socklen_t; #endif +typedef int __nl_item; typedef unsigned short __nlink_t; typedef long __suseconds_t; /* microseconds (signed) */ typedef unsigned long __useconds_t; /* microseconds (unsigned) */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/include/wchar.h libnewlib-nano-2.11.2/newlib/libc/include/wchar.h --- libnewlib-nano-2.10.0/newlib/libc/include/wchar.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/include/wchar.h 2018-11-14 22:26:13.000000000 +0000 @@ -126,7 +126,7 @@ #if __POSIX_VISIBLE >= 200809 wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict); -wchar_t *wcsdup (const wchar_t *); +wchar_t *wcsdup (const wchar_t *) __malloc_like __result_use_check; #endif wchar_t *_wcsdup_r (struct _reent *, const wchar_t * ); size_t wcscspn (const wchar_t *, const wchar_t *); diff -Nru libnewlib-nano-2.10.0/newlib/libc/locale/lmonetary.c libnewlib-nano-2.11.2/newlib/libc/locale/lmonetary.c --- libnewlib-nano-2.10.0/newlib/libc/locale/lmonetary.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/locale/lmonetary.c 2018-11-14 22:26:13.000000000 +0000 @@ -71,6 +71,8 @@ #endif }; +#ifdef __HAVE_LOCALE_INFO__ + #ifndef __CYGWIN__ static struct lc_monetary_T _monetary_locale; static int _monetary_using_locale; @@ -131,3 +133,5 @@ #endif return ret; } + +#endif diff -Nru libnewlib-nano-2.10.0/newlib/libc/locale/lnumeric.c libnewlib-nano-2.11.2/newlib/libc/locale/lnumeric.c --- libnewlib-nano-2.10.0/newlib/libc/locale/lnumeric.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/locale/lnumeric.c 2018-11-14 22:26:13.000000000 +0000 @@ -41,6 +41,7 @@ #endif }; +#if __HAVE_LOCALE_INFO__ int __numeric_load_locale (struct __locale_t *locale, const char *name , void *f_wctomb, const char *charset) @@ -87,3 +88,4 @@ #endif return ret; } +#endif diff -Nru libnewlib-nano-2.10.0/newlib/libc/locale/locale.c libnewlib-nano-2.11.2/newlib/libc/locale/locale.c --- libnewlib-nano-2.10.0/newlib/libc/locale/locale.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/locale/locale.c 2018-11-14 22:26:13.000000000 +0000 @@ -310,7 +310,7 @@ if (category < LC_ALL || category >= _LC_LAST) { - p->_errno = EINVAL; + __errno_r(p) = EINVAL; return NULL; } @@ -336,7 +336,7 @@ env = __get_locale_env (p, i); if (strlen (env) > ENCODING_LEN) { - p->_errno = EINVAL; + __errno_r(p) = EINVAL; return NULL; } strcpy (new_categories[i], env); @@ -347,7 +347,7 @@ env = __get_locale_env (p, category); if (strlen (env) > ENCODING_LEN) { - p->_errno = EINVAL; + __errno_r(p) = EINVAL; return NULL; } strcpy (new_categories[category], env); @@ -357,7 +357,7 @@ { if (strlen (locale) > ENCODING_LEN) { - p->_errno = EINVAL; + __errno_r(p) = EINVAL; return NULL; } strcpy (new_categories[category], locale); @@ -368,7 +368,7 @@ { if (strlen (locale) > ENCODING_LEN) { - p->_errno = EINVAL; + __errno_r(p) = EINVAL; return NULL; } for (i = 1; i < _LC_LAST; ++i) @@ -380,7 +380,7 @@ ; if (!r[1]) { - p->_errno = EINVAL; + __errno_r(p) = EINVAL; return NULL; /* Hmm, just slashes... */ } do @@ -389,7 +389,7 @@ break; /* Too many slashes... */ if ((len = r - locale) > ENCODING_LEN) { - p->_errno = EINVAL; + __errno_r(p) = EINVAL; return NULL; } strlcpy (new_categories[i], locale, len + 1); @@ -418,7 +418,7 @@ strcpy (saved_categories[i], __get_global_locale ()->categories[i]); if (__loadlocale (__get_global_locale (), i, new_categories[i]) == NULL) { - saverr = p->_errno; + saverr = __errno_r(p); for (j = 1; j < i; j++) { strcpy (new_categories[j], saved_categories[j]); @@ -429,7 +429,7 @@ __loadlocale (__get_global_locale (), j, new_categories[j]); } } - p->_errno = saverr; + __errno_r(p) = saverr; return NULL; } } @@ -463,7 +463,7 @@ extern void __set_ctype (struct __locale_t *, const char *charset); char * -__loadlocale (struct __locale_t *loc, int category, const char *new_locale) +__loadlocale (struct __locale_t *loc, int category, char *new_locale) { /* At this point a full-featured system would just load the locale specific data from the locale files. @@ -506,7 +506,7 @@ restart: if (!locale) - locale = (char *) new_locale; + locale = new_locale; else if (locale != tmp_locale) { locale = __set_locale_from_locale_alias (locale, tmp_locale); @@ -981,6 +981,7 @@ #endif } +#ifdef __HAVE_LOCALE_INFO__ const char * __locale_ctype_ptr_l (struct __locale_t *locale) { @@ -992,6 +993,7 @@ { return __get_current_locale ()->ctype_ptr; } +#endif /* __HAVE_LOCALE_INFO__ */ #ifndef _REENT_ONLY diff -Nru libnewlib-nano-2.10.0/newlib/libc/locale/meson.build libnewlib-nano-2.11.2/newlib/libc/locale/meson.build --- libnewlib-nano-2.10.0/newlib/libc/locale/meson.build 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/locale/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -1,17 +1,25 @@ srcs_locale = [ + 'locale.c', + 'localeconv.c', + 'lnumeric.c', +] + +srcs_locale_elix2 = [ 'duplocale.c', 'freelocale.c', 'lctype.c', 'lmessages.c', 'lmonetary.c', - 'lnumeric.c', - 'locale.c', - 'localeconv.c', 'newlocale.c', 'nl_langinfo.c', 'timelocal.c', 'uselocale.c', ] + +if newlib_elix_level >= 2 and newlib_locale_info + srcs_locale += srcs_locale_elix2 +endif + hdrs_locale = [ 'setlocale.h', ] diff -Nru libnewlib-nano-2.10.0/newlib/libc/locale/newlocale.c libnewlib-nano-2.11.2/newlib/libc/locale/newlocale.c --- libnewlib-nano-2.10.0/newlib/libc/locale/newlocale.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/locale/newlocale.c 2018-11-14 22:26:13.000000000 +0000 @@ -103,7 +103,7 @@ /* Check for invalid mask values and valid locale ptr. */ if ((category_mask & ~LC_VALID_MASK) || !locale) { - p->_errno = EINVAL; + __errno_r(p) = EINVAL; return NULL; } /* If the new locale is supposed to be all default locale, just return @@ -125,7 +125,7 @@ : locale; if (strlen (cat) > ENCODING_LEN) { - p->_errno = EINVAL; + __errno_r(p) = EINVAL; return NULL; } strcpy (new_categories[i], cat); diff -Nru libnewlib-nano-2.10.0/newlib/libc/locale/setlocale.h libnewlib-nano-2.11.2/newlib/libc/locale/setlocale.h --- libnewlib-nano-2.10.0/newlib/libc/locale/setlocale.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/locale/setlocale.h 2018-11-14 22:26:13.000000000 +0000 @@ -195,7 +195,7 @@ }; #ifdef _MB_CAPABLE -extern char *__loadlocale (struct __locale_t *, int, const char *); +extern char *__loadlocale (struct __locale_t *, int, char *); extern const char *__get_locale_env(struct _reent *, int); #endif /* _MB_CAPABLE */ @@ -217,7 +217,11 @@ _ELIDABLE_INLINE struct __locale_t * __get_locale_r (struct _reent *r) { +#ifdef __HAVE_LOCALE_INFO__ return r->_locale; +#else + return __get_global_locale(); +#endif } /* In POSIX terms the current locale is the locale used by all functions @@ -227,7 +231,11 @@ _ELIDABLE_INLINE struct __locale_t * __get_current_locale (void) { +#ifdef __HAVE_LOCALE_INFO__ return _REENT->_locale ?: __get_global_locale (); +#else + return __get_global_locale(); +#endif } /* Only access fixed "C" locale using this function. Fake for !_MB_CAPABLE diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/a29k/configure libnewlib-nano-2.11.2/newlib/libc/machine/a29k/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/a29k/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/a29k/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/aarch64/configure libnewlib-nano-2.11.2/newlib/libc/machine/aarch64/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/aarch64/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/aarch64/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/aarch64/memset.S libnewlib-nano-2.11.2/newlib/libc/machine/aarch64/memset.S --- libnewlib-nano-2.10.0/newlib/libc/machine/aarch64/memset.S 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/aarch64/memset.S 2018-11-14 22:26:13.000000000 +0000 @@ -142,10 +142,10 @@ b.eq L(try_zva) L(no_zva): sub count, dstend, dst /* Count is 16 too large. */ - add dst, dst, 16 + sub dst, dst, 16 /* Dst is biased by -32. */ sub count, count, 64 + 16 /* Adjust count and bias for loop. */ -1: stp q0, q0, [dst], 64 - stp q0, q0, [dst, -32] +1: stp q0, q0, [dst, 32] + stp q0, q0, [dst, 64]! L(tail64): subs count, count, 64 b.hi 1b diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/arc/configure libnewlib-nano-2.11.2/newlib/libc/machine/arc/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/arc/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/arc/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/arm/configure libnewlib-nano-2.11.2/newlib/libc/machine/arm/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/arm/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/arm/configure 2018-11-14 22:26:13.000000000 +0000 @@ -690,6 +690,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1326,6 +1327,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2490,6 +2492,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3336,8 +3350,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/arm/meson.build libnewlib-nano-2.11.2/newlib/libc/machine/arm/meson.build --- libnewlib-nano-2.10.0/newlib/libc/machine/arm/meson.build 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/arm/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,28 @@ +srcs_machine = [ + 'setjmp.S', + 'strcmp.S', + 'strcpy.c', + 'aeabi_memcpy.c', + 'aeabi_memcpy-armv7a.S', + 'aeabi_memmove.c', + 'aeabi_memmove-soft.S', + 'aeabi_memset.c', + 'aeabi_memset-soft.S', + 'aeabi_memclr.c', + 'memchr-stub.c', + 'memchr.S', + 'memcpy-stub.c', + 'memcpy.S', + 'strlen-stub.c', + 'strlen.S', +] + +foreach target : targets + value = get_variable('target_' + target) + set_variable('lib_machine' + target, + static_library('machine' + target, + srcs_machine, + pic: false, + include_directories: inc, + c_args: value[1] + ['-fno-builtin'])) +endforeach diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/bfin/configure libnewlib-nano-2.11.2/newlib/libc/machine/bfin/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/bfin/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/bfin/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/configure libnewlib-nano-2.11.2/newlib/libc/machine/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/configure 2018-11-14 22:26:13.000000000 +0000 @@ -764,6 +764,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1467,6 +1468,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2874,6 +2876,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3720,8 +3734,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11490,7 +11502,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11493 "configure" +#line 11505 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11596,7 +11608,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11599 "configure" +#line 11611 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/cr16/configure libnewlib-nano-2.11.2/newlib/libc/machine/cr16/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/cr16/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/cr16/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/cris/configure libnewlib-nano-2.11.2/newlib/libc/machine/cris/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/cris/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/cris/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/cris/memcpy.c libnewlib-nano-2.11.2/newlib/libc/machine/cris/memcpy.c --- libnewlib-nano-2.10.0/newlib/libc/machine/cris/memcpy.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/cris/memcpy.c 2018-11-14 22:26:13.000000000 +0000 @@ -31,6 +31,7 @@ than what we describe. An assembly file should be used instead. */ #include +#include "../../string/local.h" /* Break even between movem and move16 is really at 38.7 * 2, but modulo 44, so up to the next multiple of 44, we use ordinary code. */ @@ -40,6 +41,7 @@ __asm__ (".syntax no_register_prefix"); void * +__inhibit_loop_to_libcall memcpy(void *__restrict pdst, const void *__restrict psrc, size_t pn) { /* Now we want the parameters put in special registers. diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/crx/configure libnewlib-nano-2.11.2/newlib/libc/machine/crx/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/crx/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/crx/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/d10v/configure libnewlib-nano-2.11.2/newlib/libc/machine/d10v/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/d10v/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/d10v/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/d30v/configure libnewlib-nano-2.11.2/newlib/libc/machine/d30v/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/d30v/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/d30v/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/epiphany/configure libnewlib-nano-2.11.2/newlib/libc/machine/epiphany/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/epiphany/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/epiphany/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/fr30/configure libnewlib-nano-2.11.2/newlib/libc/machine/fr30/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/fr30/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/fr30/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/frv/configure libnewlib-nano-2.11.2/newlib/libc/machine/frv/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/frv/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/frv/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/ft32/configure libnewlib-nano-2.11.2/newlib/libc/machine/ft32/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/ft32/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/ft32/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/h8300/configure libnewlib-nano-2.11.2/newlib/libc/machine/h8300/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/h8300/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/h8300/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/h8500/configure libnewlib-nano-2.11.2/newlib/libc/machine/h8500/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/h8500/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/h8500/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/hppa/configure libnewlib-nano-2.11.2/newlib/libc/machine/hppa/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/hppa/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/hppa/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/i386/configure libnewlib-nano-2.11.2/newlib/libc/machine/i386/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/i386/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/i386/configure 2018-11-14 22:26:13.000000000 +0000 @@ -762,6 +762,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1410,6 +1411,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2817,6 +2819,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3663,8 +3677,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11433,7 +11445,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11436 "configure" +#line 11448 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11539,7 +11551,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11542 "configure" +#line 11554 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/i960/configure libnewlib-nano-2.11.2/newlib/libc/machine/i960/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/i960/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/i960/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/iq2000/configure libnewlib-nano-2.11.2/newlib/libc/machine/iq2000/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/iq2000/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/iq2000/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/lm32/configure libnewlib-nano-2.11.2/newlib/libc/machine/lm32/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/lm32/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/lm32/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/m32c/configure libnewlib-nano-2.11.2/newlib/libc/machine/m32c/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/m32c/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/m32c/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/m32r/configure libnewlib-nano-2.11.2/newlib/libc/machine/m32r/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/m32r/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/m32r/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/m68hc11/configure libnewlib-nano-2.11.2/newlib/libc/machine/m68hc11/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/m68hc11/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/m68hc11/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/m68k/configure libnewlib-nano-2.11.2/newlib/libc/machine/m68k/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/m68k/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/m68k/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/m88k/configure libnewlib-nano-2.11.2/newlib/libc/machine/m88k/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/m88k/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/m88k/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/mep/configure libnewlib-nano-2.11.2/newlib/libc/machine/mep/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/mep/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/mep/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/microblaze/configure libnewlib-nano-2.11.2/newlib/libc/machine/microblaze/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/microblaze/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/microblaze/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/mips/configure libnewlib-nano-2.11.2/newlib/libc/machine/mips/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/mips/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/mips/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/mn10200/configure libnewlib-nano-2.11.2/newlib/libc/machine/mn10200/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/mn10200/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/mn10200/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/mn10300/configure libnewlib-nano-2.11.2/newlib/libc/machine/mn10300/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/mn10300/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/mn10300/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/moxie/configure libnewlib-nano-2.11.2/newlib/libc/machine/moxie/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/moxie/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/moxie/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/msp430/configure libnewlib-nano-2.11.2/newlib/libc/machine/msp430/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/msp430/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/msp430/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/mt/configure libnewlib-nano-2.11.2/newlib/libc/machine/mt/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/mt/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/mt/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/nds32/configure libnewlib-nano-2.11.2/newlib/libc/machine/nds32/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/nds32/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/nds32/configure 2018-11-14 22:26:13.000000000 +0000 @@ -698,6 +698,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1339,6 +1340,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2510,6 +2512,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3356,8 +3370,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/necv70/configure libnewlib-nano-2.11.2/newlib/libc/machine/necv70/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/necv70/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/necv70/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/nios2/configure libnewlib-nano-2.11.2/newlib/libc/machine/nios2/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/nios2/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/nios2/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/nvptx/configure libnewlib-nano-2.11.2/newlib/libc/machine/nvptx/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/nvptx/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/nvptx/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/or1k/configure libnewlib-nano-2.11.2/newlib/libc/machine/or1k/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/or1k/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/or1k/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/configure libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/configure 2018-11-14 22:26:13.000000000 +0000 @@ -690,6 +690,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1326,6 +1327,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2490,6 +2492,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3336,8 +3350,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtosfix16.c libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtosfix16.c --- libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtosfix16.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtosfix16.c 2018-11-14 22:26:13.000000000 +0000 @@ -108,10 +108,10 @@ { if (isnan (dbl.d)) { - rptr->_errno = EDOM; + __errno_r(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; if (word0(dbl) & Sign_bit) return SHRT_MIN; return SHRT_MAX; @@ -120,12 +120,12 @@ /* check for normal saturation */ if (dbl.d >= 1.0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return SHRT_MAX; } else if (dbl.d < -1.0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return SHRT_MIN; } @@ -152,7 +152,7 @@ /* check if positive saturation has occurred because of rounding */ if (!sign && result < 0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return SHRT_MAX; } } diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtosfix32.c libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtosfix32.c --- libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtosfix32.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtosfix32.c 2018-11-14 22:26:13.000000000 +0000 @@ -29,10 +29,10 @@ { if (isnan (dbl.d)) { - rptr->_errno = EDOM; + __errno_r(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; if (word0(dbl) & Sign_bit) return LONG_MIN; return LONG_MAX; @@ -41,12 +41,12 @@ /* check for normal saturation */ if (dbl.d >= 1.0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return LONG_MAX; } else if (dbl.d < -1.0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return LONG_MIN; } @@ -75,7 +75,7 @@ /* check if positive saturation has occurred because of rounding */ if (!sign && result < 0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return LONG_MAX; } } diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtosfix64.c libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtosfix64.c --- libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtosfix64.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtosfix64.c 2018-11-14 22:26:13.000000000 +0000 @@ -32,10 +32,10 @@ { if (ld_type == 1) { - rptr->_errno = EDOM; + __errno_r(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; if (word0(ldbl) & Sign_bit) return LONG_LONG_MIN; return LONG_LONG_MAX; @@ -63,7 +63,7 @@ { if (exp > 0 || (exp == 0 && tmp != 0x8000000000000000LL)) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return LONG_LONG_MIN; } } @@ -71,7 +71,7 @@ { if (exp >= 0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return LONG_LONG_MAX; } } @@ -88,7 +88,7 @@ /* check if positive saturation has occurred because of rounding */ if (!sign && result < 0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return LONG_LONG_MAX; } } diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtoufix16.c libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtoufix16.c --- libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtoufix16.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtoufix16.c 2018-11-14 22:26:13.000000000 +0000 @@ -106,10 +106,10 @@ { if (isnan (dbl.d)) { - rptr->_errno = EDOM; + __errno_r(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; if (word0(dbl) & Sign_bit) return 0; return USHRT_MAX; @@ -118,12 +118,12 @@ /* check for normal saturation */ if (dbl.d >= 1.0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return USHRT_MAX; } else if (dbl.d < 0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return 0; } @@ -147,7 +147,7 @@ if (negexp == 0) { /* we have overflow which means saturation */ - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return USHRT_MAX; } result |= (1 << (16 - negexp)); diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtoufix32.c libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtoufix32.c --- libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtoufix32.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtoufix32.c 2018-11-14 22:26:13.000000000 +0000 @@ -28,10 +28,10 @@ { if (isnan (dbl.d)) { - rptr->_errno = EDOM; + __errno_r(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; if (word0(dbl) & Sign_bit) return 0; return ULONG_MAX; @@ -40,12 +40,12 @@ /* check for normal saturation */ if (dbl.d >= 1.0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return ULONG_MAX; } else if (dbl.d < 0) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return 0; } @@ -77,7 +77,7 @@ /* if rounding causes carry, then saturation has occurred */ if (result < tmp) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return ULONG_MAX; } } diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtoufix64.c libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtoufix64.c --- libnewlib-nano-2.10.0/newlib/libc/machine/powerpc/strtoufix64.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/powerpc/strtoufix64.c 2018-11-14 22:26:13.000000000 +0000 @@ -31,10 +31,10 @@ { if (ld_type == 1) { - rptr->_errno = EDOM; + __errno_r(rptr) = EDOM; return 0; } - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; if (word0(ldbl) & Sign_bit) return 0; return ULONG_LONG_MAX; @@ -60,14 +60,14 @@ /* check for saturation */ if (sign) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return 0; } else { if (exp > 0 || (exp == 0 && tmp >= 0x8000000000000000LL)) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return ULONG_LONG_MAX; } } @@ -89,7 +89,7 @@ /* if rounding causes carry, then saturation has occurred */ if (result < tmp) { - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; return ULONG_LONG_MAX; } } diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/riscv/configure libnewlib-nano-2.11.2/newlib/libc/machine/riscv/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/riscv/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/riscv/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/riscv/memcpy.c libnewlib-nano-2.11.2/newlib/libc/machine/riscv/memcpy.c --- libnewlib-nano-2.10.0/newlib/libc/machine/riscv/memcpy.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/riscv/memcpy.c 2018-11-14 22:26:13.000000000 +0000 @@ -11,10 +11,12 @@ #include #include +#include "../../string/local.h" #define unlikely(X) __builtin_expect (!!(X), 0) void * +__inhibit_loop_to_libcall memcpy(void *__restrict aa, const void *__restrict bb, size_t n) { #define BODY(a, b, t) { \ diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/rl78/configure libnewlib-nano-2.11.2/newlib/libc/machine/rl78/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/rl78/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/rl78/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/rx/configure libnewlib-nano-2.11.2/newlib/libc/machine/rx/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/rx/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/rx/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/sh/configure libnewlib-nano-2.11.2/newlib/libc/machine/sh/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/sh/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/sh/configure 2018-11-14 22:26:13.000000000 +0000 @@ -702,6 +702,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1344,6 +1345,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2555,6 +2557,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3401,8 +3415,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/sparc/configure libnewlib-nano-2.11.2/newlib/libc/machine/sparc/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/sparc/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/sparc/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/spu/configure libnewlib-nano-2.11.2/newlib/libc/machine/spu/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/spu/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/spu/configure 2018-11-14 22:26:13.000000000 +0000 @@ -691,6 +691,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1327,6 +1328,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2491,6 +2493,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3337,8 +3351,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/spu/memcpy.c libnewlib-nano-2.11.2/newlib/libc/machine/spu/memcpy.c --- libnewlib-nano-2.10.0/newlib/libc/machine/spu/memcpy.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/spu/memcpy.c 2018-11-14 22:26:13.000000000 +0000 @@ -33,6 +33,7 @@ #include #include #include +#include "../../string/local.h" /* Copy n bytes from memory area src to memory area dest. * The memory areas may not overlap. The memcpy subroutine @@ -42,7 +43,9 @@ * either with prior knowledge of the alignment or special * casing specific optimal alignments. */ -void * memcpy(void * __restrict__ dest, const void * __restrict__ src, size_t n) +void * +__inhibit_loop_to_libcall +memcpy(void * __restrict__ dest, const void * __restrict__ src, size_t n) { int adjust, delta; unsigned int soffset1, doffset1, doffset2; diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/spu/memcpy_ea.c libnewlib-nano-2.11.2/newlib/libc/machine/spu/memcpy_ea.c --- libnewlib-nano-2.10.0/newlib/libc/machine/spu/memcpy_ea.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/spu/memcpy_ea.c 2018-11-14 22:26:13.000000000 +0000 @@ -34,10 +34,12 @@ #include "ea_internal.h" #include #include +#include "../../string/local.h" COMPAT_EA_ALIAS (memcpy_ea); __ea void * +__inhibit_loop_to_libcall memcpy_ea (__ea void *dest, __ea const void *src, size_ea_t n) { __ea void *curr_dest = dest; diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/spu/memset_ea.c libnewlib-nano-2.11.2/newlib/libc/machine/spu/memset_ea.c --- libnewlib-nano-2.10.0/newlib/libc/machine/spu/memset_ea.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/spu/memset_ea.c 2018-11-14 22:26:13.000000000 +0000 @@ -34,10 +34,12 @@ #include #include "ea_internal.h" #include +#include "../../string/local.h" COMPAT_EA_ALIAS (memset_ea); __ea void * +__inhibit_loop_to_libcall memset_ea (__ea void *dest, int c, size_ea_t n) { __ea void *curr_dest = dest; diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/spu/stdio.c libnewlib-nano-2.11.2/newlib/libc/machine/spu/stdio.c --- libnewlib-nano-2.10.0/newlib/libc/machine/spu/stdio.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/spu/stdio.c 2018-11-14 22:26:13.000000000 +0000 @@ -47,7 +47,7 @@ return &__fp[i]; } } - d->_errno = EMFILE; + __errno_r(d) = EMFILE; return NULL; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/spu/sys/dirent.h libnewlib-nano-2.11.2/newlib/libc/machine/spu/sys/dirent.h --- libnewlib-nano-2.10.0/newlib/libc/machine/spu/sys/dirent.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/spu/sys/dirent.h 2018-11-14 22:26:13.000000000 +0000 @@ -51,14 +51,6 @@ struct dirent dirent; } DIR; -DIR *opendir(const char *); -int closedir(DIR *); -struct dirent *readdir (DIR *); -int readdir_r (DIR *__restrict, struct dirent *__restrict, - struct dirent **__restrict); -void rewinddir(DIR *); -void seekdir(DIR *dir, off_t offset); -off_t telldir(DIR *dir); #ifdef __cplusplus } #endif diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/tic4x/configure libnewlib-nano-2.11.2/newlib/libc/machine/tic4x/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/tic4x/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/tic4x/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/tic6x/configure libnewlib-nano-2.11.2/newlib/libc/machine/tic6x/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/tic6x/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/tic6x/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/tic80/configure libnewlib-nano-2.11.2/newlib/libc/machine/tic80/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/tic80/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/tic80/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/v850/configure libnewlib-nano-2.11.2/newlib/libc/machine/v850/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/v850/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/v850/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/visium/configure libnewlib-nano-2.11.2/newlib/libc/machine/visium/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/visium/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/visium/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/visium/memcpy.c libnewlib-nano-2.11.2/newlib/libc/machine/visium/memcpy.c --- libnewlib-nano-2.10.0/newlib/libc/machine/visium/memcpy.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/visium/memcpy.c 2018-11-14 22:26:13.000000000 +0000 @@ -31,6 +31,7 @@ #include #include "memcpy.h" +#include "../../string/local.h" #define INST_BARRIER __asm__ __volatile__ ("":::"memory"); @@ -422,6 +423,7 @@ static inline void +__inhibit_loop_to_libcall __int_memcpy (void *__restrict s1, const void *__restrict s2, size_t n) { int value = n; @@ -562,6 +564,7 @@ } static inline void +__inhibit_loop_to_libcall __shrt_int_memcpy (void *__restrict s1, const void *__restrict s2, size_t n) { int value = n; @@ -703,6 +706,7 @@ static inline void +__inhibit_loop_to_libcall __byte_memcpy (void *__restrict s1, const void *__restrict s2, size_t n) { int value = n; @@ -846,6 +850,7 @@ /* Exposed interface. */ void * +__inhibit_loop_to_libcall memcpy (void *__restrict s1, const void *__restrict s2, size_t n) { void *result = s1; diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/visium/memset.c libnewlib-nano-2.11.2/newlib/libc/machine/visium/memset.c --- libnewlib-nano-2.10.0/newlib/libc/machine/visium/memset.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/visium/memset.c 2018-11-14 22:26:13.000000000 +0000 @@ -31,6 +31,7 @@ #include #include "memset.h" +#include "../../string/local.h" #define SET_32_OBJECTS(out) \ do { \ @@ -228,8 +229,8 @@ out += 1; \ } while(0) - static inline void +__inhibit_loop_to_libcall __int_memset (void *__restrict s1, int val, size_t n) { int value = n; @@ -369,6 +370,7 @@ } static inline void +__inhibit_loop_to_libcall __short_int_memset (void *__restrict s1, int val, size_t n) { int value = n; @@ -508,6 +510,7 @@ } static inline void +__inhibit_loop_to_libcall __byte_memset (void *__restrict s1, int val, size_t n) { int value = n; @@ -650,6 +653,7 @@ /* Exposed interface. */ void * +__inhibit_loop_to_libcall memset (void *s, int c, size_t n) { void *result = s; diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/w65/configure libnewlib-nano-2.11.2/newlib/libc/machine/w65/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/w65/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/w65/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/x86_64/configure libnewlib-nano-2.11.2/newlib/libc/machine/x86_64/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/x86_64/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/x86_64/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/x86_64/meson.build libnewlib-nano-2.11.2/newlib/libc/machine/x86_64/meson.build --- libnewlib-nano-2.10.0/newlib/libc/machine/x86_64/meson.build 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/x86_64/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,16 @@ +srcs_machine = [ + 'memcpy.S', + 'memset.S', + 'setjmp.S', + 'x86_64mach.h' +] + +foreach target : targets + value = get_variable('target_' + target) + set_variable('lib_machine' + target, + static_library('machine' + target, + srcs_machine, + pic: false, + include_directories: inc, + c_args: value[1])) +endforeach diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/xc16x/configure libnewlib-nano-2.11.2/newlib/libc/machine/xc16x/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/xc16x/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/xc16x/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/xscale/configure libnewlib-nano-2.11.2/newlib/libc/machine/xscale/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/xscale/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/xscale/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/xscale/memcpy.c libnewlib-nano-2.11.2/newlib/libc/machine/xscale/memcpy.c --- libnewlib-nano-2.10.0/newlib/libc/machine/xscale/memcpy.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/xscale/memcpy.c 2018-11-14 22:26:13.000000000 +0000 @@ -6,8 +6,10 @@ #include #include "xscale.h" +#include "../../string/local.h" void * +__inhibit_loop_to_libcall memcpy (void *__restrict dst0, const void *__restrict src0, size_t len) { int dummy; diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/xscale/memset.c libnewlib-nano-2.11.2/newlib/libc/machine/xscale/memset.c --- libnewlib-nano-2.10.0/newlib/libc/machine/xscale/memset.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/xscale/memset.c 2018-11-14 22:26:13.000000000 +0000 @@ -6,8 +6,10 @@ #include #include "xscale.h" +#include "../../string/local.h" void * +__inhibit_loop_to_libcall memset (void *dst, int c, size_t len) { int dummy; diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/xstormy16/configure libnewlib-nano-2.11.2/newlib/libc/machine/xstormy16/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/xstormy16/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/xstormy16/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/machine/z8k/configure libnewlib-nano-2.11.2/newlib/libc/machine/z8k/configure --- libnewlib-nano-2.10.0/newlib/libc/machine/z8k/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/machine/z8k/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/meson.build libnewlib-nano-2.11.2/newlib/libc/meson.build --- libnewlib-nano-2.10.0/newlib/libc/meson.build 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -1,13 +1,96 @@ subdir('include') +machine_dirs = { + 'a29k': 'a29k', + 'aarch64': 'aarch64', + 'arc': 'arc', + 'arm': 'arm', + 'bfin': 'bfin', + 'cr16': 'cr16', + 'cris': 'cris', + 'crisv32': 'cris', + 'crx': 'crx', + 'd10v': 'd10v', + 'd30v': 'd30v', + 'epiphany': 'epiphany', + 'fido': 'm68k', + 'fr30': 'fr30', + 'frv': 'frv', + 'ft32': 'ft32', + 'h8300': 'h8300', + 'h8500': 'h8500', + 'hppa': 'hppa', + 'i960': 'i960', + 'i386': 'i386', + 'i486': 'i386', + 'i586': 'i386', + 'i686': 'i386', + 'iq2000': 'iq2000', + 'lm32': 'lm32', + 'm32c': 'm32c', + 'm32r': 'm32r', + 'm6811': 'm68hc11', + 'm6812': 'm68hc11', + 'm68hc11': 'm68hc11', + 'm68hc12': 'm68hc11', + 'm68k': 'm68k', + 'm88k': 'm88k', + 'm88110': 'm88k', + 'microblaze': 'microblaze', + 'mep': 'mep', + 'mips': 'mips', + 'mn10200': 'mn10200', + 'mn10300': 'mn10300', + 'moxie': 'moxie', + 'msp430': 'msp430', + 'mt': 'mt', + 'nds32': 'nds32', + 'nios2': 'nios2', + 'nvptx': 'nvptx', + 'or1k': 'or1k', + 'or1knd': 'or1k', + 'powerpc': 'powerpc', + 'riscv': 'riscv', + 'rl78': 'rl78', + 'rx': 'rx', + 'sh': 'sh', + 'sh64': 'sh', + 'sparc': 'sparc', + 'c4x': 'tic4x', + 'tic4x': 'tic4x', + 'tic6x': 'tic6x', + 'tic80': 'tic80', + 'v850': 'v850', + 'visium': 'visium', + 'w65': 'w65', + 'x86_64': 'x86_64', + 'xc16x': 'xc16x', + 'xstormy16': 'xstormy16', + 'z8k': 'z8k', + 'spu': 'spu', + } + libdirs = ['argz', 'ctype', 'errno', 'iconv', 'misc', 'search', 'signal', 'ssp', 'stdlib', 'string', 'time', - 'xdr'] + 'xdr', 'locale'] if newlib_tinystdio libdirs += 'tinystdio' else - libdirs += 'stdio' + libdirs += ['stdio', 'reent' ] +endif + +if newlib_supplied_syscalls + lib_dirs += 'syscalls' +endif + +libnames = libdirs + +if machine_dirs.has_key(host_cpu) + libdirs = [join_paths('machine', machine_dirs[host_cpu])] + libdirs + libnames = ['machine'] + libnames +else + warning('No libc machine directory for cpu ' + host_cpu) endif foreach libdir : libdirs @@ -18,14 +101,12 @@ value = get_variable('target_' + target) libobjs = [] - foreach libdir : libdirs - libobjs += get_variable('lib_' + libdir + target).extract_all_objects(recursive:true) + foreach libname : libnames + libobjs += get_variable('lib_' + libname + target).extract_all_objects(recursive:true) endforeach instdir = join_paths(get_option('libdir'), value[0]) - message(instdir) - if target == '' libc_name = 'c' else diff -Nru libnewlib-nano-2.10.0/newlib/libc/posix/dirfd.c libnewlib-nano-2.11.2/newlib/libc/posix/dirfd.c --- libnewlib-nano-2.10.0/newlib/libc/posix/dirfd.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/posix/dirfd.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,38 @@ +#ifndef HAVE_OPENDIR + +/*- + * Copyright (c) 2018 embedded brains GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +int +dirfd(DIR *dirp) +{ + + return (__dirfd(dirp)); +} + +#endif /* ! HAVE_OPENDIR */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/posix/Makefile.am libnewlib-nano-2.11.2/newlib/libc/posix/Makefile.am --- libnewlib-nano-2.10.0/newlib/libc/posix/Makefile.am 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/posix/Makefile.am 2018-11-14 22:26:13.000000000 +0000 @@ -5,7 +5,7 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) GENERAL_SOURCES = \ - closedir.c collate.c collcmp.c creat.c \ + closedir.c collate.c collcmp.c creat.c dirfd.c \ fnmatch.c glob.c _isatty.c isatty.c \ opendir.c readdir.c readdir_r.c \ regcomp.c regerror.c regexec.c regfree.c \ diff -Nru libnewlib-nano-2.10.0/newlib/libc/posix/Makefile.in libnewlib-nano-2.11.2/newlib/libc/posix/Makefile.in --- libnewlib-nano-2.10.0/newlib/libc/posix/Makefile.in 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/posix/Makefile.in 2018-11-14 22:26:13.000000000 +0000 @@ -74,14 +74,14 @@ lib_a_LIBADD = am__objects_1 = lib_a-closedir.$(OBJEXT) lib_a-collate.$(OBJEXT) \ lib_a-collcmp.$(OBJEXT) lib_a-creat.$(OBJEXT) \ - lib_a-fnmatch.$(OBJEXT) lib_a-glob.$(OBJEXT) \ - lib_a-_isatty.$(OBJEXT) lib_a-isatty.$(OBJEXT) \ - lib_a-opendir.$(OBJEXT) lib_a-readdir.$(OBJEXT) \ - lib_a-readdir_r.$(OBJEXT) lib_a-regcomp.$(OBJEXT) \ - lib_a-regerror.$(OBJEXT) lib_a-regexec.$(OBJEXT) \ - lib_a-regfree.$(OBJEXT) lib_a-rewinddir.$(OBJEXT) \ - lib_a-sleep.$(OBJEXT) lib_a-usleep.$(OBJEXT) \ - lib_a-telldir.$(OBJEXT) + lib_a-dirfd.$(OBJEXT) lib_a-fnmatch.$(OBJEXT) \ + lib_a-glob.$(OBJEXT) lib_a-_isatty.$(OBJEXT) \ + lib_a-isatty.$(OBJEXT) lib_a-opendir.$(OBJEXT) \ + lib_a-readdir.$(OBJEXT) lib_a-readdir_r.$(OBJEXT) \ + lib_a-regcomp.$(OBJEXT) lib_a-regerror.$(OBJEXT) \ + lib_a-regexec.$(OBJEXT) lib_a-regfree.$(OBJEXT) \ + lib_a-rewinddir.$(OBJEXT) lib_a-sleep.$(OBJEXT) \ + lib_a-usleep.$(OBJEXT) lib_a-telldir.$(OBJEXT) am__objects_2 = lib_a-scandir.$(OBJEXT) lib_a-seekdir.$(OBJEXT) am__objects_3 = lib_a-execl.$(OBJEXT) lib_a-execle.$(OBJEXT) \ lib_a-execlp.$(OBJEXT) lib_a-execv.$(OBJEXT) \ @@ -100,8 +100,8 @@ lib_a_OBJECTS = $(am_lib_a_OBJECTS) LTLIBRARIES = $(noinst_LTLIBRARIES) libposix_la_LIBADD = -am__objects_6 = closedir.lo collate.lo collcmp.lo creat.lo fnmatch.lo \ - glob.lo _isatty.lo isatty.lo opendir.lo readdir.lo \ +am__objects_6 = closedir.lo collate.lo collcmp.lo creat.lo dirfd.lo \ + fnmatch.lo glob.lo _isatty.lo isatty.lo opendir.lo readdir.lo \ readdir_r.lo regcomp.lo regerror.lo regexec.lo regfree.lo \ rewinddir.lo sleep.lo usleep.lo telldir.lo am__objects_7 = scandir.lo seekdir.lo @@ -290,7 +290,7 @@ AUTOMAKE_OPTIONS = cygnus INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) GENERAL_SOURCES = \ - closedir.c collate.c collcmp.c creat.c \ + closedir.c collate.c collcmp.c creat.c dirfd.c \ fnmatch.c glob.c _isatty.c isatty.c \ opendir.c readdir.c readdir_r.c \ regcomp.c regerror.c regexec.c regfree.c \ @@ -428,6 +428,12 @@ lib_a-creat.obj: creat.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-creat.obj `if test -f 'creat.c'; then $(CYGPATH_W) 'creat.c'; else $(CYGPATH_W) '$(srcdir)/creat.c'; fi` +lib_a-dirfd.o: dirfd.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-dirfd.o `test -f 'dirfd.c' || echo '$(srcdir)/'`dirfd.c + +lib_a-dirfd.obj: dirfd.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-dirfd.obj `if test -f 'dirfd.c'; then $(CYGPATH_W) 'dirfd.c'; else $(CYGPATH_W) '$(srcdir)/dirfd.c'; fi` + lib_a-fnmatch.o: fnmatch.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fnmatch.o `test -f 'fnmatch.c' || echo '$(srcdir)/'`fnmatch.c diff -Nru libnewlib-nano-2.10.0/newlib/libc/posix/opendir.c libnewlib-nano-2.11.2/newlib/libc/posix/opendir.c --- libnewlib-nano-2.10.0/newlib/libc/posix/opendir.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/posix/opendir.c 2018-11-14 22:26:13.000000000 +0000 @@ -43,23 +43,12 @@ #include #include -/* - * open a directory. - */ -DIR * -opendir (const char *name) +static DIR * +_opendir_common(int fd) { - register DIR *dirp; - register int fd; - int rc = 0; + DIR *dirp; - if ((fd = open(name, 0)) == -1) - return NULL; -#ifdef HAVE_FCNTL - rc = fcntl(fd, F_SETFD, 1); -#endif - if (rc == -1 || - (dirp = (DIR *)malloc(sizeof(DIR))) == NULL) { + if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) { close (fd); return NULL; } @@ -92,4 +81,23 @@ return dirp; } +DIR * +opendir(const char *name) +{ + int fd; + + if ((fd = open(name, O_RDONLY | O_DIRECTORY | O_CLOEXEC)) == -1) + return (NULL); + return (_opendir_common(fd)); +} + +DIR * +fdopendir(int fd) +{ + + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) + return (NULL); + return (_opendir_common(fd)); +} + #endif /* ! HAVE_OPENDIR */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/closer.c libnewlib-nano-2.11.2/newlib/libc/reent/closer.c --- libnewlib-nano-2.10.0/newlib/libc/reent/closer.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/closer.c 2018-11-14 22:26:13.000000000 +0000 @@ -45,7 +45,7 @@ errno = 0; if ((ret = _close (fd)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/execr.c libnewlib-nano-2.11.2/newlib/libc/reent/execr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/execr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/execr.c 2018-11-14 22:26:13.000000000 +0000 @@ -54,7 +54,7 @@ errno = 0; if ((ret = _execve (name, argv, env)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } @@ -86,7 +86,7 @@ errno = 0; if ((ret = _fork ()) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } @@ -118,7 +118,7 @@ errno = 0; if ((ret = _wait (status)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/fcntlr.c libnewlib-nano-2.11.2/newlib/libc/reent/fcntlr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/fcntlr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/fcntlr.c 2018-11-14 22:26:13.000000000 +0000 @@ -49,7 +49,7 @@ errno = 0; if ((ret = _fcntl (fd, cmd, arg)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/fstat64r.c libnewlib-nano-2.11.2/newlib/libc/reent/fstat64r.c --- libnewlib-nano-2.10.0/newlib/libc/reent/fstat64r.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/fstat64r.c 2018-11-14 22:26:13.000000000 +0000 @@ -55,7 +55,7 @@ errno = 0; if ((ret = _fstat64 (fd, pstat)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/fstatr.c libnewlib-nano-2.11.2/newlib/libc/reent/fstatr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/fstatr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/fstatr.c 2018-11-14 22:26:13.000000000 +0000 @@ -53,7 +53,7 @@ errno = 0; if ((ret = _fstat (fd, pstat)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/gettimeofdayr.c libnewlib-nano-2.11.2/newlib/libc/reent/gettimeofdayr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/gettimeofdayr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/gettimeofdayr.c 2018-11-14 22:26:13.000000000 +0000 @@ -60,7 +60,7 @@ errno = 0; if ((ret = _gettimeofday (ptimeval, ptimezone)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/isattyr.c libnewlib-nano-2.11.2/newlib/libc/reent/isattyr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/isattyr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/isattyr.c 2018-11-14 22:26:13.000000000 +0000 @@ -50,7 +50,7 @@ errno = 0; if ((ret = _isatty (fd)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/linkr.c libnewlib-nano-2.11.2/newlib/libc/reent/linkr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/linkr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/linkr.c 2018-11-14 22:26:13.000000000 +0000 @@ -51,7 +51,7 @@ errno = 0; if ((ret = _link (old, new)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/lseek64r.c libnewlib-nano-2.11.2/newlib/libc/reent/lseek64r.c --- libnewlib-nano-2.10.0/newlib/libc/reent/lseek64r.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/lseek64r.c 2018-11-14 22:26:13.000000000 +0000 @@ -50,7 +50,7 @@ errno = 0; if ((ret = _lseek64 (fd, pos, whence)) == (_off64_t) -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/lseekr.c libnewlib-nano-2.11.2/newlib/libc/reent/lseekr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/lseekr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/lseekr.c 2018-11-14 22:26:13.000000000 +0000 @@ -47,7 +47,7 @@ errno = 0; if ((ret = _lseek (fd, pos, whence)) == (_off_t) -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/mkdirr.c libnewlib-nano-2.11.2/newlib/libc/reent/mkdirr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/mkdirr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/mkdirr.c 2018-11-14 22:26:13.000000000 +0000 @@ -48,7 +48,7 @@ errno = 0; if ((ret = _mkdir (path, mode)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/open64r.c libnewlib-nano-2.11.2/newlib/libc/reent/open64r.c --- libnewlib-nano-2.10.0/newlib/libc/reent/open64r.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/open64r.c 2018-11-14 22:26:13.000000000 +0000 @@ -52,7 +52,7 @@ errno = 0; if ((ret = _open64 (file, flags, mode)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/openr.c libnewlib-nano-2.11.2/newlib/libc/reent/openr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/openr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/openr.c 2018-11-14 22:26:13.000000000 +0000 @@ -48,7 +48,7 @@ errno = 0; if ((ret = _open (file, flags, mode)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/readr.c libnewlib-nano-2.11.2/newlib/libc/reent/readr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/readr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/readr.c 2018-11-14 22:26:13.000000000 +0000 @@ -47,7 +47,7 @@ errno = 0; if ((ret = (_ssize_t)_read (fd, buf, cnt)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/renamer.c libnewlib-nano-2.11.2/newlib/libc/reent/renamer.c --- libnewlib-nano-2.10.0/newlib/libc/reent/renamer.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/renamer.c 2018-11-14 22:26:13.000000000 +0000 @@ -49,7 +49,7 @@ #ifdef HAVE_RENAME errno = 0; if ((ret = _rename (old, new)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; #else if (_link_r (ptr, old, new) == -1) return -1; diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/sbrkr.c libnewlib-nano-2.11.2/newlib/libc/reent/sbrkr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/sbrkr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/sbrkr.c 2018-11-14 22:26:13.000000000 +0000 @@ -49,7 +49,7 @@ errno = 0; if ((ret = (char *)(_sbrk (incr))) == (void *) -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/signalr.c libnewlib-nano-2.11.2/newlib/libc/reent/signalr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/signalr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/signalr.c 2018-11-14 22:26:13.000000000 +0000 @@ -51,7 +51,7 @@ errno = 0; if ((ret = _kill (pid, sig)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/stat64r.c libnewlib-nano-2.11.2/newlib/libc/reent/stat64r.c --- libnewlib-nano-2.10.0/newlib/libc/reent/stat64r.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/stat64r.c 2018-11-14 22:26:13.000000000 +0000 @@ -53,7 +53,7 @@ errno = 0; if ((ret = _stat64 (file, pstat)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/statr.c libnewlib-nano-2.11.2/newlib/libc/reent/statr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/statr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/statr.c 2018-11-14 22:26:13.000000000 +0000 @@ -53,7 +53,7 @@ errno = 0; if ((ret = _stat (file, pstat)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/unlinkr.c libnewlib-nano-2.11.2/newlib/libc/reent/unlinkr.c --- libnewlib-nano-2.10.0/newlib/libc/reent/unlinkr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/unlinkr.c 2018-11-14 22:26:13.000000000 +0000 @@ -45,7 +45,7 @@ errno = 0; if ((ret = _unlink (file)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/reent/writer.c libnewlib-nano-2.11.2/newlib/libc/reent/writer.c --- libnewlib-nano-2.10.0/newlib/libc/reent/writer.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/reent/writer.c 2018-11-14 22:26:13.000000000 +0000 @@ -47,7 +47,7 @@ errno = 0; if ((ret = (_ssize_t)_write (fd, buf, cnt)) == -1 && errno != 0) - ptr->_errno = errno; + __errno_r(ptr) = errno; return ret; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/search/hash_buf.c libnewlib-nano-2.11.2/newlib/libc/search/hash_buf.c --- libnewlib-nano-2.10.0/newlib/libc/search/hash_buf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/search/hash_buf.c 2018-11-14 22:26:13.000000000 +0000 @@ -151,7 +151,7 @@ return (NULL); if (!prev_bp) segp[segment_ndx] = - (BUFHEAD *)((ptrdiff_t)bp | is_disk_mask); + (BUFHEAD *)((ptrdiff_t)bp | (intptr_t)is_disk_mask); } else { BUF_REMOVE(bp); MRU_INSERT(bp); diff -Nru libnewlib-nano-2.10.0/newlib/libc/search/hash.c libnewlib-nano-2.11.2/newlib/libc/search/hash.c --- libnewlib-nano-2.10.0/newlib/libc/search/hash.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/search/hash.c 2018-11-14 22:26:13.000000000 +0000 @@ -193,6 +193,9 @@ RETURN_ERROR(EFTYPE, error1); if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY) RETURN_ERROR(EFTYPE, error1); + /* Check bucket size isn't too big for target int. */ + if (hashp->BSIZE > INT_MAX) + RETURN_ERROR(EFTYPE, error1); /* * Figure out how many segments we need. Max_Bucket is the * maximum bucket number, so the number of buckets is @@ -343,7 +346,7 @@ if (stat(file, &statbuf)) #endif return (NULL); - hashp->BSIZE = statbuf.st_blksize; + hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE); hashp->BSHIFT = __log2(hashp->BSIZE); } diff -Nru libnewlib-nano-2.10.0/newlib/libc/search/hash.h libnewlib-nano-2.11.2/newlib/libc/search/hash.h --- libnewlib-nano-2.10.0/newlib/libc/search/hash.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/search/hash.h 2018-11-14 22:26:13.000000000 +0000 @@ -40,6 +40,7 @@ #include #define __need_size_t #include +#include /* Check that newlib understands the byte order of its target system. */ #ifndef BYTE_ORDER @@ -82,28 +83,28 @@ /* Hash Table Information */ typedef struct hashhdr { /* Disk resident portion */ - int magic; /* Magic NO for hash tables */ - int version; /* Version ID */ + int32_t magic; /* Magic NO for hash tables */ + int32_t version; /* Version ID */ __uint32_t lorder; /* Byte Order */ - int bsize; /* Bucket/Page Size */ - int bshift; /* Bucket shift */ - int dsize; /* Directory Size */ - int ssize; /* Segment Size */ - int sshift; /* Segment shift */ - int ovfl_point; /* Where overflow pages are being + int32_t bsize; /* Bucket/Page Size */ + int32_t bshift; /* Bucket shift */ + int32_t dsize; /* Directory Size */ + int32_t ssize; /* Segment Size */ + int32_t sshift; /* Segment shift */ + int32_t ovfl_point; /* Where overflow pages are being * allocated */ - int last_freed; /* Last overflow page freed */ - int max_bucket; /* ID of Maximum bucket in use */ - int high_mask; /* Mask to modulo into entire table */ - int low_mask; /* Mask to modulo into lower half of + int32_t last_freed; /* Last overflow page freed */ + int32_t max_bucket; /* ID of Maximum bucket in use */ + int32_t high_mask; /* Mask to modulo into entire table */ + int32_t low_mask; /* Mask to modulo into lower half of * table */ - int ffactor; /* Fill factor */ - int nkeys; /* Number of keys in hash table */ - int hdrpages; /* Size of table header */ - int h_charkey; /* value of hash(CHARKEY) */ + int32_t ffactor; /* Fill factor */ + int32_t nkeys; /* Number of keys in hash table */ + int32_t hdrpages; /* Size of table header */ + int32_t h_charkey; /* value of hash(CHARKEY) */ #define NCACHED 32 /* number of bit maps and spare * points */ - int spares[NCACHED];/* spare pages for overflow */ + int32_t spares[NCACHED];/* spare pages for overflow */ __uint16_t bitmaps[NCACHED]; /* address of overflow page * bitmaps */ } HASHHDR; @@ -120,7 +121,7 @@ char *tmp_buf; /* Temporary Buffer for BIG data */ char *tmp_key; /* Temporary Buffer for BIG keys */ BUFHEAD *cpage; /* Current page */ - int cbucket; /* Current bucket */ + int32_t cbucket; /* Current bucket */ int cndx; /* Index of next item on cpage */ int error; /* Error Number -- for DBM * compatibility */ @@ -140,10 +141,18 @@ /* * Constants */ +#if INT_MAX == 32767 +#define MAX_BSIZE 4096 +#else #define MAX_BSIZE 65536 /* 2^16 */ +#endif #define MIN_BUFFERS 6 #define MINHDRSIZE 512 +#if INT_MAX == 32767 +#define DEF_BUFSIZE 4096 +#else #define DEF_BUFSIZE 65536 /* 64 K */ +#endif #define DEF_BUCKET_SIZE 4096 #define DEF_BUCKET_SHIFT 12 /* log2(BUCKET) */ #define DEF_SEGSIZE 256 diff -Nru libnewlib-nano-2.10.0/newlib/libc/signal/signal.c libnewlib-nano-2.11.2/newlib/libc/signal/signal.c --- libnewlib-nano-2.10.0/newlib/libc/signal/signal.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/signal/signal.c 2018-11-14 22:26:13.000000000 +0000 @@ -115,7 +115,7 @@ if (sig < 0 || sig >= NSIG) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; return SIG_ERR; } @@ -136,7 +136,7 @@ if (sig < 0 || sig >= NSIG) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; return -1; } @@ -151,7 +151,7 @@ return 0; else if (func == SIG_ERR) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; return 1; } else diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/asniprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/asniprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/asniprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/asniprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -42,7 +42,7 @@ for _size. */ if (len > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return NULL; } f._bf._size = f._w = len; @@ -88,7 +88,7 @@ for _size. */ if (len > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return NULL; } f._bf._size = f._w = len; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/asnprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/asnprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/asnprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/asnprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -42,7 +42,7 @@ for _size. */ if (len > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return NULL; } f._bf._size = f._w = len; @@ -94,7 +94,7 @@ for _size. */ if (len > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return NULL; } f._bf._size = f._w = len; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/fdopen.c libnewlib-nano-2.11.2/newlib/libc/stdio/fdopen.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/fdopen.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/fdopen.c 2018-11-14 22:26:13.000000000 +0000 @@ -73,7 +73,7 @@ fdmode = fdflags & O_ACCMODE; if (fdmode != O_RDWR && (fdmode != (oflags & O_ACCMODE))) { - ptr->_errno = EBADF; + __errno_r(ptr) = EBADF; return 0; } #endif diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/fflush.c libnewlib-nano-2.11.2/newlib/libc/stdio/fflush.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/fflush.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/fflush.c 2018-11-14 22:26:13.000000000 +0000 @@ -137,8 +137,8 @@ /* Save last errno and set errno to 0, so we can check if a device returns with a valid position -1. We restore the last errno if no other error condition has been encountered. */ - tmp_errno = ptr->_errno; - ptr->_errno = 0; + tmp_errno = __errno_r(ptr); + __errno_r(ptr) = 0; /* Get the physical position we are at in the file. */ if (fp->_flags & __SOFF) curoff = fp->_offset; @@ -152,13 +152,13 @@ else #endif curoff = fp->_seek (ptr, fp->_cookie, 0, SEEK_CUR); - if (curoff == -1L && ptr->_errno != 0) + if (curoff == -1L && __errno_r(ptr) != 0) { int result = EOF; - if (ptr->_errno == ESPIPE || ptr->_errno == EINVAL) + if (__errno_r(ptr) == ESPIPE || ptr->_errno == EINVAL) { result = 0; - ptr->_errno = tmp_errno; + __errno_r(ptr) = tmp_errno; } else fp->_flags |= __SERR; @@ -180,8 +180,8 @@ else #endif curoff = fp->_seek (ptr, fp->_cookie, curoff, SEEK_SET); - if (curoff != -1 || ptr->_errno == 0 - || ptr->_errno == ESPIPE || ptr->_errno == EINVAL) + if (curoff != -1 || __errno_r(ptr) == 0 + || __errno_r(ptr) == ESPIPE || ptr->_errno == EINVAL) { /* Seek successful or ignorable error condition. We can clear read buffer now. */ @@ -190,9 +190,9 @@ #endif fp->_r = 0; fp->_p = fp->_bf._base; - if ((fp->_flags & __SOFF) && (curoff != -1 || ptr->_errno == 0)) + if ((fp->_flags & __SOFF) && (curoff != -1 || __errno_r(ptr) == 0)) fp->_offset = curoff; - ptr->_errno = tmp_errno; + __errno_r(ptr) = tmp_errno; if (HASUB (fp)) FREEUB (ptr, fp); } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/fileno.c libnewlib-nano-2.11.2/newlib/libc/stdio/fileno.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/fileno.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/fileno.c 2018-11-14 22:26:13.000000000 +0000 @@ -73,7 +73,7 @@ else { result = -1; - _REENT->_errno = EBADF; + __errno_r(_REENT) = EBADF; } _newlib_flockfile_end (f); return result; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/fileno_u.c libnewlib-nano-2.11.2/newlib/libc/stdio/fileno_u.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/fileno_u.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/fileno_u.c 2018-11-14 22:26:13.000000000 +0000 @@ -39,7 +39,7 @@ else { result = -1; - _REENT->_errno = EBADF; + __errno_r(_REENT) = EBADF; } return result; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/findfp.c libnewlib-nano-2.11.2/newlib/libc/stdio/findfp.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/findfp.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/findfp.c 2018-11-14 22:26:13.000000000 +0000 @@ -164,7 +164,7 @@ break; } _newlib_sfp_lock_exit (); - d->_errno = ENOMEM; + __errno_r(d) = ENOMEM; return NULL; found: diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/flags.c libnewlib-nano-2.11.2/newlib/libc/stdio/flags.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/flags.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/flags.c 2018-11-14 22:26:13.000000000 +0000 @@ -56,7 +56,7 @@ o = O_CREAT | O_APPEND; break; default: /* illegal mode */ - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; return (0); } while (*++mode) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/fmemopen.c libnewlib-nano-2.11.2/newlib/libc/stdio/fmemopen.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/fmemopen.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/fmemopen.c 2018-11-14 22:26:13.000000000 +0000 @@ -148,7 +148,7 @@ memcpy (c->buf + c->pos - n, buf, n - adjust); else { - ptr->_errno = ENOSPC; + __errno_r(ptr) = ENOSPC; return EOF; } return n; @@ -175,18 +175,18 @@ offset += c->eof; if (offset < 0) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; offset = -1; } else if (offset > c->max) { - ptr->_errno = ENOSPC; + __errno_r(ptr) = ENOSPC; offset = -1; } #ifdef __LARGE64_FILES else if ((_fpos_t) offset != offset) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; offset = -1; } #endif /* __LARGE64_FILES */ @@ -224,12 +224,12 @@ offset += c->eof; if (offset < 0) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; offset = -1; } else if (offset > c->max) { - ptr->_errno = ENOSPC; + __errno_r(ptr) = ENOSPC; offset = -1; } else @@ -277,7 +277,7 @@ return NULL; if (!size || !(buf || flags & __SRW)) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; return NULL; } if ((fp = __sfp (ptr)) == NULL) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/fopencookie.c libnewlib-nano-2.11.2/newlib/libc/stdio/fopencookie.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/fopencookie.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/fopencookie.c 2018-11-14 22:26:13.000000000 +0000 @@ -107,7 +107,7 @@ fccookie *c = (fccookie *) cookie; errno = 0; if ((result = c->readfn (c->cookie, buf, n)) < 0 && errno) - ptr->_errno = errno; + __errno_r(ptr) = errno; return result; } @@ -129,7 +129,7 @@ } errno = 0; if ((result = c->writefn (c->cookie, buf, n)) < 0 && errno) - ptr->_errno = errno; + __errno_r(ptr) = errno; return result; } @@ -148,11 +148,11 @@ errno = 0; if (c->seekfn (c->cookie, &offset, whence) < 0 && errno) - ptr->_errno = errno; + __errno_r(ptr) = errno; #ifdef __LARGE64_FILES else if ((_fpos_t)offset != offset) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; offset = -1; } #endif /* __LARGE64_FILES */ @@ -170,7 +170,7 @@ fccookie *c = (fccookie *) cookie; errno = 0; if (c->seekfn (c->cookie, &offset, whence) < 0 && errno) - ptr->_errno = errno; + __errno_r(ptr) = errno; return (_fpos64_t) offset; } #endif /* __LARGE64_FILES */ @@ -185,7 +185,7 @@ { errno = 0; if ((result = c->closefn (c->cookie)) < 0 && errno) - ptr->_errno = errno; + __errno_r(ptr) = errno; } _free_r (ptr, c); return result; @@ -207,7 +207,7 @@ if (((flags & (__SRD | __SRW)) && !functions.read) || ((flags & (__SWR | __SRW)) && !functions.write)) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; return NULL; } if ((fp = __sfp (ptr)) == NULL) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/fpurge.c libnewlib-nano-2.11.2/newlib/libc/stdio/fpurge.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/fpurge.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/fpurge.c 2018-11-14 22:26:13.000000000 +0000 @@ -72,7 +72,7 @@ t = fp->_flags; if (!t) { - ptr->_errno = EBADF; + __errno_r(ptr) = EBADF; _newlib_flockfile_exit (fp); return EOF; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/freopen.c libnewlib-nano-2.11.2/newlib/libc/stdio/freopen.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/freopen.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/freopen.c 2018-11-14 22:26:13.000000000 +0000 @@ -137,7 +137,7 @@ if (file != NULL) { f = _open_r (ptr, (char *) file, oflags, 0666); - e = ptr->_errno; + e = __errno_r(ptr); } else { @@ -205,7 +205,7 @@ { /* did not get it after all */ __sfp_lock_acquire (); fp->_flags = 0; /* set it free */ - ptr->_errno = e; /* restore in case _close clobbered */ + __errno_r(ptr) = e; /* restore in case _close clobbered */ if (!(oflags2 & __SNLK)) _funlockfile (fp); #ifndef __SINGLE_THREAD__ diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/fseeko.c libnewlib-nano-2.11.2/newlib/libc/stdio/fseeko.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/fseeko.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/fseeko.c 2018-11-14 22:26:13.000000000 +0000 @@ -128,7 +128,7 @@ if ((seekfn = fp->_seek) == NULL) { - ptr->_errno = ESPIPE; /* ??? */ + __errno_r(ptr) = ESPIPE; /* ??? */ _newlib_flockfile_exit (fp); return EOF; } @@ -178,7 +178,7 @@ break; default: - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; _newlib_flockfile_exit (fp); return (EOF); } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/ftell.c libnewlib-nano-2.11.2/newlib/libc/stdio/ftell.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/ftell.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/ftell.c 2018-11-14 22:26:13.000000000 +0000 @@ -92,7 +92,7 @@ if ((long)pos != pos) { pos = -1; - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; } return (long)pos; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/ftello.c libnewlib-nano-2.11.2/newlib/libc/stdio/ftello.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/ftello.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/ftello.c 2018-11-14 22:26:13.000000000 +0000 @@ -96,7 +96,7 @@ if (fp->_seek == NULL) { - ptr->_errno = ESPIPE; + __errno_r(ptr) = ESPIPE; _newlib_flockfile_exit (fp); return (_off_t) -1; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/funopen.c libnewlib-nano-2.11.2/newlib/libc/stdio/funopen.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/funopen.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/funopen.c 2018-11-14 22:26:13.000000000 +0000 @@ -113,7 +113,7 @@ funcookie *c = (funcookie *) cookie; errno = 0; if ((result = c->readfn (c->cookie, buf, n)) < 0 && errno) - ptr->_errno = errno; + __errno_r(ptr) = errno; return result; } @@ -127,7 +127,7 @@ funcookie *c = (funcookie *) cookie; errno = 0; if ((result = c->writefn (c->cookie, buf, n)) < 0 && errno) - ptr->_errno = errno; + __errno_r(ptr) = errno; return result; } @@ -142,15 +142,15 @@ fpos_t result; errno = 0; if ((result = c->seekfn (c->cookie, (fpos_t) off, whence)) < 0 && errno) - ptr->_errno = errno; + __errno_r(ptr) = errno; #else /* __LARGE64_FILES */ _fpos64_t result; errno = 0; if ((result = c->seekfn (c->cookie, (_fpos64_t) off, whence)) < 0 && errno) - ptr->_errno = errno; + __errno_r(ptr) = errno; else if ((_fpos_t)result != result) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; result = -1; } #endif /* __LARGE64_FILES */ @@ -168,7 +168,7 @@ funcookie *c = (funcookie *) cookie; errno = 0; if ((result = c->seekfn (c->cookie, off, whence)) < 0 && errno) - ptr->_errno = errno; + __errno_r(ptr) = errno; return result; } #endif /* __LARGE64_FILES */ @@ -183,7 +183,7 @@ { errno = 0; if ((result = c->closefn (c->cookie)) < 0 && errno) - ptr->_errno = errno; + __errno_r(ptr) = errno; } _free_r (ptr, c); return result; @@ -202,7 +202,7 @@ if (!readfn && !writefn) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; return NULL; } if ((fp = __sfp (ptr)) == NULL) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/fvwrite.c libnewlib-nano-2.11.2/newlib/libc/stdio/fvwrite.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/fvwrite.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/fvwrite.c 2018-11-14 22:26:13.000000000 +0000 @@ -145,7 +145,7 @@ str = (unsigned char *)_malloc_r (ptr, newsize); if (!str) { - ptr->_errno = ENOMEM; + __errno_r(ptr) = ENOMEM; goto err; } memcpy (str, fp->_bf._base, curpos); @@ -162,7 +162,7 @@ _free_r (ptr, fp->_bf._base); fp->_flags &= ~__SMBF; /* Ensure correct errno, even if free changed it. */ - ptr->_errno = ENOMEM; + __errno_r(ptr) = ENOMEM; goto err; } } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/meson.build libnewlib-nano-2.11.2/newlib/libc/stdio/meson.build --- libnewlib-nano-2.10.0/newlib/libc/stdio/meson.build 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -1,156 +1,232 @@ -srcs_stdio = [ - 'asiprintf.c', - 'asniprintf.c', - 'asnprintf.c', - 'asprintf.c', - 'clearerr.c', - 'clearerr_u.c', - 'diprintf.c', - 'dprintf.c', - 'fcloseall.c', - 'fclose.c', - 'fdopen.c', - 'feof.c', - 'feof_u.c', - 'ferror.c', - 'ferror_u.c', - 'fflush.c', - 'fflush_u.c', - 'fgetc.c', - 'fgetc_u.c', - 'fgetpos.c', - 'fgets.c', - 'fgets_u.c', - 'fgetwc.c', - 'fgetwc_u.c', - 'fgetws.c', - 'fgetws_u.c', - 'fileno.c', - 'fileno_u.c', - 'findfp.c', - 'fiprintf.c', - 'fiscanf.c', - 'flags.c', - 'fmemopen.c', - 'fopen.c', - 'fopencookie.c', - 'fprintf.c', - 'fpurge.c', - 'fputc.c', - 'fputc_u.c', - 'fputs.c', - 'fputs_u.c', - 'fputwc.c', - 'fputwc_u.c', - 'fputws.c', - 'fputws_u.c', - 'fread.c', - 'fread_u.c', - 'freopen.c', - 'fscanf.c', - 'fseek.c', - 'fseeko.c', - 'fsetlocking.c', - 'fsetpos.c', - 'ftell.c', - 'ftello.c', - 'funopen.c', - 'fvwrite.c', - 'fwalk.c', - 'fwide.c', - 'fwprintf.c', - 'fwrite.c', - 'fwrite_u.c', - 'fwscanf.c', - 'getc.c', - 'getchar.c', - 'getchar_u.c', - 'getc_u.c', - 'getdelim.c', - 'getline.c', - 'gets.c', - 'getw.c', - 'getwc.c', - 'getwchar.c', - 'getwchar_u.c', - 'getwc_u.c', - 'iprintf.c', - 'iscanf.c', - 'makebuf.c', - 'mktemp.c', - 'nano-vfprintf.c', - 'nano-vfprintf_float.c', - 'nano-vfprintf_i.c', - 'nano-vfscanf.c', - 'nano-vfscanf_float.c', - 'nano-vfscanf_i.c', - 'open_memstream.c', - 'perror.c', - 'printf.c', - 'putc.c', - 'putchar.c', - 'putchar_u.c', - 'putc_u.c', - 'puts.c', - 'putw.c', - 'putwc.c', - 'putwchar.c', - 'putwchar_u.c', - 'putwc_u.c', - 'refill.c', - 'remove.c', - 'rename.c', - 'rewind.c', - 'rget.c', - 'scanf.c', - 'sccl.c', - 'setbuf.c', - 'setbuffer.c', - 'setlinebuf.c', - 'setvbuf.c', - 'siprintf.c', - 'siscanf.c', - 'sniprintf.c', - 'snprintf.c', - 'sprintf.c', - 'sscanf.c', - 'stdio.c', - 'stdio_ext.c', - 'swprintf.c', - 'swscanf.c', - 'tmpfile.c', - 'tmpnam.c', - 'ungetc.c', - 'ungetwc.c', - 'vasiprintf.c', - 'vasniprintf.c', - 'vasnprintf.c', - 'vasprintf.c', - 'vdiprintf.c', - 'vdprintf.c', - 'vfprintf.c', - 'vfscanf.c', - 'vfwprintf.c', - 'vfwscanf.c', - 'viprintf.c', - 'viscanf.c', - 'vprintf.c', - 'vscanf.c', - 'vsiprintf.c', - 'vsiscanf.c', - 'vsniprintf.c', - 'vsnprintf.c', - 'vsprintf.c', - 'vsscanf.c', - 'vswprintf.c', - 'vswscanf.c', - 'vwprintf.c', - 'vwscanf.c', - 'wbuf.c', - 'wprintf.c', - 'wscanf.c', - 'wsetup.c', +general_srcs_stdio = [ + 'clearerr.c', + 'fclose.c', + 'fdopen.c', + 'feof.c', + 'ferror.c', + 'fflush.c', + 'fgetc.c', + 'fgetpos.c', + 'fgets.c', + 'fileno.c', + 'findfp.c', + 'flags.c', + 'fopen.c', + 'fprintf.c', + 'fputc.c', + 'fputs.c', + 'fread.c', + 'freopen.c', + 'fscanf.c', + 'fseek.c', + 'fsetpos.c', + 'ftell.c', + 'fvwrite.c', + 'fwalk.c', + 'fwrite.c', + 'getc.c', + 'getchar.c', + 'getc_u.c', + 'getchar_u.c', + 'getdelim.c', + 'getline.c', + 'gets.c', + 'makebuf.c', + 'perror.c', + 'printf.c', + 'putc.c', + 'putchar.c', + 'putc_u.c', + 'putchar_u.c', + 'puts.c', + 'refill.c', + 'remove.c', + 'rename.c', + 'rewind.c', + 'rget.c', + 'scanf.c', + 'sccl.c', + 'setbuf.c', + 'setbuffer.c', + 'setlinebuf.c', + 'setvbuf.c', + 'snprintf.c', + 'sprintf.c', + 'sscanf.c', + 'stdio.c', + 'tmpfile.c', + 'tmpnam.c', + 'ungetc.c', + 'vdprintf.c', + 'vprintf.c', + 'vscanf.c', + 'vsnprintf.c', + 'vsprintf.c', + 'vsscanf.c', + 'wbuf.c', + 'wsetup.c', ] + +general_int_srcs_stdio = [ + 'fiprintf.c', + 'fiscanf.c', + 'iprintf.c', + 'iscanf.c', + 'siprintf.c', + 'siscanf.c', + 'sniprintf.c', + 'vdiprintf.c', + 'vfprintf.c', + 'vfwprintf.c', + 'viprintf.c', + 'viscanf.c', + 'vsiprintf.c', + 'vsiscanf.c', + 'vsniprintf.c', +] + +if newlib_nano_formatted_io == false + general_srcs_stdio += general_int_srcs_stdio +endif + +elix_2_int_srcs_stdio = [ + 'asiprintf.c', + 'vasiprintf.c', +] + +elix_2_srcs_stdio = [ + 'asprintf.c', + 'fcloseall.c', + 'fseeko.c', + 'ftello.c', + 'getw.c', + 'mktemp.c', + 'putw.c', + 'vasprintf.c', +] + +if newlib_nano_formatted_io == false + elix_2_srcs_stdio += elix_2_int_srcs_stdio +endif + +elix_4_int_srcs_stdio = [ + 'asniprintf.c', + 'diprintf.c', + 'vasniprintf.c', +] + +elix_4_srcs_stdio = [ + 'asnprintf.c', + 'clearerr_u.c', + 'dprintf.c', + 'feof_u.c', + 'ferror_u.c', + 'fflush_u.c', + 'fgetc_u.c', + 'fgets_u.c', + 'fgetwc.c', + 'fgetwc_u.c', + 'fgetws.c', + 'fgetws_u.c', + 'fileno_u.c', + 'fmemopen.c', + 'fopencookie.c', + 'fpurge.c', + 'fputc_u.c', + 'fputs_u.c', + 'fputwc.c', + 'fputwc_u.c', + 'fputws.c', + 'fputws_u.c', + 'fread_u.c', + 'fsetlocking.c', + 'funopen.c', + 'fwide.c', + 'fwprintf.c', + 'fwrite_u.c', + 'fwscanf.c', + 'getwc.c', + 'getwc_u.c', + 'getwchar.c', + 'getwchar_u.c', + 'open_memstream.c', + 'putwc.c', + 'putwc_u.c', + 'putwchar.c', + 'putwchar_u.c', + 'stdio_ext.c', + 'swprintf.c', + 'swscanf.c', + 'ungetwc.c', + 'vasnprintf.c', + 'vswprintf.c', + 'vswscanf.c', + 'vwprintf.c', + 'vwscanf.c', + 'wprintf.c', + 'wscanf.c', +] + +if newlib_nano_formatted_io == false + elix_4_srcs_stdio += elix_4_int_srcs_stdio +endif + +elix_srcs_stdio = [] + +if newlib_elix_level >= 2 + elix_srcs_stdio += elix_2_srcs_stdio +endif + +if newlib_elix_level >= 4 + elix_srcs_stdio += elix_4_srcs_stdio +endif + +nano_printf_srcs_stdio = [ + 'nano-vfprintf_float.c', + 'nano-svfprintf.c', + 'nano-svfscanf.c', + 'nano-vfprintf.c', + 'nano-vfprintf_i.c', + 'nano-vfscanf.c', + 'nano-vfscanf_i.c', + 'nano-vfscanf_float.c', + 'svfiwprintf.c', + 'svfwprintf.c', + 'vfiwprintf.c', + 'svfiwscanf.c', + 'svfwscanf.c', + 'vfiwscanf.c', + 'vfwscanf.c', +] + +std_printf_srcs_stdio = [ + 'svfiprintf.c', + 'svfprintf.c', + 'svfiscanf.c', + 'svfscanf.c', + 'vfiprintf.c', + 'vfscanf.c', + 'vfiscanf.c', + 'svfiwprintf.c', + 'svfwprintf.c', + 'vfiwprintf.c', + 'svfiwscanf.c', + 'svfwscanf.c', + 'vfiwscanf.c', + 'vfwscanf.c', +] + +srcs_stdio = general_srcs_stdio + +if newlib_nano_formatted_io == false + srcs_stdio += general_int_srcs_stdio + srcs_stdio += std_printf_srcs_stdio +else + srcs_stdio += nano_printf_srcs_stdio +endif + +srcs_stdio += elix_srcs_stdio + hdrs_stdio = [ 'floatio.h', 'fvwrite.h', diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/mktemp.c libnewlib-nano-2.11.2/newlib/libc/stdio/mktemp.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/mktemp.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/mktemp.c 2018-11-14 22:26:13.000000000 +0000 @@ -160,7 +160,7 @@ continue; if (trv - path < suffixlen) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; return 0; } trv -= suffixlen; @@ -172,7 +172,7 @@ } if (end - trv < 6) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; return 0; } @@ -196,7 +196,7 @@ return (0); if (!(sbuf.st_mode & S_IFDIR)) { - ptr->_errno = ENOTDIR; + __errno_r(ptr) = ENOTDIR; return (0); } *trv = '/'; @@ -212,10 +212,10 @@ #ifdef HAVE_MKDIR if (_mkdir_r (ptr, path, 0700) == 0) return 1; - if (ptr->_errno != EEXIST) + if (__errno_r(ptr) != EEXIST) return 0; #else /* !HAVE_MKDIR */ - ptr->_errno = ENOSYS; + __errno_r(ptr) = ENOSYS; return 0; #endif /* !HAVE_MKDIR */ } @@ -226,7 +226,7 @@ if ((*doopen = _open_r (ptr, path, O_CREAT | O_EXCL | O_RDWR | flags, 0600)) >= 0) return 1; - if (ptr->_errno != EEXIST) + if (__errno_r(ptr) != EEXIST) return 0; } #ifdef __USE_INTERNAL_STAT64 @@ -234,7 +234,7 @@ #else else if (_stat_r (ptr, path, &sbuf)) #endif - return (ptr->_errno == ENOENT ? 1 : 0); + return (__errno_r(ptr) == ENOENT ? 1 : 0); /* tricky little algorithm for backward compatibility */ for (trv = start;;) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/nano-vfprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/nano-vfprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/nano-vfprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/nano-vfprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -201,7 +201,7 @@ str = (unsigned char *)_malloc_r (ptr, newsize); if (!str) { - ptr->_errno = ENOMEM; + __errno_r(ptr) = ENOMEM; goto err; } memcpy (str, fp->_bf._base, curpos); @@ -215,7 +215,7 @@ /* Free unneeded buffer. */ _free_r (ptr, fp->_bf._base); /* Ensure correct errno, even if free changed it. */ - ptr->_errno = ENOMEM; + __errno_r(ptr) = ENOMEM; goto err; } } @@ -291,7 +291,7 @@ str = (unsigned char *)_malloc_r (ptr, newsize); if (!str) { - ptr->_errno = ENOMEM; + __errno_r(ptr) = ENOMEM; goto err; } memcpy (str, fp->_bf._base, curpos); @@ -306,7 +306,7 @@ /* Free unneeded buffer. */ _free_r (ptr, fp->_bf._base); /* Ensure correct errno, even if free changed it. */ - ptr->_errno = ENOMEM; + __errno_r(ptr) = ENOMEM; goto err; } } @@ -501,7 +501,7 @@ fp->_bf._base = fp->_p = _malloc_r (data, 64); if (!fp->_p) { - data->_errno = ENOMEM; + __errno_r(data) = ENOMEM; return EOF; } fp->_bf._size = 64; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/open_memstream.c libnewlib-nano-2.11.2/newlib/libc/stdio/open_memstream.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/open_memstream.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/open_memstream.c 2018-11-14 22:26:13.000000000 +0000 @@ -105,7 +105,7 @@ big that user cannot do ftello. */ if (sizeof (OFF_T) == sizeof (size_t) && (ssize_t) (c->pos + n) < 0) { - ptr->_errno = EFBIG; + __errno_r(ptr) = EFBIG; return EOF; } /* Grow the buffer, if necessary. Choose a geometric growth factor @@ -160,18 +160,18 @@ offset += c->eof; if (offset < 0) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; offset = -1; } else if ((size_t) offset != offset) { - ptr->_errno = ENOSPC; + __errno_r(ptr) = ENOSPC; offset = -1; } #ifdef __LARGE64_FILES else if ((_fpos_t) offset != offset) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; offset = -1; } #endif /* __LARGE64_FILES */ @@ -227,12 +227,12 @@ offset += c->eof; if (offset < 0) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; offset = -1; } else if ((size_t) offset != offset) { - ptr->_errno = ENOSPC; + __errno_r(ptr) = ENOSPC; offset = -1; } else @@ -301,7 +301,7 @@ if (!buf || !size) { - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; return NULL; } if ((fp = __sfp (ptr)) == NULL) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/perror.c libnewlib-nano-2.11.2/newlib/libc/stdio/perror.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/perror.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/perror.c 2018-11-14 22:26:13.000000000 +0000 @@ -90,7 +90,7 @@ WRITE_STR (": "); } - if ((error = _strerror_r (ptr, ptr->_errno, 1, &dummy)) != NULL) + if ((error = _strerror_r (ptr, __errno_r(ptr), 1, &dummy)) != NULL) WRITE_STR (error); #ifdef __SCLE diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/refill.c libnewlib-nano-2.11.2/newlib/libc/stdio/refill.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/refill.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/refill.c 2018-11-14 22:26:13.000000000 +0000 @@ -58,7 +58,7 @@ { if ((fp->_flags & __SRW) == 0) { - ptr->_errno = EBADF; + __errno_r(ptr) = EBADF; fp->_flags |= __SERR; return EOF; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/sniprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/sniprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/sniprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/sniprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -38,7 +38,7 @@ if (size > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return EOF; } f._flags = __SWR | __SSTR; @@ -49,7 +49,7 @@ ret = _svfiprintf_r (ptr, &f, fmt, ap); va_end (ap); if (ret < EOF) - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; if (size > 0) *f._p = 0; return (ret); @@ -69,7 +69,7 @@ if (size > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return EOF; } f._flags = __SWR | __SSTR; @@ -80,7 +80,7 @@ ret = _svfiprintf_r (ptr, &f, fmt, ap); va_end (ap); if (ret < EOF) - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; if (size > 0) *f._p = 0; return (ret); diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/snprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/snprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/snprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/snprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -37,7 +37,7 @@ if (size > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return EOF; } f._flags = __SWR | __SSTR; @@ -48,7 +48,7 @@ ret = _svfprintf_r (ptr, &f, fmt, ap); va_end (ap); if (ret < EOF) - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; if (size > 0) *f._p = 0; return (ret); @@ -74,7 +74,7 @@ if (size > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return EOF; } f._flags = __SWR | __SSTR; @@ -85,7 +85,7 @@ ret = _svfprintf_r (ptr, &f, fmt, ap); va_end (ap); if (ret < EOF) - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; if (size > 0) *f._p = 0; return (ret); diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/svfiprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/svfiprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/svfiprintf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/svfiprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,3 @@ +#define INTEGER_ONLY +#define STRING_ONLY +#include "vfprintf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/svfiscanf.c libnewlib-nano-2.11.2/newlib/libc/stdio/svfiscanf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/svfiscanf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/svfiscanf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,3 @@ +#define INTEGER_ONLY +#define STRING_ONLY +#include "vfscanf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/svfiwprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/svfiwprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/svfiwprintf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/svfiwprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,4 @@ +#define INTEGER_ONLY +#define STRING_ONLY + +#include "vfwprintf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/svfiwscanf.c libnewlib-nano-2.11.2/newlib/libc/stdio/svfiwscanf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/svfiwscanf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/svfiwscanf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,3 @@ +#define INTEGER_ONLY +#define STRING_ONLY +#include "vfwscanf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/svfprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/svfprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/svfprintf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/svfprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,2 @@ +#define STRING_ONLY +#include "vfprintf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/svfscanf.c libnewlib-nano-2.11.2/newlib/libc/stdio/svfscanf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/svfscanf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/svfscanf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,2 @@ +#define STRING_ONLY +#include "vfscanf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/svfwprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/svfwprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/svfwprintf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/svfwprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,2 @@ +#define STRING_ONLY +#include "vfwprintf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/svfwscanf.c libnewlib-nano-2.11.2/newlib/libc/stdio/svfwscanf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/svfwscanf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/svfwscanf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,2 @@ +#define STRING_ONLY +#include "vfwscanf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/swprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/swprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/swprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/swprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -564,7 +564,7 @@ if (size > INT_MAX / sizeof (wchar_t)) { - ptr->_errno = EOVERFLOW; /* POSIX extension */ + __errno_r(ptr) = EOVERFLOW; /* POSIX extension */ return EOF; } f._flags = __SWR | __SSTR; @@ -584,7 +584,7 @@ /* _svfwprintf_r() returns how many wide characters it would have printed * if there were enough space. Return an error if too big to fit in str, * unlike snprintf, which returns the size needed. */ - ptr->_errno = EOVERFLOW; /* POSIX extension */ + __errno_r(ptr) = EOVERFLOW; /* POSIX extension */ ret = -1; } return (ret); @@ -604,7 +604,7 @@ if (size > INT_MAX / sizeof (wchar_t)) { - ptr->_errno = EOVERFLOW; /* POSIX extension */ + __errno_r(ptr) = EOVERFLOW; /* POSIX extension */ return EOF; } f._flags = __SWR | __SSTR; @@ -624,7 +624,7 @@ /* _svfwprintf_r() returns how many wide characters it would have printed * if there were enough space. Return an error if too big to fit in str, * unlike snprintf, which returns the size needed. */ - ptr->_errno = EOVERFLOW; /* POSIX extension */ + __errno_r(ptr) = EOVERFLOW; /* POSIX extension */ ret = -1; } return (ret); diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/tmpfile.c libnewlib-nano-2.11.2/newlib/libc/stdio/tmpfile.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/tmpfile.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/tmpfile.c 2018-11-14 22:26:13.000000000 +0000 @@ -65,15 +65,15 @@ fd = _open_r (ptr, f, O_RDWR | O_CREAT | O_EXCL | O_BINARY, S_IRUSR | S_IWUSR); } - while (fd < 0 && ptr->_errno == EEXIST); + while (fd < 0 && __errno_r(ptr) == EEXIST); if (fd < 0) return NULL; fp = _fdopen_r (ptr, fd, "wb+"); - e = ptr->_errno; + e = __errno_r(ptr); if (!fp) _close_r (ptr, fd); (void) _remove_r (ptr, f); - ptr->_errno = e; + __errno_r(ptr) = e; return fp; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/tmpnam.c libnewlib-nano-2.11.2/newlib/libc/stdio/tmpnam.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/tmpnam.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/tmpnam.c 2018-11-14 22:26:13.000000000 +0000 @@ -104,7 +104,7 @@ t = _open_r (ptr, result, O_RDONLY, 0); if (t == -1) { - if (ptr->_errno == ENOSYS) + if (__errno_r(ptr) == ENOSYS) { result[0] = '\0'; return 0; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vasniprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vasniprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vasniprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vasniprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -42,7 +42,7 @@ for _size. */ if (len > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return NULL; } f._bf._size = f._w = len; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vasnprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vasnprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vasnprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vasnprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -42,7 +42,7 @@ for _size. */ if (len > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return NULL; } f._bf._size = f._w = len; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vfiprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vfiprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vfiprintf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vfiprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,2 @@ +#define INTEGER_ONLY +#include "vfprintf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vfiscanf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vfiscanf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vfiscanf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vfiscanf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,2 @@ +#define INTEGER_ONLY +#include "vfscanf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vfiwprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vfiwprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vfiwprintf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vfiwprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,3 @@ +#define INTEGER_ONLY +#define STRING_ONLY +#include "vfprintf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vfiwscanf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vfiwscanf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vfiwscanf.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vfiwscanf.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,2 @@ +#define INTEGER_ONLY +#include "vfwscanf.c" diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vfprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vfprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vfprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vfprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -226,7 +226,7 @@ str = (unsigned char *)_malloc_r (ptr, newsize); if (!str) { - ptr->_errno = ENOMEM; + __errno_r(ptr) = ENOMEM; goto err; } memcpy (str, fp->_bf._base, curpos); @@ -241,7 +241,7 @@ _free_r (ptr, fp->_bf._base); /* Ensure correct errno, even if free * changed it. */ - ptr->_errno = ENOMEM; + __errno_r(ptr) = ENOMEM; goto err; } } @@ -310,7 +310,7 @@ str = (unsigned char *)_malloc_r (ptr, newsize); if (!str) { - ptr->_errno = ENOMEM; + __errno_r(ptr) = ENOMEM; goto err; } memcpy (str, fp->_bf._base, curpos); @@ -325,7 +325,7 @@ _free_r (ptr, fp->_bf._base); /* Ensure correct errno, even if free * changed it. */ - ptr->_errno = ENOMEM; + __errno_r(ptr) = ENOMEM; goto err; } } @@ -875,7 +875,7 @@ fp->_bf._base = fp->_p = _malloc_r (data, 64); if (!fp->_p) { - data->_errno = ENOMEM; + __errno_r(data) = ENOMEM; return EOF; } fp->_bf._size = 64; @@ -1381,7 +1381,7 @@ case 'm': /* extension */ { int dummy; - cp = _strerror_r (data, data->_errno, 1, &dummy); + cp = _strerror_r (data, __errno_r(data), 1, &dummy); } flags &= ~LONGINT; goto string; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vfscanf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vfscanf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vfscanf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vfscanf.c 2018-11-14 22:26:13.000000000 +0000 @@ -773,7 +773,7 @@ width = 0; goto again; } - rptr->_errno = EINVAL; + __errno_r(rptr) = EINVAL; goto input_failure; #endif /* !_NO_POS_ARGS */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vfwprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vfwprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vfwprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vfwprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -614,7 +614,7 @@ fp->_bf._base = fp->_p = _malloc_r (data, 64); if (!fp->_p) { - data->_errno = ENOMEM; + __errno_r(data) = ENOMEM; return EOF; } fp->_bf._size = 64; @@ -1122,7 +1122,7 @@ case L'm': /* GNU extension */ { int dummy; - cp = (wchar_t *) _strerror_r (data, data->_errno, 1, &dummy); + cp = (wchar_t *) _strerror_r (data, __errno_r(data), 1, &dummy); } flags &= ~LONGINT; goto string; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vfwscanf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vfwscanf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vfwscanf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vfwscanf.c 2018-11-14 22:26:13.000000000 +0000 @@ -715,7 +715,7 @@ width = 0; goto again; } - rptr->_errno = EINVAL; + __errno_r(rptr) = EINVAL; goto input_failure; #endif /* !_NO_POS_ARGS */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vsniprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vsniprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vsniprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vsniprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -54,7 +54,7 @@ if (size > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return EOF; } f._flags = __SWR | __SSTR; @@ -63,7 +63,7 @@ f._file = -1; /* No file. */ ret = _svfiprintf_r (ptr, &f, fmt, ap); if (ret < EOF) - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; if (size > 0) *f._p = 0; return ret; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vsnprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vsnprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vsnprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vsnprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -60,7 +60,7 @@ if (size > INT_MAX) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return EOF; } f._flags = __SWR | __SSTR; @@ -69,7 +69,7 @@ f._file = -1; /* No file. */ ret = _svfprintf_r (ptr, &f, fmt, ap); if (ret < EOF) - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; if (size > 0) *f._p = 0; return ret; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/vswprintf.c libnewlib-nano-2.11.2/newlib/libc/stdio/vswprintf.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/vswprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/vswprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -42,7 +42,7 @@ if (size > INT_MAX / sizeof (wchar_t)) { - ptr->_errno = EOVERFLOW; /* POSIX extension */ + __errno_r(ptr) = EOVERFLOW; /* POSIX extension */ return EOF; } f._flags = __SWR | __SSTR; @@ -60,7 +60,7 @@ /* _svfwprintf_r() returns how many wide characters it would have printed * if there were enough space. Return an error if too big to fit in str, * unlike snprintf, which returns the size needed. */ - ptr->_errno = EOVERFLOW; /* POSIX extension */ + __errno_r(ptr) = EOVERFLOW; /* POSIX extension */ ret = -1; } return ret; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio/wsetup.c libnewlib-nano-2.11.2/newlib/libc/stdio/wsetup.c --- libnewlib-nano-2.10.0/newlib/libc/stdio/wsetup.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio/wsetup.c 2018-11-14 22:26:13.000000000 +0000 @@ -45,7 +45,7 @@ { if ((fp->_flags & __SRW) == 0) { - ptr->_errno = EBADF; + __errno_r(ptr) = EBADF; fp->_flags |= __SERR; return EOF; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio64/fdopen64.c libnewlib-nano-2.11.2/newlib/libc/stdio64/fdopen64.c --- libnewlib-nano-2.10.0/newlib/libc/stdio64/fdopen64.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio64/fdopen64.c 2018-11-14 22:26:13.000000000 +0000 @@ -55,7 +55,7 @@ fdmode = fdflags & O_ACCMODE; if (fdmode != O_RDWR && (fdmode != (oflags & O_ACCMODE))) { - ptr->_errno = EBADF; + __errno_r(ptr) = EBADF; return 0; } #endif diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio64/freopen64.c libnewlib-nano-2.11.2/newlib/libc/stdio64/freopen64.c --- libnewlib-nano-2.10.0/newlib/libc/stdio64/freopen64.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio64/freopen64.c 2018-11-14 22:26:13.000000000 +0000 @@ -138,7 +138,7 @@ if (file != NULL) { f = _open64_r (ptr, (char *) file, oflags, 0666); - e = ptr->_errno; + e = __errno_r(ptr); } else { @@ -206,7 +206,7 @@ { /* did not get it after all */ __sfp_lock_acquire (); fp->_flags = 0; /* set it free */ - ptr->_errno = e; /* restore in case _close clobbered */ + __errno_r(ptr) = e; /* restore in case _close clobbered */ if (!(oflags2 & __SNLK)) _funlockfile (fp); #ifndef __SINGLE_THREAD__ diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio64/fseeko64.c libnewlib-nano-2.11.2/newlib/libc/stdio64/fseeko64.c --- libnewlib-nano-2.10.0/newlib/libc/stdio64/fseeko64.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio64/fseeko64.c 2018-11-14 22:26:13.000000000 +0000 @@ -102,7 +102,7 @@ { if ((_off_t) offset != offset) { - ptr->_errno = EOVERFLOW; + __errno_r(ptr) = EOVERFLOW; return EOF; } return (_off64_t) _fseeko_r (ptr, fp, offset, whence); @@ -129,7 +129,7 @@ if ((seekfn = fp->_seek64) == NULL) { - ptr->_errno = ESPIPE; /* ??? */ + __errno_r(ptr) = ESPIPE; /* ??? */ _newlib_flockfile_exit(fp); return EOF; } @@ -179,7 +179,7 @@ break; default: - ptr->_errno = EINVAL; + __errno_r(ptr) = EINVAL; _newlib_flockfile_exit(fp); return (EOF); } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio64/ftello64.c libnewlib-nano-2.11.2/newlib/libc/stdio64/ftello64.c --- libnewlib-nano-2.10.0/newlib/libc/stdio64/ftello64.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio64/ftello64.c 2018-11-14 22:26:13.000000000 +0000 @@ -93,7 +93,7 @@ if (fp->_seek64 == NULL) { - ptr->_errno = ESPIPE; + __errno_r(ptr) = ESPIPE; _newlib_flockfile_exit(fp); return (_off64_t) -1; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdio64/tmpfile64.c libnewlib-nano-2.11.2/newlib/libc/stdio64/tmpfile64.c --- libnewlib-nano-2.10.0/newlib/libc/stdio64/tmpfile64.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdio64/tmpfile64.c 2018-11-14 22:26:13.000000000 +0000 @@ -68,15 +68,15 @@ fd = _open64_r (ptr, f, O_RDWR | O_CREAT | O_EXCL | O_BINARY, S_IRUSR | S_IWUSR); } - while (fd < 0 && ptr->_errno == EEXIST); + while (fd < 0 && __errno_r(ptr) == EEXIST); if (fd < 0) return NULL; fp = _fdopen64_r (ptr, fd, "wb+"); - e = ptr->_errno; + e = __errno_r(ptr); if (!fp) _close_r (ptr, fd); (void) _remove_r (ptr, f); - ptr->_errno = e; + __errno_r(ptr) = e; return fp; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/__adjust.c libnewlib-nano-2.11.2/newlib/libc/stdlib/__adjust.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/__adjust.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/__adjust.c 2018-11-14 22:26:13.000000000 +0000 @@ -21,12 +21,12 @@ if (dexp > MAXE) { - ptr->_errno = ERANGE; + __errno_r(ptr) = ERANGE; return (sign) ? -HUGE_VAL : HUGE_VAL; } else if (dexp < MINE) { - ptr->_errno = ERANGE; + __errno_r(ptr) = ERANGE; return 0.0; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/arc4random.c libnewlib-nano-2.11.2/newlib/libc/stdlib/arc4random.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/arc4random.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/arc4random.c 2018-11-14 22:26:13.000000000 +0000 @@ -99,7 +99,7 @@ rs->rs_have = 0; memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf)); - rs->rs_count = 1600000; + rs->rs_count = (SIZE_MAX <= 65535) ? 65000 : 1600000; } static inline void diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/gd_qnan.h libnewlib-nano-2.11.2/newlib/libc/stdlib/gd_qnan.h --- libnewlib-nano-2.10.0/newlib/libc/stdlib/gd_qnan.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/gd_qnan.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -#ifdef __IEEE_BIG_ENDIAN - -#if !defined(__mips) -#define f_QNAN 0x7fc00000 -#define d_QNAN0 0x7ff80000 -#define d_QNAN1 0x0 -#define ld_QNAN0 0x7ff80000 -#define ld_QNAN1 0x0 -#define ld_QNAN2 0x0 -#define ld_QNAN3 0x0 -#define ldus_QNAN0 0x7ff8 -#define ldus_QNAN1 0x0 -#define ldus_QNAN2 0x0 -#define ldus_QNAN3 0x0 -#define ldus_QNAN4 0x0 -#elif defined(__mips_nan2008) -#define f_QNAN 0x7fc00000 -#define d_QNAN0 0x7ff80000 -#define d_QNAN1 0x0 -#else -#define f_QNAN 0x7fbfffff -#define d_QNAN0 0x7ff7ffff -#define d_QNAN1 0xffffffff -#endif - -#elif defined(__IEEE_LITTLE_ENDIAN) - -#if !defined(__mips) -#define f_QNAN 0xffc00000 -#define d_QNAN0 0x0 -#define d_QNAN1 0xfff80000 -#define ld_QNAN0 0x0 -#define ld_QNAN1 0xc0000000 -#define ld_QNAN2 0xffff -#define ld_QNAN3 0x0 -#define ldus_QNAN0 0x0 -#define ldus_QNAN1 0x0 -#define ldus_QNAN2 0x0 -#define ldus_QNAN3 0xc000 -#define ldus_QNAN4 0xffff -#elif defined(__mips_nan2008) -#define f_QNAN 0x7fc00000 -#define d_QNAN0 0x0 -#define d_QNAN1 0x7ff80000 -#else -#define f_QNAN 0x7fbfffff -#define d_QNAN0 0xffffffff -#define d_QNAN1 0x7ff7ffff -#endif - -#else -#error IEEE endian not defined -#endif diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/gdtoa-gethex.c libnewlib-nano-2.11.2/newlib/libc/stdlib/gdtoa-gethex.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/gdtoa-gethex.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/gdtoa-gethex.c 2018-11-14 22:26:13.000000000 +0000 @@ -35,7 +35,6 @@ #include #include "mprec.h" #include "gdtoa.h" -#include "gd_qnan.h" #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) const unsigned char __hexdig[256]= @@ -150,8 +149,8 @@ int esign, havedig, irv, k, n, nbits, up, zret; __ULong L, lostbits, *x; Long e, e1; - unsigned char *decimalpoint = (unsigned char *) - __localeconv_l (loc)->decimal_point; + const unsigned char *decimalpoint = (unsigned char *) + __get_numeric_locale(loc)->decimal_point; size_t decp_len = strlen ((const char *) decimalpoint); unsigned char decp_end = decimalpoint[decp_len - 1]; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/Makefile.am libnewlib-nano-2.11.2/newlib/libc/stdlib/Makefile.am --- libnewlib-nano-2.10.0/newlib/libc/stdlib/Makefile.am 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/Makefile.am 2018-11-14 22:26:13.000000000 +0000 @@ -58,10 +58,8 @@ reallocf.c \ sb_charsets.c \ strtod.c \ - strtodg.c \ strtoimax.c \ strtol.c \ - strtorx.c \ strtoul.c \ strtoumax.c \ utoa.c \ @@ -77,7 +75,9 @@ if HAVE_LONG_DOUBLE GENERAL_SOURCES += \ - strtold.c \ + strtodg.c \ + strtold.c \ + strtorx.c \ wcstold.c endif # HAVE_LONG_DOUBLE diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/Makefile.in libnewlib-nano-2.11.2/newlib/libc/stdlib/Makefile.in --- libnewlib-nano-2.10.0/newlib/libc/stdlib/Makefile.in 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/Makefile.in 2018-11-14 22:26:13.000000000 +0000 @@ -154,7 +154,8 @@ @USE_LIBTOOL_FALSE@ $(am__objects_3) $(am__objects_7) lib_a_OBJECTS = $(am_lib_a_OBJECTS) LTLIBRARIES = $(noinst_LTLIBRARIES) -@HAVE_LONG_DOUBLE_TRUE@am__objects_8 = strtold.lo wcstold.lo +@HAVE_LONG_DOUBLE_TRUE@am__objects_8 = strtodg.lo strtold.lo strtorx.lo \ + wcstold.lo am__objects_9 = __adjust.lo __atexit.lo __call_atexit.lo __exp10.lo \ __ten_mu.lo _Exit.lo abort.lo abs.lo aligned_alloc.lo \ assert.lo atexit.lo atof.lo atoff.lo atoi.lo atol.lo calloc.lo \ @@ -165,10 +166,10 @@ mbtowc.lo mbtowc_r.lo mlock.lo mprec.lo mstats.lo \ on_exit_args.lo quick_exit.lo rand.lo rand_r.lo random.lo \ realloc.lo reallocarray.lo reallocf.lo sb_charsets.lo \ - strtod.lo strtodg.lo strtoimax.lo strtol.lo strtorx.lo \ - strtoul.lo strtoumax.lo utoa.lo wcstod.lo wcstoimax.lo \ - wcstol.lo wcstoul.lo wcstoumax.lo wcstombs.lo wcstombs_r.lo \ - wctomb.lo wctomb_r.lo $(am__objects_8) + strtod.lo strtoimax.lo strtol.lo strtoul.lo strtoumax.lo \ + utoa.lo wcstod.lo wcstoimax.lo wcstol.lo wcstoul.lo \ + wcstoumax.lo wcstombs.lo wcstombs_r.lo wctomb.lo wctomb_r.lo \ + $(am__objects_8) am__objects_10 = arc4random.lo arc4random_uniform.lo cxa_atexit.lo \ cxa_finalize.lo drand48.lo ecvtbuf.lo efgcvt.lo erand48.lo \ jrand48.lo lcong48.lo lrand48.lo mrand48.lo msize.lo mtrim.lo \ diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/mallocr.c libnewlib-nano-2.11.2/newlib/libc/stdlib/mallocr.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/mallocr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/mallocr.c 2018-11-14 22:26:13.000000000 +0000 @@ -341,7 +341,7 @@ #define RDECL struct _reent *reent_ptr; #endif -#define RERRNO reent_ptr->_errno +#define RERRNO __errno_r(reent_ptr) #define RCALL reent_ptr, #define RONECALL reent_ptr diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/mbrtowc.c libnewlib-nano-2.11.2/newlib/libc/stdlib/mbrtowc.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/mbrtowc.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/mbrtowc.c 2018-11-14 22:26:13.000000000 +0000 @@ -32,7 +32,7 @@ if (retval == -1) { ps->__count = 0; - ptr->_errno = EILSEQ; + __errno_r(ptr) = EILSEQ; return (size_t)(-1); } else @@ -68,7 +68,7 @@ if (retval == -1) { ps->__count = 0; - reent->_errno = EILSEQ; + __errno_r(reent) = EILSEQ; return (size_t)(-1); } else diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/mbsnrtowcs.c libnewlib-nano-2.11.2/newlib/libc/stdlib/mbsnrtowcs.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/mbsnrtowcs.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/mbsnrtowcs.c 2018-11-14 22:26:13.000000000 +0000 @@ -126,7 +126,7 @@ else { ps->__count = 0; - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return (size_t)-1; } } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/mbtowc_r.c libnewlib-nano-2.11.2/newlib/libc/stdlib/mbtowc_r.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/mbtowc_r.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/mbtowc_r.c 2018-11-14 22:26:13.000000000 +0000 @@ -39,7 +39,7 @@ #ifdef __CYGWIN__ if ((wchar_t)*t >= 0x80) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } #endif @@ -117,7 +117,7 @@ *pwc = __iso_8859_conv[iso_idx][*t - 0xa0]; if (*pwc == 0) /* Invalid character */ { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } return 1; @@ -290,7 +290,7 @@ *pwc = __cp_conv[cp_idx][*t - 0x80]; if (*pwc == 0) /* Invalid character */ { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } return 1; @@ -578,13 +578,13 @@ ch = t[i++]; if (ch < 0x80 || ch > 0xbf) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } if (state->__value.__wchb[0] < 0xc2) { /* overlong UTF-8 sequence */ - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } state->__count = 0; @@ -607,12 +607,12 @@ if (state->__value.__wchb[0] == 0xe0 && ch < 0xa0) { /* overlong UTF-8 sequence */ - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } if (ch < 0x80 || ch > 0xbf) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } state->__value.__wchb[1] = ch; @@ -625,7 +625,7 @@ ch = t[i++]; if (ch < 0x80 || ch > 0xbf) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } state->__count = 0; @@ -651,12 +651,12 @@ || (state->__value.__wchb[0] == 0xf4 && ch >= 0x90)) { /* overlong UTF-8 sequence or result is > 0x10ffff */ - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } if (ch < 0x80 || ch > 0xbf) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } state->__value.__wchb[1] = ch; @@ -669,7 +669,7 @@ ch = (state->__count == 2) ? t[i++] : state->__value.__wchb[2]; if (ch < 0x80 || ch > 0xbf) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } state->__value.__wchb[2] = ch; @@ -702,7 +702,7 @@ ch = t[i++]; if (ch < 0x80 || ch > 0xbf) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } tmp = (wint_t)((state->__value.__wchb[0] & 0x07) << 18) @@ -719,7 +719,7 @@ return i; } - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } @@ -769,7 +769,7 @@ } else { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } } @@ -836,7 +836,7 @@ } else { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } } @@ -851,7 +851,7 @@ } else { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } } @@ -955,7 +955,7 @@ break; case ERROR: default: - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/meson.build libnewlib-nano-2.11.2/newlib/libc/stdlib/meson.build --- libnewlib-nano-2.10.0/newlib/libc/stdlib/meson.build 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -1,3 +1,15 @@ +nano_malloc_srcs_stdlib = [ + 'nano-mallocr.c', +] + +std_malloc_srcs_stdlib = [ + 'mallocr.c', +] + +std_strtod_srcs_stdlib = [ + 'strtod.c', +] + srcs_stdlib = [ 'a64l.c', 'abort.c', @@ -68,7 +80,6 @@ 'msize.c', 'mstats.c', 'mtrim.c', - 'nano-mallocr.c', 'nrand48.c', 'on_exit_args.c', 'on_exit.c', @@ -88,7 +99,6 @@ 'setenv.c', 'setenv_r.c', 'srand48.c', - 'strtod.c', 'strtodg.c', 'strtoimax.c', 'strtol.c', @@ -122,16 +132,26 @@ 'wctomb_r.c', ] -if newlib_io_long_double - lsrcs_stdlib = [ - 'ldtoa.c', - 'strtold.c', - 'wcstold.c' - ] +lsrcs_stdlib = [ + 'ldtoa.c', + 'strtold.c', + 'wcstold.c' +] +if newlib_io_long_double srcs_stdlib += lsrcs_stdlib endif +if newlib_nano_malloc + srcs_stdlib += nano_malloc_srcs_stdlib +else + srcs_stdlib += std_malloc_srcs_stdlib +endif + +if not newlib_tinystdio + srcs_stdlib += std_strtod_srcs_stdlib +endif + hdrs_stdlib = [ 'arc4random.h', 'atexit.h', @@ -145,6 +165,20 @@ 'rand48.h', 'std.h', ] + +malloc_defs = [ + '-DDEFINE_MALLOC', + '-DDEFINE_FREE', + '-DDEFINE_REALLOC', + '-DDEFINE_CALLOC', + '-DDEFINE_CFREE', + '-DDEFINE_MEMALIGN', + '-DDEFINE_VALLOC', + '-DDEFINE_PVALLOC', + '-DDEFINE_MALLINFO', + '-DDEFINE_MALLOC_STATS', +] + foreach target : targets value = get_variable('target_' + target) set_variable('lib_stdlib' + target, @@ -152,5 +186,5 @@ srcs_stdlib, pic: false, include_directories: inc, - c_args: value[1])) + c_args: value[1] + ['-DINTERNAL_NEWLIB'] + malloc_defs)) endforeach diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/mprec.h libnewlib-nano-2.11.2/newlib/libc/stdlib/mprec.h --- libnewlib-nano-2.10.0/newlib/libc/stdlib/mprec.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/mprec.h 2018-11-14 22:26:13.000000000 +0000 @@ -265,39 +265,6 @@ #define INFNAN_CHECK #endif -/* - * NAN_WORD0 and NAN_WORD1 are only referenced in strtod.c. Prior to - * 20050115, they used to be hard-wired here (to 0x7ff80000 and 0, - * respectively), but now are determined by compiling and running - * qnan.c to generate gd_qnan.h, which specifies d_QNAN0 and d_QNAN1. - * Formerly gdtoaimp.h recommended supplying suitable -DNAN_WORD0=... - * and -DNAN_WORD1=... values if necessary. This should still work. - * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.) - */ -#ifdef IEEE_Arith -#ifdef IEEE_MC68k -#define _0 0 -#define _1 1 -#ifndef NAN_WORD0 -#define NAN_WORD0 d_QNAN0 -#endif -#ifndef NAN_WORD1 -#define NAN_WORD1 d_QNAN1 -#endif -#else -#define _0 1 -#define _1 0 -#ifndef NAN_WORD0 -#define NAN_WORD0 d_QNAN1 -#endif -#ifndef NAN_WORD1 -#define NAN_WORD1 d_QNAN0 -#endif -#endif -#else -#undef INFNAN_CHECK -#endif - #ifdef RND_PRODQUOT #define rounded_product(a,b) a = rnd_prod(a, b) #define rounded_quotient(a,b) a = rnd_quot(a, b) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/nano-mallocr.c libnewlib-nano-2.11.2/newlib/libc/stdlib/nano-mallocr.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/nano-mallocr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/nano-mallocr.c 2018-11-14 22:26:13.000000000 +0000 @@ -62,7 +62,7 @@ #define MALLOC_LOCK __malloc_lock(reent_ptr) #define MALLOC_UNLOCK __malloc_unlock(reent_ptr) -#define RERRNO reent_ptr->_errno +#define RERRNO __errno_r(reent_ptr) #define nano_malloc _malloc_r #define nano_free _free_r diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/strtod.c libnewlib-nano-2.11.2/newlib/libc/stdlib/strtod.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/strtod.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/strtod.c 2018-11-14 22:26:13.000000000 +0000 @@ -137,7 +137,6 @@ #include #include "mprec.h" #include "gdtoa.h" -#include "gd_qnan.h" #include "../locale/setlocale.h" /* #ifndef NO_FENV_H */ @@ -172,6 +171,14 @@ #define Rounding Flt_Rounds #endif +#ifdef IEEE_MC68k +#define _0 0 +#define _1 1 +#else +#define _0 1 +#define _1 0 +#endif + #ifdef Avoid_Underflow /*{*/ static double sulp (U x, @@ -256,8 +263,8 @@ #ifdef Honor_FLT_ROUNDS int rounding; #endif - struct lconv *lconv = __localeconv_l (loc); - int dec_len = strlen (lconv->decimal_point); + const char *decimal_point = __get_numeric_locale(loc)->decimal_point; + int dec_len = strlen (decimal_point); delta = bs = bd = NULL; sign = nz0 = nz = decpt = 0; @@ -337,7 +344,7 @@ else z = 10*z + c - '0'; nd0 = nd; - if (strncmp (s, lconv->decimal_point, dec_len) == 0) + if (strncmp (s, decimal_point, dec_len) == 0) { decpt = 1; c = *(s += dec_len); @@ -444,10 +451,7 @@ } else { #endif - dword0(rv) = NAN_WORD0; -#ifndef _DOUBLE_IS_32BITS - dword1(rv) = NAN_WORD1; -#endif /*!_DOUBLE_IS_32BITS*/ + dval(rv) = nan (""); #ifndef No_Hex_NaN } #endif @@ -581,7 +585,7 @@ if (e1 > DBL_MAX_10_EXP) { ovfl: #ifndef NO_ERRNO - ptr->_errno = ERANGE; + __errno_r(ptr) = ERANGE; #endif /* Can't trust HUGE_VAL */ #ifdef IEEE_Arith @@ -688,7 +692,7 @@ undfl: dval(rv) = 0.; #ifndef NO_ERRNO - ptr->_errno = ERANGE; + __errno_r(ptr) = ERANGE; #endif if (bd0) goto retfree; @@ -1235,7 +1239,7 @@ #ifndef NO_ERRNO /* try to avoid the bug of testing an 8087 register value */ if (dword0(rv) == 0 && dword1(rv) == 0) - ptr->_errno = ERANGE; + __errno_r(ptr) = ERANGE; #endif } #endif /* Avoid_Underflow */ @@ -1285,11 +1289,11 @@ { double val = _strtod_l (_REENT, s00, se, loc); if (isnan (val)) - return nanf (""); + return signbit (val) ? -nanf ("") : nanf (""); float retval = (float) val; #ifndef NO_ERRNO if (isinf (retval) && !isinf (val)) - _REENT->_errno = ERANGE; + __errno_r(_REENT) = ERANGE; #endif return retval; } @@ -1300,11 +1304,11 @@ { double val = _strtod_l (_REENT, s00, se, __get_current_locale ()); if (isnan (val)) - return nanf (""); + return signbit (val) ? -nanf ("") : nanf (""); float retval = (float) val; #ifndef NO_ERRNO if (isinf (retval) && !isinf (val)) - _REENT->_errno = ERANGE; + __errno_r(_REENT) = ERANGE; #endif return retval; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/strtodg.c libnewlib-nano-2.11.2/newlib/libc/stdlib/strtodg.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/strtodg.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/strtodg.c 2018-11-14 22:26:13.000000000 +0000 @@ -35,7 +35,6 @@ #include #include "mprec.h" #include "gdtoa.h" -#include "gd_qnan.h" #include "locale.h" @@ -420,8 +419,8 @@ Long L; __ULong y, z; _Bigint *ab, *bb, *bb1, *bd, *bd0, *bs, *delta, *rvb, *rvb0; - struct lconv *lconv = __localeconv_l (loc); - int dec_len = strlen (lconv->decimal_point); + const char *decimal_point = __get_numeric_locale(loc)->decimal_point; + int dec_len = strlen (decimal_point); irv = STRTOG_Zero; denorm = sign = nz0 = nz = 0; @@ -480,7 +479,7 @@ z = 10*z + c - '0'; nd0 = nd; #ifdef USE_LOCALE - if (strncmp (s, lconv->decimal_point, dec_len) == 0) + if (strncmp (s, decimal_point, dec_len) == 0) #else if (c == '.') #endif diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/strtoimax.c libnewlib-nano-2.11.2/newlib/libc/stdlib/strtoimax.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/strtoimax.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/strtoimax.c 2018-11-14 22:26:13.000000000 +0000 @@ -136,10 +136,10 @@ } if (any < 0) { acc = neg ? INTMAX_MIN : INTMAX_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (!any) { noconv: - rptr->_errno = EINVAL; + __errno_r(rptr) = EINVAL; } else if (neg) acc = -acc; if (endptr != NULL) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/strtol.c libnewlib-nano-2.11.2/newlib/libc/stdlib/strtol.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/strtol.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/strtol.c 2018-11-14 22:26:13.000000000 +0000 @@ -203,7 +203,7 @@ } if (any < 0) { acc = neg ? LONG_MIN : LONG_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/strtoll.c libnewlib-nano-2.11.2/newlib/libc/stdlib/strtoll.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/strtoll.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/strtoll.c 2018-11-14 22:26:13.000000000 +0000 @@ -205,7 +205,7 @@ } if (any < 0) { acc = neg ? LONG_LONG_MIN : LONG_LONG_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/strtorx.c libnewlib-nano-2.11.2/newlib/libc/stdlib/strtorx.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/strtorx.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/strtorx.c 2018-11-14 22:26:13.000000000 +0000 @@ -35,13 +35,9 @@ #include #include "mprec.h" #include "gdtoa.h" -#include "gd_qnan.h" #if defined (_HAVE_LONG_DOUBLE) && !defined (_LDBL_EQ_DBL) -#undef _0 -#undef _1 - /* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ #ifdef IEEE_MC68k @@ -93,11 +89,7 @@ break; case STRTOG_NaN: - L[0] = ldus_QNAN0; - L[1] = ldus_QNAN1; - L[2] = ldus_QNAN2; - L[3] = ldus_QNAN3; - L[4] = ldus_QNAN4; + *((long double*)L) = __builtin_nanl (""); } if (k & STRTOG_Neg) L[_0] |= 0x8000; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/strtoul.c libnewlib-nano-2.11.2/newlib/libc/stdlib/strtoul.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/strtoul.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/strtoul.c 2018-11-14 22:26:13.000000000 +0000 @@ -182,7 +182,7 @@ } if (any < 0) { acc = ULONG_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/strtoull.c libnewlib-nano-2.11.2/newlib/libc/stdlib/strtoull.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/strtoull.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/strtoull.c 2018-11-14 22:26:13.000000000 +0000 @@ -180,7 +180,7 @@ } if (any < 0) { acc = ULONG_LONG_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/strtoumax.c libnewlib-nano-2.11.2/newlib/libc/stdlib/strtoumax.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/strtoumax.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/strtoumax.c 2018-11-14 22:26:13.000000000 +0000 @@ -115,10 +115,10 @@ } if (any < 0) { acc = UINTMAX_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (!any) { noconv: - rptr->_errno = EINVAL; + __errno_r(rptr) = EINVAL; } else if (neg) acc = -acc; if (endptr != NULL) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/wcrtomb.c libnewlib-nano-2.11.2/newlib/libc/stdlib/wcrtomb.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/wcrtomb.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/wcrtomb.c 2018-11-14 22:26:13.000000000 +0000 @@ -31,7 +31,7 @@ if (retval == -1) { ps->__count = 0; - ptr->_errno = EILSEQ; + __errno_r(ptr) = EILSEQ; return (size_t)(-1); } else @@ -67,7 +67,7 @@ if (retval == -1) { ps->__count = 0; - reent->_errno = EILSEQ; + __errno_r(reent) = EILSEQ; return (size_t)(-1); } else diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/wcsnrtombs.c libnewlib-nano-2.11.2/newlib/libc/stdlib/wcsnrtombs.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/wcsnrtombs.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/wcsnrtombs.c 2018-11-14 22:26:13.000000000 +0000 @@ -104,7 +104,7 @@ int bytes = loc->wctomb (r, buff, *pwcs, ps); if (bytes == -1) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; ps->__count = 0; return (size_t)-1; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstod.c libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstod.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstod.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstod.c 2018-11-14 22:26:13.000000000 +0000 @@ -188,6 +188,7 @@ * corresponding position in the wide char string. */ if (endptr != NULL) { + const char *decimal_point = __get_numeric_locale(loc)->decimal_point; /* The only valid multibyte char in a float converted by strtod/wcstod is the radix char. What we do here is, figure out if the radix char was in the valid leading @@ -198,10 +199,9 @@ just one byte long. The resulting difference (end - buf) is then equivalent to the number of valid wide characters in the input string. */ - len = strlen (__localeconv_l (loc)->decimal_point); + len = strlen (decimal_point); if (len > 1) { - char *d = strstr (buf, - __localeconv_l (loc)->decimal_point); + char *d = strstr (buf, decimal_point); if (d && d < end) end -= len - 1; } @@ -257,7 +257,7 @@ float retval = (float) val; #ifndef NO_ERRNO if (isinf (retval) && !isinf (val)) - _REENT->_errno = ERANGE; + __errno_r(_REENT) = ERANGE; #endif return retval; } @@ -272,7 +272,7 @@ float retval = (float) val; #ifndef NO_ERRNO if (isinf (retval) && !isinf (val)) - _REENT->_errno = ERANGE; + __errno_r(_REENT) = ERANGE; #endif return retval; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstoimax.c libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstoimax.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstoimax.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstoimax.c 2018-11-14 22:26:13.000000000 +0000 @@ -122,10 +122,10 @@ } if (any < 0) { acc = neg ? INTMAX_MIN : INTMAX_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (!any) { noconv: - rptr->_errno = EINVAL; + __errno_r(rptr) = EINVAL; } else if (neg) acc = -acc; if (endptr != NULL) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstol.c libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstol.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstol.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstol.c 2018-11-14 22:26:13.000000000 +0000 @@ -204,7 +204,7 @@ } if (any < 0) { acc = neg ? LONG_MIN : LONG_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstold.c libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstold.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstold.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstold.c 2018-11-14 22:26:13.000000000 +0000 @@ -83,6 +83,7 @@ if (endptr != NULL) { + const char *decimal_point = __get_numeric_locale(loc)->decimal_point; /* The only valid multibyte char in a float converted by strtold/wcstold is the radix char. What we do here is, figure out if the radix char was in the valid leading @@ -93,10 +94,10 @@ just one byte long. The resulting difference (end - buf) is then equivalent to the number of valid wide characters in the input string. */ - len = strlen (__localeconv_l (loc)->decimal_point); + len = strlen (decimal_point); if (len > 1) { - char *d = strstr (buf, __localeconv_l (loc)->decimal_point); + char *d = strstr (buf, decimal_point); if (d && d < end) end -= len - 1; diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstoll.c libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstoll.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstoll.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstoll.c 2018-11-14 22:26:13.000000000 +0000 @@ -204,7 +204,7 @@ } if (any < 0) { acc = neg ? LONG_LONG_MIN : LONG_LONG_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstoul.c libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstoul.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstoul.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstoul.c 2018-11-14 22:26:13.000000000 +0000 @@ -183,7 +183,7 @@ } if (any < 0) { acc = ULONG_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstoull.c libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstoull.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstoull.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstoull.c 2018-11-14 22:26:13.000000000 +0000 @@ -154,7 +154,7 @@ register int neg = 0, any, cutlim; if(base < 0 || base == 1 || base > 36) { - rptr->_errno = EINVAL; + __errno_r(rptr) = EINVAL; return(0ULL); } /* @@ -199,7 +199,7 @@ } if (any < 0) { acc = ULLONG_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstoumax.c libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstoumax.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/wcstoumax.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/wcstoumax.c 2018-11-14 22:26:13.000000000 +0000 @@ -121,10 +121,10 @@ } if (any < 0) { acc = UINTMAX_MAX; - rptr->_errno = ERANGE; + __errno_r(rptr) = ERANGE; } else if (!any) { noconv: - rptr->_errno = EINVAL; + __errno_r(rptr) = EINVAL; } else if (neg) acc = -acc; if (endptr != NULL) diff -Nru libnewlib-nano-2.10.0/newlib/libc/stdlib/wctomb_r.c libnewlib-nano-2.11.2/newlib/libc/stdlib/wctomb_r.c --- libnewlib-nano-2.10.0/newlib/libc/stdlib/wctomb_r.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/stdlib/wctomb_r.c 2018-11-14 22:26:13.000000000 +0000 @@ -35,7 +35,7 @@ if ((size_t)wchar >= 0x100) #endif { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } @@ -133,7 +133,7 @@ return 4; } - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } @@ -165,7 +165,7 @@ } else { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } } @@ -204,7 +204,7 @@ } else { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } } @@ -244,7 +244,7 @@ *s = (char)char2; return cnt + 2; } - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } if (state->__state != 0) @@ -284,14 +284,14 @@ *s = (char) (mb + 0xa0); return 1; } - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } } if ((size_t)wchar >= 0x100) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } @@ -440,14 +440,14 @@ *s = (char) (mb + 0x80); return 1; } - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } } if ((size_t)wchar >= 0x100) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/string/memcpy.c libnewlib-nano-2.11.2/newlib/libc/string/memcpy.c --- libnewlib-nano-2.10.0/newlib/libc/string/memcpy.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/string/memcpy.c 2018-11-14 22:26:13.000000000 +0000 @@ -29,6 +29,7 @@ #include <_ansi.h> #include +#include "local.h" /* Nonzero if either X or Y is not aligned on a "long" boundary. */ #define UNALIGNED(X, Y) \ @@ -44,6 +45,7 @@ #define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) void * +__inhibit_loop_to_libcall memcpy (void *__restrict dst0, const void *__restrict src0, size_t len0) diff -Nru libnewlib-nano-2.10.0/newlib/libc/string/strerror.c libnewlib-nano-2.11.2/newlib/libc/string/strerror.c --- libnewlib-nano-2.10.0/newlib/libc/string/strerror.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/string/strerror.c 2018-11-14 22:26:13.000000000 +0000 @@ -882,7 +882,7 @@ #endif default: if (!errptr) - errptr = &ptr->_errno; + errptr = &__errno_r(ptr); if ((error = _user_strerror (errnum, internal, errptr)) == 0) error = ""; break; diff -Nru libnewlib-nano-2.10.0/newlib/libc/string/strstr.c libnewlib-nano-2.11.2/newlib/libc/string/strstr.c --- libnewlib-nano-2.10.0/newlib/libc/string/strstr.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/string/strstr.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,3 +1,31 @@ +/* Optimized strstr function. + Copyright (c) 2018 Arm Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-3-Clause + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + /* FUNCTION <>---find string segment @@ -29,86 +57,144 @@ */ #include +#include -#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) -# define RETURN_TYPE char * -# define AVAILABLE(h, h_l, j, n_l) \ - (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ - && ((h_l) = (j) + (n_l))) -# include "str-two-way.h" -#endif +#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) \ + || CHAR_BIT > 8 +/* Small and efficient strstr implementation. */ char * -strstr (const char *searchee, - const char *lookfor) +strstr (const char *hs, const char *ne) { -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) + size_t i; + int c = ne[0]; + + if (c == 0) + return (char*)hs; - /* Less code size, but quadratic performance in the worst case. */ - if (*searchee == 0) + for ( ; hs[0] != '\0'; hs++) { - if (*lookfor) - return (char *) NULL; - return (char *) searchee; + if (hs[0] != c) + continue; + for (i = 1; ne[i] != 0; i++) + if (hs[i] != ne[i]) + break; + if (ne[i] == '\0') + return (char*)hs; } - while (*searchee) + return NULL; +} + +#else /* compilation for speed */ + +# define RETURN_TYPE char * +# define AVAILABLE(h, h_l, j, n_l) (((j) <= (h_l) - (n_l)) \ + || ((h_l) += strnlen ((h) + (h_l), (n_l) | 2048), ((j) <= (h_l) - (n_l)))) + +# include "str-two-way.h" + +/* Number of bits used to index shift table. */ +#define SHIFT_TABLE_BITS 6 + +static inline char * +strstr2 (const unsigned char *hs, const unsigned char *ne) +{ + uint32_t h1 = (ne[0] << 16) | ne[1]; + uint32_t h2 = 0; + for (int c = hs[0]; h1 != h2 && c != 0; c = *++hs) + h2 = (h2 << 16) | c; + return h1 == h2 ? (char *)hs - 2 : NULL; +} + +static inline char * +strstr3 (const unsigned char *hs, const unsigned char *ne) +{ + uint32_t h1 = (ne[0] << 24) | (ne[1] << 16) | (ne[2] << 8); + uint32_t h2 = 0; + for (int c = hs[0]; h1 != h2 && c != 0; c = *++hs) + h2 = (h2 | c) << 8; + return h1 == h2 ? (char *)hs - 3 : NULL; +} + +static inline char * +strstr4 (const unsigned char *hs, const unsigned char *ne) +{ + uint32_t h1 = (ne[0] << 24) | (ne[1] << 16) | (ne[2] << 8) | ne[3]; + uint32_t h2 = 0; + for (int c = hs[0]; c != 0 && h1 != h2; c = *++hs) + h2 = (h2 << 8) | c; + return h1 == h2 ? (char *)hs - 4 : NULL; +} + +/* Extremely fast strstr algorithm with guaranteed linear-time performance. + Small needles up to size 4 use a dedicated linear search. Longer needles + up to size 254 use Sunday's Quick-Search algorithm. Due to its simplicity + it has the best average performance of string matching algorithms on almost + all inputs. It uses a bad-character shift table to skip past mismatches. + By limiting the needle length to 254, the shift table can be reduced to 8 + bits per entry, lowering preprocessing overhead and minimizing cache effects. + The limit also implies the worst-case performance is linear. + Even larger needles are processed by the linear-time Two-Way algorithm. +*/ +char * +strstr (const char *haystack, const char *needle) +{ + const unsigned char *hs = (const unsigned char *) haystack; + const unsigned char *ne = (const unsigned char *) needle; + + /* Handle short needle special cases first. */ + if (ne[0] == '\0') + return (char *) hs; + if (ne[1] == '\0') + return (char*)strchr (hs, ne[0]); + if (ne[2] == '\0') + return strstr2 (hs, ne); + if (ne[3] == '\0') + return strstr3 (hs, ne); + if (ne[4] == '\0') + return strstr4 (hs, ne); + + size_t ne_len = strlen (ne); + size_t hs_len = strnlen (hs, ne_len | 512); + + /* Ensure haystack length is >= needle length. */ + if (hs_len < ne_len) + return NULL; + + /* Use the Quick-Search algorithm for needle lengths less than 255. */ + if (__builtin_expect (ne_len < 255, 1)) { - size_t i; - i = 0; + uint8_t shift[1 << SHIFT_TABLE_BITS]; + const unsigned char *end = hs + hs_len - ne_len; + + /* Initialize bad character shift hash table. */ + memset (shift, ne_len + 1, sizeof (shift)); + for (int i = 0; i < ne_len; i++) + shift[ne[i] % sizeof (shift)] = ne_len - i; - while (1) + do { - if (lookfor[i] == 0) - { - return (char *) searchee; - } + hs--; - if (lookfor[i] != searchee[i]) + /* Search by skipping past bad characters. */ + size_t tmp = shift[hs[ne_len] % sizeof (shift)]; + for (hs += tmp; hs <= end; hs += tmp) { - break; + tmp = shift[hs[ne_len] % sizeof (shift)]; + if (memcmp (hs, ne, ne_len) == 0) + return (char*) hs; } - i++; + if (end[ne_len] == 0) + return NULL; + end += strnlen (end + ne_len, 2048); } - searchee++; - } - - return (char *) NULL; - -#else /* compilation for speed */ + while (hs <= end); - /* Larger code size, but guaranteed linear performance. */ - const char *haystack = searchee; - const char *needle = lookfor; - size_t needle_len; /* Length of NEEDLE. */ - size_t haystack_len; /* Known minimum length of HAYSTACK. */ - int ok = 1; /* True if NEEDLE is prefix of HAYSTACK. */ - - /* Determine length of NEEDLE, and in the process, make sure - HAYSTACK is at least as long (no point processing all of a long - NEEDLE if HAYSTACK is too short). */ - while (*haystack && *needle) - ok &= *haystack++ == *needle++; - if (*needle) - return NULL; - if (ok) - return (char *) searchee; + return NULL; + } - /* Reduce the size of haystack using strchr, since it has a smaller - linear coefficient than the Two-Way algorithm. */ - needle_len = needle - lookfor; - haystack = strchr (searchee + 1, *lookfor); - if (!haystack || needle_len == 1) - return (char *) haystack; - haystack_len = (haystack > searchee + needle_len ? 1 - : needle_len + searchee - haystack); - - /* Perform the search. */ - if (needle_len < LONG_NEEDLE_THRESHOLD) - return two_way_short_needle ((const unsigned char *) haystack, - haystack_len, - (const unsigned char *) lookfor, needle_len); - return two_way_long_needle ((const unsigned char *) haystack, haystack_len, - (const unsigned char *) lookfor, needle_len); -#endif /* compilation for speed */ + /* Use Two-Way algorithm for very long needles. */ + return two_way_long_needle (hs, hs_len, ne, ne_len); } +#endif /* compilation for speed */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/a29khif/configure libnewlib-nano-2.11.2/newlib/libc/sys/a29khif/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/a29khif/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/a29khif/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/arm/configure libnewlib-nano-2.11.2/newlib/libc/sys/arm/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/arm/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/arm/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/arm/syscalls.c libnewlib-nano-2.11.2/newlib/libc/sys/arm/syscalls.c --- libnewlib-nano-2.10.0/newlib/libc/sys/arm/syscalls.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/arm/syscalls.c 2018-11-14 22:26:13.000000000 +0000 @@ -30,7 +30,7 @@ int _fstat (int, struct stat *); void * _sbrk (ptrdiff_t); pid_t _getpid (void); -int _kill (int, int); +int _kill (int, int) __attribute__((__noreturn__)); void _exit (int); int _close (int); int _swiclose (int); @@ -76,7 +76,7 @@ typedef struct { int handle; - int pos; + off_t pos; } poslog; @@ -234,9 +234,16 @@ if (dir == SEEK_CUR) { + off_t pos; if (slot == MAX_OPEN_FILES) return -1; - ptr = openfiles[slot].pos + ptr; + pos = openfiles[slot].pos; + + /* Avoid SWI SEEK command when just querying file position. */ + if (ptr == 0) + return pos; + + ptr += pos; dir = SEEK_SET; } @@ -425,15 +432,18 @@ /* Note: The pid argument is thrown away. */ switch (sig) { case SIGABRT: - return do_AngelSWI (AngelSWI_Reason_ReportException, - (void *) ADP_Stopped_RunTimeError); + do_AngelSWI (AngelSWI_Reason_ReportException, + (void *) ADP_Stopped_RunTimeError); + __builtin_unreachable(); default: - return do_AngelSWI (AngelSWI_Reason_ReportException, - (void *) ADP_Stopped_ApplicationExit); + do_AngelSWI (AngelSWI_Reason_ReportException, + (void *) ADP_Stopped_ApplicationExit); } #else asm ("swi %a0" :: "i" (SWI_Exit)); #endif + + __builtin_unreachable(); } void @@ -527,7 +537,7 @@ { #ifdef ARM_RDI_MONITOR int block[2]; - block[0] = path; + block[0] = (int) path; block[1] = strlen(path); return wrap (do_AngelSWI (AngelSWI_Reason_Remove, block)) ? -1 : 0; #else @@ -620,7 +630,7 @@ meaning to its return value. Try to do something reasonable.... */ if (!s) return 1; /* maybe there is a shell available? we can hope. :-P */ - block[0] = s; + block[0] = (int) s; block[1] = strlen (s); e = wrap (do_AngelSWI (AngelSWI_Reason_System, block)); if ((e >= 0) && (e < 256)) @@ -647,9 +657,9 @@ { #ifdef ARM_RDI_MONITOR int block[4]; - block[0] = oldpath; + block[0] = (int) oldpath; block[1] = strlen(oldpath); - block[2] = newpath; + block[2] = (int) newpath; block[3] = strlen(newpath); return wrap (do_AngelSWI (AngelSWI_Reason_Rename, block)) ? -1 : 0; #else diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/configure libnewlib-nano-2.11.2/newlib/libc/sys/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/configure 2018-11-14 22:26:13.000000000 +0000 @@ -765,6 +765,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1439,6 +1440,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2846,6 +2848,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3692,8 +3706,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11462,7 +11474,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11465 "configure" +#line 11477 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11568,7 +11580,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11571 "configure" +#line 11583 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/d10v/configure libnewlib-nano-2.11.2/newlib/libc/sys/d10v/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/d10v/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/d10v/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/decstation/configure libnewlib-nano-2.11.2/newlib/libc/sys/decstation/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/decstation/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/decstation/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/decstation/sys/dirent.h libnewlib-nano-2.11.2/newlib/libc/sys/decstation/sys/dirent.h --- libnewlib-nano-2.10.0/newlib/libc/sys/decstation/sys/dirent.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/decstation/sys/dirent.h 2018-11-14 22:26:13.000000000 +0000 @@ -23,13 +23,6 @@ # define __dirfd(dp) ((dp)->dd_fd) -DIR *opendir (const char *); -struct dirent *readdir (DIR *); -int readdir_r (DIR *__restrict, struct dirent *__restrict, - struct dirent **__restrict); -void rewinddir (DIR *); -int closedir (DIR *); - #include #define MAXNAMLEN 255 diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/epiphany/configure libnewlib-nano-2.11.2/newlib/libc/sys/epiphany/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/epiphany/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/epiphany/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/h8300hms/configure libnewlib-nano-2.11.2/newlib/libc/sys/h8300hms/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/h8300hms/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/h8300hms/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/h8500hms/configure libnewlib-nano-2.11.2/newlib/libc/sys/h8500hms/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/h8500hms/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/h8500hms/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/linux/configure libnewlib-nano-2.11.2/newlib/libc/sys/linux/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/linux/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/linux/configure 2018-11-14 22:26:13.000000000 +0000 @@ -765,6 +765,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1414,6 +1415,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2821,6 +2823,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3667,8 +3681,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11479,7 +11491,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11482 "configure" +#line 11494 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11585,7 +11597,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11588 "configure" +#line 11600 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/linux/linuxthreads/configure libnewlib-nano-2.11.2/newlib/libc/sys/linux/linuxthreads/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/linux/linuxthreads/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/linux/linuxthreads/configure 2018-11-14 22:26:13.000000000 +0000 @@ -764,6 +764,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1412,6 +1413,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2819,6 +2821,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3665,8 +3679,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11477,7 +11489,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11480 "configure" +#line 11492 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11583,7 +11595,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11586 "configure" +#line 11598 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/linux/linuxthreads/machine/configure libnewlib-nano-2.11.2/newlib/libc/sys/linux/linuxthreads/machine/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/linux/linuxthreads/machine/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/linux/linuxthreads/machine/configure 2018-11-14 22:26:13.000000000 +0000 @@ -764,6 +764,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1412,6 +1413,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2819,6 +2821,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3665,8 +3679,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11435,7 +11447,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11438 "configure" +#line 11450 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11541,7 +11553,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11544 "configure" +#line 11556 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/linux/linuxthreads/machine/i386/configure libnewlib-nano-2.11.2/newlib/libc/sys/linux/linuxthreads/machine/i386/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/linux/linuxthreads/machine/i386/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/linux/linuxthreads/machine/i386/configure 2018-11-14 22:26:13.000000000 +0000 @@ -760,6 +760,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1408,6 +1409,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2815,6 +2817,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3661,8 +3675,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11473,7 +11485,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11476 "configure" +#line 11488 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11579,7 +11591,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11582 "configure" +#line 11594 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/linux/machine/configure libnewlib-nano-2.11.2/newlib/libc/sys/linux/machine/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/linux/machine/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/linux/machine/configure 2018-11-14 22:26:13.000000000 +0000 @@ -765,6 +765,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1413,6 +1414,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2820,6 +2822,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3666,8 +3680,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11436,7 +11448,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11439 "configure" +#line 11451 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11542,7 +11554,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11545 "configure" +#line 11557 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/m88kbug/configure libnewlib-nano-2.11.2/newlib/libc/sys/m88kbug/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/m88kbug/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/m88kbug/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/mmixware/configure libnewlib-nano-2.11.2/newlib/libc/sys/mmixware/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/mmixware/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/mmixware/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/netware/configure libnewlib-nano-2.11.2/newlib/libc/sys/netware/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/netware/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/netware/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/or1k/configure libnewlib-nano-2.11.2/newlib/libc/sys/or1k/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/or1k/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/or1k/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/phoenix/configure libnewlib-nano-2.11.2/newlib/libc/sys/phoenix/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/phoenix/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/phoenix/configure 2018-11-14 22:26:13.000000000 +0000 @@ -692,6 +692,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1328,6 +1329,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2492,6 +2494,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3338,8 +3352,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/phoenix/sys/dirent.h libnewlib-nano-2.11.2/newlib/libc/sys/phoenix/sys/dirent.h --- libnewlib-nano-2.10.0/newlib/libc/sys/phoenix/sys/dirent.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/phoenix/sys/dirent.h 2018-11-14 22:26:13.000000000 +0000 @@ -45,19 +45,6 @@ #define __dirfd(dir) (dir)->dd_fd -DIR *opendir(const char *name); -struct dirent *readdir(DIR *dirp); -void rewinddir(DIR *dirp); -int closedir(DIR *dirp); - -long telldir(DIR *dirp); -void seekdir(DIR *dirp, off_t loc); -int scandir(const char *__dir, - struct dirent ***__namelist, - int (*select) (const struct dirent *), - int (*compar) (const struct dirent **, const struct dirent **)); -int alphasort(const struct dirent **__a, const struct dirent **__b); - #define _seekdir seekdir /* Declare which dirent fields are available in Phoenix-RTOS. */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rdos/configure libnewlib-nano-2.11.2/newlib/libc/sys/rdos/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/rdos/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rdos/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/configure libnewlib-nano-2.11.2/newlib/libc/sys/rtems/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/crt0.c libnewlib-nano-2.11.2/newlib/libc/sys/rtems/crt0.c --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/crt0.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/crt0.c 2018-11-14 22:26:13.000000000 +0000 @@ -198,9 +198,10 @@ #if defined(__arm__) RTEMS_STUB(void, __aeabi_read_tp(void), { }) -RTEMS_STUB(void *, __tls_get_addr(const void *ti), { }) #endif +RTEMS_STUB(void *, __tls_get_addr(const void *ti), { }) + /* The PowerPC expects certain symbols to be defined in the linker script. */ #if defined(__PPC__) diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/arpa/inet.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/arpa/inet.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/arpa/inet.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/arpa/inet.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: (BSD-3-Clause AND ISC) + * * ++Copyright++ 1983, 1993 * - * Copyright (c) 1983, 1993 @@ -52,7 +54,7 @@ /*% * @(#)inet.h 8.1 (Berkeley) 6/2/93 * $Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp $ - * $FreeBSD: head/include/arpa/inet.h 269867 2014-08-12 12:36:06Z ume $ + * $FreeBSD: head/include/arpa/inet.h 326695 2017-12-08 15:57:29Z pfg $ */ #ifndef _ARPA_INET_H_ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/machine/param.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/machine/param.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/machine/param.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/machine/param.h 2018-11-14 22:26:13.000000000 +0000 @@ -71,6 +71,7 @@ #define MAXPAGESIZES 1 /* maximum number of supported page sizes */ +#ifdef _KERNEL /* * Mach derived conversion macros */ @@ -82,4 +83,6 @@ #define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) +#endif + #endif /* !_MACHINE_PARAM_H_ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/machine/types.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/machine/types.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/machine/types.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/machine/types.h 2018-11-14 22:26:13.000000000 +0000 @@ -71,6 +71,9 @@ typedef __uintptr_t uintfptr_t; +typedef __uintptr_t kvaddr_t; +typedef size_t ksize_t; + typedef __intptr_t vm_ooffset_t; typedef __uintptr_t vm_offset_t; typedef __uintptr_t vm_paddr_t; diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/net/if.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/net/if.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/net/if.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/net/if.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)if.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: head/sys/net/if.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/net/if.h 333502 2018-05-11 20:08:28Z mmacy $ */ #ifndef _NET_IF_H_ @@ -160,6 +162,9 @@ #define IFF_STATICARP 0x80000 /* (n) static ARP */ #define IFF_DYING 0x200000 /* (n) interface is winding down */ #define IFF_RENAMING 0x400000 /* (n) interface is being renamed */ +#define IFF_NOGROUP 0x800000 /* (n) interface is not part of any groups */ + + /* * Old names for driver flags so that user space tools can continue to use * the old (portable) names. @@ -232,7 +237,7 @@ #define IFCAP_TOE4 0x04000 /* interface can offload TCP */ #define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */ #define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */ -#define IFCAP_POLLING_NOCOUNT 0x20000 /* polling ticks cannot be fragmented */ +/* available 0x20000 */ #define IFCAP_VLAN_HWTSO 0x40000 /* can do IFCAP_TSO on VLANs */ #define IFCAP_LINKSTATE 0x80000 /* the runtime link state is dynamic */ #define IFCAP_NETMAP 0x100000 /* netmap mode supported/enabled */ @@ -240,6 +245,7 @@ #define IFCAP_TXCSUM_IPV6 0x400000 /* can offload checksum on IPv6 TX */ #define IFCAP_HWSTATS 0x800000 /* manages counters internally */ #define IFCAP_TXRTLMT 0x1000000 /* hardware supports TX rate limiting */ +#define IFCAP_HWRXTSTMP 0x2000000 /* hardware rx timestamping */ #define IFCAP_HWCSUM_IPV6 (IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6) @@ -399,7 +405,9 @@ #define ifr_addr ifr_ifru.ifru_addr /* address */ #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#ifndef _KERNEL #define ifr_buffer ifr_ifru.ifru_buffer /* user supplied buffer with its length */ +#endif #define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */ #define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */ #define ifr_jid ifr_ifru.ifru_jid /* jail/vnet */ @@ -407,12 +415,15 @@ #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ #define ifr_phys ifr_ifru.ifru_phys /* physical wire */ #define ifr_media ifr_ifru.ifru_media /* physical media */ +#ifndef _KERNEL #define ifr_data ifr_ifru.ifru_data /* for use by interface */ +#endif #define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */ #define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */ #define ifr_index ifr_ifru.ifru_index /* interface index */ #define ifr_fib ifr_ifru.ifru_fib /* interface fib */ #define ifr_vlan_pcp ifr_ifru.ifru_vlan_pcp /* VLAN priority */ +#define ifr_lan_pcp ifr_ifru.ifru_vlan_pcp /* VLAN priority */ }; #define _SIZEOF_ADDR_IFREQ(ifr) \ @@ -509,8 +520,10 @@ char ifgru_group[IFNAMSIZ]; struct ifg_req *ifgru_groups; } ifgr_ifgru; +#ifndef _KERNEL #define ifgr_group ifgr_ifgru.ifgru_group #define ifgr_groups ifgr_ifgru.ifgru_groups +#endif }; /* @@ -526,14 +539,45 @@ uint8_t data[8]; /* read buffer */ }; -#endif /* __BSD_VISIBLE */ +/* + * RSS hash. + */ -#ifdef _KERNEL -#ifdef MALLOC_DECLARE -MALLOC_DECLARE(M_IFADDR); -MALLOC_DECLARE(M_IFMADDR); -#endif -#endif +#define RSS_FUNC_NONE 0 /* RSS disabled */ +#define RSS_FUNC_PRIVATE 1 /* non-standard */ +#define RSS_FUNC_TOEPLITZ 2 + +#define RSS_TYPE_IPV4 0x00000001 +#define RSS_TYPE_TCP_IPV4 0x00000002 +#define RSS_TYPE_IPV6 0x00000004 +#define RSS_TYPE_IPV6_EX 0x00000008 +#define RSS_TYPE_TCP_IPV6 0x00000010 +#define RSS_TYPE_TCP_IPV6_EX 0x00000020 +#define RSS_TYPE_UDP_IPV4 0x00000040 +#define RSS_TYPE_UDP_IPV6 0x00000080 +#define RSS_TYPE_UDP_IPV6_EX 0x00000100 + +#define RSS_KEYLEN 128 + +struct ifrsskey { + char ifrk_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + uint8_t ifrk_func; /* RSS_FUNC_ */ + uint8_t ifrk_spare0; + uint16_t ifrk_keylen; + uint8_t ifrk_key[RSS_KEYLEN]; +}; + +struct ifrsshash { + char ifrh_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + uint8_t ifrh_func; /* RSS_FUNC_ */ + uint8_t ifrh_spare0; + uint16_t ifrh_spare1; + uint32_t ifrh_types; /* RSS_TYPE_ */ +}; + +#define IFNET_PCP_NONE 0xff /* PCP disabled */ + +#endif /* __BSD_VISIBLE */ #ifndef _KERNEL struct if_nameindex { @@ -548,4 +592,8 @@ unsigned int if_nametoindex(const char *); __END_DECLS #endif +#ifdef _KERNEL +/* Header file provided outside of Newlib */ +#include +#endif #endif /* !_NET_IF_H_ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/netdb.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/netdb.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/netdb.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/netdb.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: (BSD-3-Clause AND ISC) + * * Copyright (c) 1980, 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. * @@ -51,7 +53,7 @@ /* * @(#)netdb.h 8.1 (Berkeley) 6/2/93 * From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $ - * $FreeBSD: head/include/netdb.h 303428 2016-07-28 10:05:41Z ed $ + * $FreeBSD: head/include/netdb.h 326695 2017-12-08 15:57:29Z pfg $ */ #ifndef _NETDB_H_ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/netinet/in.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/netinet/in.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/netinet/in.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/netinet/in.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)in.h 8.3 (Berkeley) 1/3/94 - * $FreeBSD: head/sys/netinet/in.h 316715 2017-04-11 19:20:20Z ae $ + * $FreeBSD: head/sys/netinet/in.h 326023 2017-11-20 19:43:44Z pfg $ */ #ifndef _NETINET_IN_H_ @@ -289,7 +291,7 @@ * if you trust the remote host to restrict these ports. * * The default range of ports and the high range can be changed by - * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto) + * sysctl(3). (net.inet.ip.portrange.{hi,low,}{first,last}) * * Changing those values has bad security implications if you are * using a stateless firewall that is allowing packets outside of that @@ -638,32 +640,6 @@ #endif /* __BSD_VISIBLE */ -#ifdef _KERNEL - -struct ifnet; struct mbuf; /* forward declarations for Standard C */ -struct in_ifaddr; - -int in_broadcast(struct in_addr, struct ifnet *); -int in_ifaddr_broadcast(struct in_addr, struct in_ifaddr *); -int in_canforward(struct in_addr); -int in_localaddr(struct in_addr); -int in_localip(struct in_addr); -int in_ifhasaddr(struct ifnet *, struct in_addr); -int inet_aton(const char *, struct in_addr *); /* in libkern */ -char *inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */ -char *inet_ntop(int, const void *, char *, socklen_t); /* in libkern */ -int inet_pton(int af, const char *, void *); /* in libkern */ -void in_ifdetach(struct ifnet *); - -#define in_hosteq(s, t) ((s).s_addr == (t).s_addr) -#define in_nullhost(x) ((x).s_addr == INADDR_ANY) -#define in_allhosts(x) ((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP)) - -#define satosin(sa) ((struct sockaddr_in *)(sa)) -#define sintosa(sin) ((struct sockaddr *)(sin)) -#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) -#endif /* _KERNEL */ - /* INET6 stuff */ #if __POSIX_VISIBLE >= 200112 #define __KAME_NETINET_IN_H_INCLUDED_ @@ -671,4 +647,8 @@ #undef __KAME_NETINET_IN_H_INCLUDED_ #endif +#ifdef _KERNEL +/* Header file provided outside of Newlib */ +#include +#endif #endif /* !_NETINET_IN_H_*/ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/netinet/tcp.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/netinet/tcp.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/netinet/tcp.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/netinet/tcp.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)tcp.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: head/sys/netinet/tcp.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/netinet/tcp.h 334804 2018-06-07 18:18:13Z rrs $ */ #ifndef _NETINET_TCP_H_ @@ -99,8 +101,6 @@ #define TCPOLEN_SIGNATURE 18 #define TCPOPT_FAST_OPEN 34 #define TCPOLEN_FAST_OPEN_EMPTY 2 -#define TCPOLEN_FAST_OPEN_MIN 6 -#define TCPOLEN_FAST_OPEN_MAX 18 /* Miscellaneous constants */ #define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */ @@ -150,6 +150,10 @@ #define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */ #define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr)) /* max space left for options */ + +#define TCP_FASTOPEN_MIN_COOKIE_LEN 4 /* Per RFC7413 */ +#define TCP_FASTOPEN_MAX_COOKIE_LEN 16 /* Per RFC7413 */ +#define TCP_FASTOPEN_PSK_LEN 16 /* Same as TCP_FASTOPEN_KEY_LEN */ #endif /* __BSD_VISIBLE */ /* @@ -164,8 +168,15 @@ #define TCP_NOOPT 8 /* don't use TCP options */ #define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */ #define TCP_INFO 32 /* retrieve tcp_info structure */ +#define TCP_LOG 34 /* configure event logging for connection */ +#define TCP_LOGBUF 35 /* retrieve event log for connection */ +#define TCP_LOGID 36 /* configure log ID to correlate connections */ +#define TCP_LOGDUMP 37 /* dump connection log events to device */ +#define TCP_LOGDUMPID 38 /* dump events from connections with same ID to + device */ #define TCP_CONGESTION 64 /* get/set congestion control algorithm */ #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */ +#define TCP_DELACK 72 /* socket option for delayed ack */ #define TCP_KEEPINIT 128 /* N, time to establish connection */ #define TCP_KEEPIDLE 256 /* L,N,X start keeplives after this period */ #define TCP_KEEPINTVL 512 /* L,N interval between keepalives */ @@ -174,6 +185,61 @@ #define TCP_PCAP_OUT 2048 /* number of output packets to keep */ #define TCP_PCAP_IN 4096 /* number of input packets to keep */ #define TCP_FUNCTION_BLK 8192 /* Set the tcp function pointers to the specified stack */ +/* Options for Rack and BBR */ +#define TCP_RACK_PROP 1051 /* RACK proportional rate reduction (bool) */ +#define TCP_RACK_TLP_REDUCE 1052 /* RACK TLP cwnd reduction (bool) */ +#define TCP_RACK_PACE_REDUCE 1053 /* RACK Pacing reduction factor (divisor) */ +#define TCP_RACK_PACE_MAX_SEG 1054 /* Max segments in a pace */ +#define TCP_RACK_PACE_ALWAYS 1055 /* Use the always pace method */ +#define TCP_RACK_PROP_RATE 1056 /* The proportional reduction rate */ +#define TCP_RACK_PRR_SENDALOT 1057 /* Allow PRR to send more than one seg */ +#define TCP_RACK_MIN_TO 1058 /* Minimum time between rack t-o's in ms */ +#define TCP_RACK_EARLY_RECOV 1059 /* Should recovery happen early (bool) */ +#define TCP_RACK_EARLY_SEG 1060 /* If early recovery max segments */ +#define TCP_RACK_REORD_THRESH 1061 /* RACK reorder threshold (shift amount) */ +#define TCP_RACK_REORD_FADE 1062 /* Does reordering fade after ms time */ +#define TCP_RACK_TLP_THRESH 1063 /* RACK TLP theshold i.e. srtt+(srtt/N) */ +#define TCP_RACK_PKT_DELAY 1064 /* RACK added ms i.e. rack-rtt + reord + N */ +#define TCP_RACK_TLP_INC_VAR 1065 /* Does TLP include rtt variance in t-o */ +#define TCP_RACK_SESS_CWV 1066 /* Enable RFC7611 cwnd validation on sess */ +#define TCP_BBR_IWINTSO 1067 /* Initial TSO window for BBRs first sends */ +#define TCP_BBR_RECFORCE 1068 /* Enter recovery force out a segment disregard pacer */ +#define TCP_BBR_STARTUP_PG 1069 /* Startup pacing gain */ +#define TCP_BBR_DRAIN_PG 1070 /* Drain pacing gain */ +#define TCP_BBR_RWND_IS_APP 1071 /* Rwnd limited is considered app limited */ +#define TCP_BBR_PROBE_RTT_INT 1072 /* How long in useconds between probe-rtt */ +#define TCP_BBR_ONE_RETRAN 1073 /* Is only one segment allowed out during retran */ +#define TCP_BBR_STARTUP_LOSS_EXIT 1074 /* Do we exit a loss during startup if not 20% incr */ +#define TCP_BBR_USE_LOWGAIN 1075 /* lower the gain in PROBE_BW enable */ +#define TCP_BBR_LOWGAIN_THRESH 1076 /* How many cycles do we stay in lowgain */ +#define TCP_BBR_LOWGAIN_HALF 1077 /* Do we halfstep lowgain down */ +#define TCP_BBR_LOWGAIN_FD 1078 /* Do we force a drain when lowgain in place */ +#define TCP_BBR_USEDEL_RATE 1079 /* Enable use of delivery rate for loss recovery */ +#define TCP_BBR_MIN_RTO 1080 /* Min RTO in milliseconds */ +#define TCP_BBR_MAX_RTO 1081 /* Max RTO in milliseconds */ +#define TCP_BBR_REC_OVER_HPTS 1082 /* Recovery override htps settings 0/1/3 */ +#define TCP_BBR_UNLIMITED 1083 /* Does BBR, in non-recovery not use cwnd */ +#define TCP_BBR_DRAIN_INC_EXTRA 1084 /* Does the 3/4 drain target include the extra gain */ +#define TCP_BBR_STARTUP_EXIT_EPOCH 1085 /* what epoch gets us out of startup */ +#define TCP_BBR_PACE_PER_SEC 1086 +#define TCP_BBR_PACE_DEL_TAR 1087 +#define TCP_BBR_PACE_SEG_MAX 1088 +#define TCP_BBR_PACE_SEG_MIN 1089 +#define TCP_BBR_PACE_CROSS 1090 +#define TCP_RACK_IDLE_REDUCE_HIGH 1092 /* Reduce the highest cwnd seen to IW on idle */ +#define TCP_RACK_IDLE_REDUCE_HIGH 1092 /* Reduce the highest cwnd seen to IW on idle */ +#define TCP_RACK_MIN_PACE 1093 /* Do we enforce rack min pace time */ +#define TCP_RACK_MIN_PACE_SEG 1094 /* If so what is the seg threshould */ +#define TCP_RACK_TLP_USE 1095 +#define TCP_BBR_ACK_COMP_ALG 1096 /* Not used */ +#define TCP_BBR_EXTRA_GAIN 1097 +#define TCP_BBR_RACK_RTT_USE 1098 /* what RTT should we use 0, 1, or 2? */ +#define TCP_BBR_RETRAN_WTSO 1099 +#define TCP_DATA_AFTER_CLOSE 1100 +#define TCP_BBR_PROBE_RTT_GAIN 1101 +#define TCP_BBR_PROBE_RTT_LEN 1102 + + /* Start of reserved space for third-party user-settable options. */ #define TCP_VENDOR SO_VENDOR @@ -185,6 +251,9 @@ #define TCPI_OPT_ECN 0x08 #define TCPI_OPT_TOE 0x10 +/* Maximum length of log ID. */ +#define TCP_LOG_ID_LEN 64 + /* * The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits * the caller to query certain information about the state of a TCP @@ -250,6 +319,16 @@ /* Padding to grow without breaking ABI. */ u_int32_t __tcpi_pad[26]; /* Padding. */ }; + +/* + * If this structure is provided when setting the TCP_FASTOPEN socket + * option, and the enable member is non-zero, a subsequent connect will use + * pre-shared key (PSK) mode using the provided key. + */ +struct tcp_fastopen { + int enable; + uint8_t psk[TCP_FASTOPEN_PSK_LEN]; +}; #endif #define TCP_FUNCTION_NAME_LEN_MAX 32 diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/netinet6/in6.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/netinet6/in6.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/netinet6/in6.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/netinet6/in6.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * @@ -58,7 +60,7 @@ * SUCH DAMAGE. * * @(#)in.h 8.3 (Berkeley) 1/3/94 - * $FreeBSD: head/sys/netinet6/in6.h 314722 2017-03-06 04:01:58Z eri $ + * $FreeBSD: head/sys/netinet6/in6.h 337783 2018-08-14 17:27:41Z jtl $ */ #ifndef __KAME_NETINET_IN_H_INCLUDED_ @@ -101,11 +103,6 @@ }; #define s6_addr __u6_addr.__u6_addr8 -#ifdef _KERNEL /* XXX nonstandard */ -#define s6_addr8 __u6_addr.__u6_addr8 -#define s6_addr16 __u6_addr.__u6_addr16 -#define s6_addr32 __u6_addr.__u6_addr32 -#endif #define INET6_ADDRSTRLEN 46 @@ -130,56 +127,6 @@ }; /* - * Local definition for masks - */ -#ifdef _KERNEL /* XXX nonstandard */ -#define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}} -#define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} -#define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} -#define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}} -#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}} -#endif - -#ifdef _KERNEL -extern const struct sockaddr_in6 sa6_any; - -extern const struct in6_addr in6mask0; -extern const struct in6_addr in6mask32; -extern const struct in6_addr in6mask64; -extern const struct in6_addr in6mask96; -extern const struct in6_addr in6mask128; -#endif /* _KERNEL */ - -/* - * Macros started with IPV6_ADDR is KAME local - */ -#ifdef _KERNEL /* XXX nonstandard */ -#if _BYTE_ORDER == _BIG_ENDIAN -#define IPV6_ADDR_INT32_ONE 1 -#define IPV6_ADDR_INT32_TWO 2 -#define IPV6_ADDR_INT32_MNL 0xff010000 -#define IPV6_ADDR_INT32_MLL 0xff020000 -#define IPV6_ADDR_INT32_SMP 0x0000ffff -#define IPV6_ADDR_INT16_ULL 0xfe80 -#define IPV6_ADDR_INT16_USL 0xfec0 -#define IPV6_ADDR_INT16_MLL 0xff02 -#elif _BYTE_ORDER == _LITTLE_ENDIAN -#define IPV6_ADDR_INT32_ONE 0x01000000 -#define IPV6_ADDR_INT32_TWO 0x02000000 -#define IPV6_ADDR_INT32_MNL 0x000001ff -#define IPV6_ADDR_INT32_MLL 0x000002ff -#define IPV6_ADDR_INT32_SMP 0xffff0000 -#define IPV6_ADDR_INT16_ULL 0x80fe -#define IPV6_ADDR_INT16_USL 0xc0fe -#define IPV6_ADDR_INT16_MLL 0x02ff -#endif -#endif - -/* * Definition of some useful macros to handle IP6 addresses */ #if __BSD_VISIBLE @@ -221,15 +168,10 @@ * does not supply memcmp(). For userland memcmp() is preferred as it is * in ANSI standard. */ -#ifdef _KERNEL -#define IN6_ARE_ADDR_EQUAL(a, b) \ - (bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) -#else #if __BSD_VISIBLE #define IN6_ARE_ADDR_EQUAL(a, b) \ (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) #endif -#endif /* * Unspecified @@ -271,14 +213,7 @@ * KAME Scope Values */ -#ifdef _KERNEL /* XXX nonstandard */ -#define IPV6_ADDR_SCOPE_NODELOCAL 0x01 -#define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 -#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 -#define IPV6_ADDR_SCOPE_SITELOCAL 0x05 -#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */ -#define IPV6_ADDR_SCOPE_GLOBAL 0x0e -#else +#ifndef _KERNEL #define __IPV6_ADDR_SCOPE_NODELOCAL 0x01 #define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 #define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02 @@ -301,35 +236,14 @@ */ #define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) -#ifdef _KERNEL /* XXX nonstandard */ -#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) -#else +#ifndef _KERNEL #define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) #endif /* * Multicast Scope */ -#ifdef _KERNEL /* refers nonstandard items */ -#define IN6_IS_ADDR_MC_NODELOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL)) -#define IN6_IS_ADDR_MC_INTFACELOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL)) -#define IN6_IS_ADDR_MC_LINKLOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL)) -#define IN6_IS_ADDR_MC_SITELOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL)) -#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL)) -#define IN6_IS_ADDR_MC_GLOBAL(a) \ - (IN6_IS_ADDR_MULTICAST(a) && \ - (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL)) -#else +#ifndef _KERNEL #define IN6_IS_ADDR_MC_NODELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL)) @@ -347,28 +261,6 @@ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL)) #endif -#ifdef _KERNEL /* nonstandard */ -/* - * KAME Scope - */ -#define IN6_IS_SCOPE_LINKLOCAL(a) \ - ((IN6_IS_ADDR_LINKLOCAL(a)) || \ - (IN6_IS_ADDR_MC_LINKLOCAL(a))) -#define IN6_IS_SCOPE_EMBED(a) \ - ((IN6_IS_ADDR_LINKLOCAL(a)) || \ - (IN6_IS_ADDR_MC_LINKLOCAL(a)) || \ - (IN6_IS_ADDR_MC_INTFACELOCAL(a))) - -#define IFA6_IS_DEPRECATED(a) \ - ((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \ - (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \ - (a)->ia6_lifetime.ia6t_pltime) -#define IFA6_IS_INVALID(a) \ - ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \ - (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \ - (a)->ia6_lifetime.ia6t_vltime) -#endif /* _KERNEL */ - /* * IP6 route structure */ @@ -389,11 +281,6 @@ }; #endif -#ifdef _KERNEL -#define MTAG_ABI_IPV6 1444287380 /* IPv6 ABI */ -#define IPV6_TAG_DIRECT 0 /* direct-dispatch IPv6 */ -#endif /* _KERNEL */ - /* * Options for use with [gs]etsockopt at the IPV6 level. * First word of comment is data type; bool is stored in int. @@ -415,16 +302,6 @@ #define IPV6_LEAVE_GROUP 13 /* ipv6_mreq; leave a group membership */ #define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */ #define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */ -/* RFC2292 options */ -#ifdef _KERNEL -#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */ -#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */ -#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */ -#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */ -#define IPV6_2292DSTOPTS 23 /* bool; destinaion option */ -#define IPV6_2292RTHDR 24 /* bool; routing header */ -#define IPV6_2292PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */ -#endif #define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */ #define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */ @@ -450,9 +327,6 @@ #define IPV6_RECVRTHDR 38 /* bool; recv routing header */ #define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */ #define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */ -#ifdef _KERNEL -#define IPV6_RECVRTHDRDSTOPTS 41 /* bool; recv dst option before rthdr */ -#endif #define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */ #define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */ @@ -640,7 +514,9 @@ #define IPV6CTL_INTRQMAXLEN 51 /* max length of IPv6 netisr queue */ #define IPV6CTL_INTRDQMAXLEN 52 /* max length of direct IPv6 netisr * queue */ -#define IPV6CTL_MAXID 53 +#define IPV6CTL_MAXFRAGSPERPACKET 53 /* Max fragments per packet */ +#define IPV6CTL_MAXFRAGBUCKETSIZE 54 /* Max reassembly queues per bucket */ +#define IPV6CTL_MAXID 55 #endif /* __BSD_VISIBLE */ /* @@ -656,38 +532,7 @@ #define M_LOOP M_PROTO6 #define M_AUTHIPDGM M_PROTO7 #define M_RTALERT_MLD M_PROTO8 - -#ifdef _KERNEL -struct cmsghdr; -struct ip6_hdr; - -int in6_cksum_pseudo(struct ip6_hdr *, uint32_t, uint8_t, uint16_t); -int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t); -int in6_cksum_partial(struct mbuf *, u_int8_t, u_int32_t, u_int32_t, - u_int32_t); -int in6_localaddr(struct in6_addr *); -int in6_localip(struct in6_addr *); -int in6_ifhasaddr(struct ifnet *, struct in6_addr *); -int in6_addrscope(const struct in6_addr *); -char *ip6_sprintf(char *, const struct in6_addr *); -struct in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *); -extern void in6_if_up(struct ifnet *); -struct sockaddr; -extern u_char ip6_protox[]; - -void in6_sin6_2_sin(struct sockaddr_in *sin, - struct sockaddr_in6 *sin6); -void in6_sin_2_v4mapsin6(struct sockaddr_in *sin, - struct sockaddr_in6 *sin6); -void in6_sin6_2_sin_in_sock(struct sockaddr *nam); -void in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam); -extern void addrsel_policy_init(void); - -#define satosin6(sa) ((struct sockaddr_in6 *)(sa)) -#define sin6tosa(sin6) ((struct sockaddr *)(sin6)) -#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) - -#endif /* _KERNEL */ +#define M_FRAGMENTED M_PROTO9 /* contained fragment header */ #ifndef _SIZE_T_DECLARED typedef __size_t size_t; @@ -745,4 +590,8 @@ #endif /* __BSD_VISIBLE */ +#ifdef _KERNEL +/* Header file provided outside of Newlib */ +#include +#endif #endif /* !_NETINET6_IN6_H_ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_bitset.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_bitset.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_bitset.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_bitset.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008, Jeffrey Roberson * All rights reserved. * @@ -26,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/sys/sys/_bitset.h 299184 2016-05-06 16:41:23Z royger $ + * $FreeBSD: head/sys/sys/_bitset.h 331723 2018-03-29 02:54:50Z jeff $ */ #ifndef _SYS__BITSET_H_ @@ -55,4 +57,10 @@ */ #define BITSET_DEFINE_VAR(t) BITSET_DEFINE(t, 1) +/* + * Define a default type that can be used while manually specifying size + * to every call. + */ +BITSET_DEFINE(bitset, 1); + #endif /* !_SYS__BITSET_H_ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/bitset.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/bitset.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/bitset.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/bitset.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008, Jeffrey Roberson * All rights reserved. * @@ -26,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/sys/sys/bitset.h 320893 2017-07-11 12:35:44Z kib $ + * $FreeBSD: head/sys/sys/bitset.h 326256 2017-11-27 15:01:59Z pfg $ */ #ifndef _SYS_BITSET_H_ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_cpuset.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_cpuset.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_cpuset.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_cpuset.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008, Jeffrey Roberson * All rights reserved. * @@ -26,19 +28,22 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/sys/sys/_cpuset.h 299122 2016-05-05 15:43:26Z jhb $ + * $FreeBSD: head/sys/sys/_cpuset.h 326256 2017-11-27 15:01:59Z pfg $ */ #ifndef _SYS__CPUSET_H_ #define _SYS__CPUSET_H_ #include -#include #define CPU_MAXSIZE 256 #ifndef CPU_SETSIZE -#define CPU_SETSIZE MAXCPU +#ifdef __LONG_WIDTH__ +#define CPU_SETSIZE __LONG_WIDTH__ +#else +#define CPU_SETSIZE 32 +#endif #endif BITSET_DEFINE(_cpuset, CPU_SETSIZE); diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/dirent.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/dirent.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/dirent.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/dirent.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,17 +1,53 @@ -#ifndef _SYS_DIRENT_H -# define _SYS_DIRENT_H +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)dirent.h 8.3 (Berkeley) 8/10/94 + * $FreeBSD: head/sys/sys/dirent.h 335494 2018-06-21 16:40:07Z bdrewery $ + */ + +#ifndef _SYS_DIRENT_H_ +#define _SYS_DIRENT_H_ -#ifdef __cplusplus -extern "C" { +#include +#include +#include + +#ifndef _INO_T_DECLARED +typedef __ino_t ino_t; +#define _INO_T_DECLARED #endif -/* - * This file was written to be compatible with the BSD directory - * routines, so it looks like it. But it was written from scratch. - * Sean Eric Fagan, sef@Kithrup.COM - * - * Copied to RTEMS configuration without modification. - */ +#ifndef _OFF_T_DECLARED +typedef __off_t off_t; +#define _OFF_T_DECLARED +#endif typedef struct _dirdesc { int dd_fd; @@ -22,48 +58,63 @@ long dd_seek; } DIR; -# define __dirfd(dp) ((dp)->dd_fd) +/* + * The dirent structure defines the format of directory entries returned by + * the getdirentries(2) system call. + * + * A directory entry has a struct dirent at the front of it, containing its + * inode number, the length of the entry, and the length of the name + * contained in the entry. These are followed by the name padded to an 8 + * byte boundary with null bytes. All names are guaranteed null terminated. + * The maximum length of a name in a directory is MAXNAMLEN. + * + * Explicit padding between the last member of the header (d_namlen) and + * d_name avoids ABI padding at the end of dirent on LP64 architectures. + * There is code depending on d_name being last. + */ -DIR *opendir(const char *); -struct dirent *readdir(DIR *); -int readdir_r(DIR *__restrict, struct dirent *__restrict, - struct dirent **__restrict); -void rewinddir(DIR *); -int closedir(DIR *); -void seekdir(DIR *dir, long loc); -long telldir(DIR *dir); +struct dirent { + ino_t d_fileno; /* file number of entry */ + off_t d_off; /* directory offset of entry */ + __uint16_t d_reclen; /* length of this record */ + __uint8_t d_type; /* file type, see below */ + __uint16_t d_namlen; /* length of string in d_name */ + char d_name[NAME_MAX + 1]; /* name must be no longer than this */ +}; -#ifdef _COMPILING_NEWLIB -void _seekdir(DIR *dir, long offset); +#if __BSD_VISIBLE +#define MAXNAMLEN NAME_MAX #endif -#include - -#include +/* + * XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer + * to the specification. + */ +#define d_ino d_fileno /* backward and XSI compatibility */ -struct dirent { - long d_ino; - off_t d_off; - unsigned short d_reclen; - /* we need better syntax for variable-sized arrays */ - unsigned short d_namlen; - char d_name[NAME_MAX + 1]; -}; +#define __dirfd(dp) ((dp)->dd_fd) #if __BSD_VISIBLE -#define MAXNAMLEN NAME_MAX -#endif -int alphasort(const struct dirent **, const struct dirent **); -int scandir ( const char *dirname, - struct dirent *** namelist, - int (*select)(const struct dirent *), - int (*dcomp)(const struct dirent **, const struct dirent **) -); +/* + * File types + */ +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 -#ifdef __cplusplus -} -#endif +/* + * Convert between stat structure types and directory types. + */ +#define IFTODT(mode) (((mode) & 0170000) >> 12) +#define DTTOIF(dirtype) ((dirtype) << 12) +#endif /* __BSD_VISIBLE */ -#endif +#endif /* !_SYS_DIRENT_H_ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/filio.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/filio.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/filio.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/filio.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -32,7 +34,7 @@ * SUCH DAMAGE. * * @(#)filio.h 8.1 (Berkeley) 3/28/94 - * $FreeBSD: head/sys/sys/filio.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/sys/filio.h 326023 2017-11-20 19:43:44Z pfg $ */ #ifndef _SYS_FILIO_H_ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/ioccom.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/ioccom.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/ioccom.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/ioccom.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * @@ -66,6 +68,10 @@ #define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) /* this should be _IORW, but stdio got there first */ #define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) +/* Replace length/type in an ioctl command. */ +#define _IOC_NEWLEN(ioc, len) \ + (((~(IOCPARM_MASK << 16)) & (ioc)) | (((len) & IOCPARM_MASK) << 16)) +#define _IOC_NEWTYPE(ioc, type) _IOC_NEWLEN((ioc), sizeof(type)) #ifdef _KERNEL diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/ioctl.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/ioctl.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/ioctl.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/ioctl.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -32,7 +34,7 @@ * SUCH DAMAGE. * * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 - * $FreeBSD: head/sys/sys/ioctl.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/sys/ioctl.h 326023 2017-11-20 19:43:44Z pfg $ */ #ifndef _SYS_IOCTL_H_ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_iovec.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_iovec.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_iovec.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_iovec.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993, 1994 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)uio.h 8.5 (Berkeley) 2/22/94 - * $FreeBSD: head/sys/sys/_iovec.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/sys/_iovec.h 326023 2017-11-20 19:43:44Z pfg $ */ #ifndef _SYS__IOVEC_H_ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/mman.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/mman.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/mman.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/mman.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * @@ -10,7 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)mman.h 8.2 (Berkeley) 1/9/95 - * $FreeBSD$ + * $FreeBSD: head/sys/sys/mman.h 326023 2017-11-20 19:43:44Z pfg $ */ #ifndef _SYS_MMAN_H_ @@ -43,6 +45,7 @@ #define INHERIT_SHARE 0 #define INHERIT_COPY 1 #define INHERIT_NONE 2 +#define INHERIT_ZERO 3 #endif /* @@ -69,8 +72,8 @@ #define MAP_FIXED 0x0010 /* map addr must be exactly as requested */ #if __BSD_VISIBLE -#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */ -#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */ +#define MAP_RESERVED0020 0x0020 /* previously unimplemented MAP_RENAME */ +#define MAP_RESERVED0040 0x0040 /* previously unimplemented MAP_NORESERVE */ #define MAP_RESERVED0080 0x0080 /* previously misimplemented MAP_INHERIT */ #define MAP_RESERVED0100 0x0100 /* previously unimplemented MAP_NOEXTEND */ #define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */ @@ -89,8 +92,13 @@ /* * Extended flags */ +#define MAP_GUARD 0x00002000 /* reserve but don't map address range */ +#define MAP_EXCL 0x00004000 /* for MAP_FIXED, fail if address is used */ #define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */ #define MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */ +#ifdef __LP64__ +#define MAP_32BIT 0x00080000 /* map in the low 2GB of address space */ +#endif /* * Request specific alignment (n == log2 of the desired alignment). @@ -189,43 +197,7 @@ #define _SIZE_T_DECLARED #endif -#if defined(_KERNEL) || defined(_WANT_FILE) -#include - -struct file; - -struct shmfd { - size_t shm_size; - vm_object_t shm_object; - int shm_refs; - uid_t shm_uid; - gid_t shm_gid; - mode_t shm_mode; - int shm_kmappings; - - /* - * Values maintained solely to make this a better-behaved file - * descriptor for fstat() to run on. - */ - struct timespec shm_atime; - struct timespec shm_mtime; - struct timespec shm_ctime; - struct timespec shm_birthtime; - ino_t shm_ino; - - struct label *shm_label; /* MAC label */ - const char *shm_path; -}; -#endif - -#ifdef _KERNEL -int shm_mmap(struct shmfd *shmfd, vm_size_t objsize, vm_ooffset_t foff, - vm_object_t *obj); -int shm_map(struct file *fp, size_t size, off_t offset, void **memp); -int shm_unmap(struct file *fp, void *mem, size_t size); -void shm_path(struct shmfd *shmfd, char *path, size_t size); - -#else /* !_KERNEL */ +#ifndef _KERNEL __BEGIN_DECLS /* @@ -243,7 +215,7 @@ #define _MMAP_DECLARED void * mmap(void *, size_t, int, int, int, off_t); #endif -int mprotect(const void *, size_t, int); +int mprotect(void *, size_t, int); int msync(void *, size_t, int); int munlock(const void *, size_t); int munmap(void *, size_t); @@ -260,4 +232,8 @@ #endif /* !_KERNEL */ +#ifdef _KERNEL +/* Header file provided outside of Newlib */ +#include +#endif #endif /* !_SYS_MMAN_H_ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)socket.h 8.4 (Berkeley) 2/21/94 - * $FreeBSD: head/sys/sys/_sockaddr_storage.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/sys/_sockaddr_storage.h 326023 2017-11-20 19:43:44Z pfg $ */ #ifndef _SYS__SOCKADDR_STORAGE_H_ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/socket.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/socket.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/socket.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/socket.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)socket.h 8.4 (Berkeley) 2/21/94 - * $FreeBSD: head/sys/sys/socket.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/sys/socket.h 338136 2018-08-21 14:04:30Z tuexen $ */ #ifndef _SYS_SOCKET_H_ @@ -111,31 +113,32 @@ */ #define SOCK_CLOEXEC 0x10000000 #define SOCK_NONBLOCK 0x20000000 -#endif +#endif /* __BSD_VISIBLE */ /* * Option flags per-socket. */ -#define SO_DEBUG 0x0001 /* turn on debugging info recording */ -#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ -#define SO_REUSEADDR 0x0004 /* allow local address reuse */ -#define SO_KEEPALIVE 0x0008 /* keep connections alive */ -#define SO_DONTROUTE 0x0010 /* just use interface addresses */ -#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ -#if __BSD_VISIBLE -#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ -#endif -#define SO_LINGER 0x0080 /* linger on close if data present */ -#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ -#if __BSD_VISIBLE -#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ -#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */ -#define SO_NOSIGPIPE 0x0800 /* no SIGPIPE from EPIPE */ -#define SO_ACCEPTFILTER 0x1000 /* there is an accept filter */ -#define SO_BINTIME 0x2000 /* timestamp received dgram traffic */ -#endif -#define SO_NO_OFFLOAD 0x4000 /* socket cannot be offloaded */ -#define SO_NO_DDP 0x8000 /* disable direct data placement */ +#define SO_DEBUG 0x00000001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x00000002 /* socket has had listen() */ +#define SO_REUSEADDR 0x00000004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x00000008 /* keep connections alive */ +#define SO_DONTROUTE 0x00000010 /* just use interface addresses */ +#define SO_BROADCAST 0x00000020 /* permit sending of broadcast msgs */ +#if __BSD_VISIBLE +#define SO_USELOOPBACK 0x00000040 /* bypass hardware when possible */ +#endif +#define SO_LINGER 0x00000080 /* linger on close if data present */ +#define SO_OOBINLINE 0x00000100 /* leave received OOB data in line */ +#if __BSD_VISIBLE +#define SO_REUSEPORT 0x00000200 /* allow local address & port reuse */ +#define SO_TIMESTAMP 0x00000400 /* timestamp received dgram traffic */ +#define SO_NOSIGPIPE 0x00000800 /* no SIGPIPE from EPIPE */ +#define SO_ACCEPTFILTER 0x00001000 /* there is an accept filter */ +#define SO_BINTIME 0x00002000 /* timestamp received dgram traffic */ +#endif +#define SO_NO_OFFLOAD 0x00004000 /* socket cannot be offloaded */ +#define SO_NO_DDP 0x00008000 /* disable direct data placement */ +#define SO_REUSEPORT_LB 0x00010000 /* reuse with load balancing */ /* * Additional options, not kept in so_options. @@ -160,6 +163,7 @@ #define SO_PROTOTYPE SO_PROTOCOL /* alias for SO_PROTOCOL (SunOS name) */ #define SO_TS_CLOCK 0x1017 /* clock type used for SO_TIMESTAMP */ #define SO_MAX_PACING_RATE 0x1018 /* socket's max TX pacing rate (Linux name) */ +#define SO_DOMAIN 0x1019 /* get socket domain */ #endif #if __BSD_VISIBLE @@ -443,9 +447,6 @@ #define MSG_NBIO 0x00004000 /* FIONBIO mode, used by fifofs */ #define MSG_COMPAT 0x00008000 /* used in sendit() */ #endif -#ifdef _KERNEL -#define MSG_SOCALLBCK 0x00010000 /* for use by socket callbacks - soreceive (TCP) */ -#endif #if __POSIX_VISIBLE >= 200809 #define MSG_NOSIGNAL 0x00020000 /* do not generate SIGPIPE on EOF */ #endif @@ -453,9 +454,6 @@ #define MSG_CMSG_CLOEXEC 0x00040000 /* make received fds close-on-exec */ #define MSG_WAITFORONE 0x00080000 /* for recvmmsg() */ #endif -#ifdef _KERNEL -#define MSG_MORETOCOME 0x00100000 /* additional data pending */ -#endif /* * Header for ancillary data objects in msg_control buffer. @@ -543,10 +541,6 @@ #define CMSG_LEN(l) (_ALIGN(sizeof(struct cmsghdr)) + (l)) #endif -#ifdef _KERNEL -#define CMSG_ALIGN(n) _ALIGN(n) -#endif - /* "Socket"-level control message types: */ #define SCM_RIGHTS 0x01 /* access rights (array of int) */ #if __BSD_VISIBLE @@ -555,6 +549,17 @@ #define SCM_BINTIME 0x04 /* timestamp (struct bintime) */ #define SCM_REALTIME 0x05 /* timestamp (struct timespec) */ #define SCM_MONOTONIC 0x06 /* timestamp (struct timespec) */ +#define SCM_TIME_INFO 0x07 /* timestamp info */ + +struct sock_timestamp_info { + __uint32_t st_info_flags; + __uint32_t st_info_pad0; + __uint64_t st_info_rsv[7]; +}; + +#define ST_INFO_HW 0x0001 /* SCM_TIMESTAMP was hw */ +#define ST_INFO_HW_HPREC 0x0002 /* SCM_TIMESTAMP was hw-assisted + on entrance */ #endif #if __BSD_VISIBLE @@ -616,10 +621,6 @@ #define SF_NOCACHE 0x00000010 #define SF_FLAGS(rh, flags) (((rh) << 16) | (flags)) -#ifdef _KERNEL -#define SF_READAHEAD(flags) ((flags) >> 16) -#endif /* _KERNEL */ - /* * Sendmmsg/recvmmsg specific structure(s) */ @@ -673,40 +674,7 @@ #endif /* !_KERNEL */ #ifdef _KERNEL -struct socket; - -struct tcpcb *so_sototcpcb(struct socket *so); -struct inpcb *so_sotoinpcb(struct socket *so); -struct sockbuf *so_sockbuf_snd(struct socket *); -struct sockbuf *so_sockbuf_rcv(struct socket *); - -int so_state_get(const struct socket *); -void so_state_set(struct socket *, int); - -int so_options_get(const struct socket *); -void so_options_set(struct socket *, int); - -int so_error_get(const struct socket *); -void so_error_set(struct socket *, int); - -int so_linger_get(const struct socket *); -void so_linger_set(struct socket *, int); - -struct protosw *so_protosw_get(const struct socket *); -void so_protosw_set(struct socket *, struct protosw *); - -void so_sorwakeup_locked(struct socket *so); -void so_sowwakeup_locked(struct socket *so); - -void so_sorwakeup(struct socket *so); -void so_sowwakeup(struct socket *so); - -void so_lock(struct socket *so); -void so_unlock(struct socket *so); - -void so_listeners_apply_all(struct socket *so, void (*func)(struct socket *, void *), void *arg); - +/* Header file provided outside of Newlib */ +#include #endif - - #endif /* !_SYS_SOCKET_H_ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/sockio.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/sockio.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/sockio.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/sockio.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)sockio.h 8.1 (Berkeley) 3/28/94 - * $FreeBSD: head/sys/sys/sockio.h 318160 2017-05-10 22:13:47Z rpokala $ + * $FreeBSD: head/sys/sys/sockio.h 331622 2018-03-27 15:29:32Z kib $ */ #ifndef _SYS_SOCKIO_H_ @@ -134,4 +136,11 @@ #define SIOCGIFGMEMB _IOWR('i', 138, struct ifgroupreq) /* get members */ #define SIOCGIFXMEDIA _IOWR('i', 139, struct ifmediareq) /* get net xmedia */ +#define SIOCGIFRSSKEY _IOWR('i', 150, struct ifrsskey)/* get RSS key */ +#define SIOCGIFRSSHASH _IOWR('i', 151, struct ifrsshash)/* get the current RSS + type/func settings */ + +#define SIOCGLANPCP _IOWR('i', 152, struct ifreq) /* Get (V)LAN PCP */ +#define SIOCSLANPCP _IOW('i', 153, struct ifreq) /* Set (V)LAN PCP */ + #endif /* !_SYS_SOCKIO_H_ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/syslog.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/syslog.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/syslog.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/syslog.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)syslog.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD: head/sys/sys/syslog.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/sys/syslog.h 326023 2017-11-20 19:43:44Z pfg $ */ #ifndef _SYS_SYSLOG_H_ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_termios.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_termios.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_termios.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_termios.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988, 1989, 1993, 1994 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)termios.h 8.3 (Berkeley) 3/28/94 - * $FreeBSD: head/sys/sys/_termios.h 318780 2017-05-24 09:25:13Z kib $ + * $FreeBSD: head/sys/sys/_termios.h 326023 2017-11-20 19:43:44Z pfg $ */ #ifndef _SYS__TERMIOS_H_ @@ -91,8 +93,10 @@ #define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */ #define IXON 0x00000200 /* enable output flow control */ #define IXOFF 0x00000400 /* enable input flow control */ -#if __BSD_VISIBLE +#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 #define IXANY 0x00000800 /* any char will restart after stop */ +#endif +#if __BSD_VISIBLE #define IMAXBEL 0x00002000 /* ring bell on input queue full */ #endif @@ -100,12 +104,16 @@ * Output flags - software output processing */ #define OPOST 0x00000001 /* enable following output processing */ -#if __BSD_VISIBLE +#if __BSD_VISIBLE || __XSI_VISIBLE #define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */ +#endif +#if __BSD_VISIBLE #define TABDLY 0x00000004 /* tab delay mask */ #define TAB0 0x00000000 /* no tab delay and expansion */ #define TAB3 0x00000004 /* expand tabs to spaces */ #define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */ +#endif +#if __BSD_VISIBLE || __XSI_VISIBLE #define OCRNL 0x00000010 /* map CR to NL on output */ #define ONOCR 0x00000020 /* no CR output at column 0 */ #define ONLRET 0x00000040 /* NL performs CR function */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/ttycom.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/ttycom.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/ttycom.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/ttycom.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -32,7 +34,7 @@ * SUCH DAMAGE. * * @(#)ttycom.h 8.1 (Berkeley) 3/28/94 - * $FreeBSD: head/sys/sys/ttycom.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/sys/ttycom.h 326023 2017-11-20 19:43:44Z pfg $ */ #ifndef _SYS_TTYCOM_H_ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/ttydefaults.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/ttydefaults.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/ttydefaults.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/ttydefaults.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. @@ -32,7 +34,7 @@ * SUCH DAMAGE. * * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 - * $FreeBSD: head/sys/sys/ttydefaults.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/sys/ttydefaults.h 326023 2017-11-20 19:43:44Z pfg $ */ /* diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_uio.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_uio.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/_uio.h 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/_uio.h 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1982, 1986, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)uio.h 8.5 (Berkeley) 2/22/94 + * $FreeBSD: head/sys/sys/_uio.h 331621 2018-03-27 15:20:03Z brooks $ + */ + +#ifndef _SYS__UIO_H_ +#define _SYS__UIO_H_ + +#if __BSD_VISIBLE +enum uio_rw { + UIO_READ, + UIO_WRITE +}; + +/* Segment flag values. */ +enum uio_seg { + UIO_USERSPACE, /* from user data space */ + UIO_SYSSPACE, /* from system space */ + UIO_NOCOPY /* don't copy, already in object */ +}; +#endif /* __BSD_VISIBLE */ + +#endif /* !_SYS__UIO_H_ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/uio.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/uio.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/uio.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/uio.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993, 1994 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)uio.h 8.5 (Berkeley) 2/22/94 - * $FreeBSD: head/sys/sys/uio.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/sys/uio.h 331621 2018-03-27 15:20:03Z brooks $ */ #ifndef _SYS_UIO_H_ @@ -36,6 +38,7 @@ #include #include #include +#include #ifndef _SSIZE_T_DECLARED typedef __ssize_t ssize_t; @@ -47,70 +50,7 @@ #define _OFF_T_DECLARED #endif -#if __BSD_VISIBLE -enum uio_rw { UIO_READ, UIO_WRITE }; - -/* Segment flag values. */ -enum uio_seg { - UIO_USERSPACE, /* from user data space */ - UIO_SYSSPACE, /* from system space */ - UIO_NOCOPY /* don't copy, already in object */ -}; -#endif - -#ifdef _KERNEL - -struct uio { - struct iovec *uio_iov; /* scatter/gather list */ - int uio_iovcnt; /* length of scatter/gather list */ - off_t uio_offset; /* offset in target object */ - ssize_t uio_resid; /* remaining bytes to process */ - enum uio_seg uio_segflg; /* address space */ - enum uio_rw uio_rw; /* operation */ - struct thread *uio_td; /* owner */ -}; - -/* - * Limits - * - * N.B.: UIO_MAXIOV must be no less than IOV_MAX from - * which in turn must be no less than _XOPEN_IOV_MAX from . If - * we ever make this tunable (probably pointless), then IOV_MAX should be - * removed from and applications would be expected to use - * sysconf(3) to find out the correct value, or else assume the worst - * (_XOPEN_IOV_MAX). Perhaps UIO_MAXIOV should be simply defined as - * IOV_MAX. - */ -#define UIO_MAXIOV 1024 /* max 1K of iov's */ - -struct vm_object; -struct vm_page; -struct bus_dma_segment; - -struct uio *cloneuio(struct uio *uiop); -int copyinfrom(const void * __restrict src, void * __restrict dst, - size_t len, int seg); -int copyiniov(const struct iovec *iovp, u_int iovcnt, struct iovec **iov, - int error); -int copyinstrfrom(const void * __restrict src, void * __restrict dst, - size_t len, size_t * __restrict copied, int seg); -int copyinuio(const struct iovec *iovp, u_int iovcnt, struct uio **uiop); -int copyout_map(struct thread *td, vm_offset_t *addr, size_t sz); -int copyout_unmap(struct thread *td, vm_offset_t addr, size_t sz); -int physcopyin(void *src, vm_paddr_t dst, size_t len); -int physcopyout(vm_paddr_t src, void *dst, size_t len); -int physcopyin_vlist(struct bus_dma_segment *src, off_t offset, - vm_paddr_t dst, size_t len); -int physcopyout_vlist(vm_paddr_t src, struct bus_dma_segment *dst, - off_t offset, size_t len); -int uiomove(void *cp, int n, struct uio *uio); -int uiomove_frombuf(void *buf, int buflen, struct uio *uio); -int uiomove_fromphys(struct vm_page *ma[], vm_offset_t offset, int n, - struct uio *uio); -int uiomove_nofault(void *cp, int n, struct uio *uio); -int uiomove_object(struct vm_object *obj, off_t obj_size, struct uio *uio); - -#else /* !_KERNEL */ +#ifndef _KERNEL __BEGIN_DECLS ssize_t readv(int, const struct iovec *, int); @@ -121,6 +61,10 @@ #endif __END_DECLS -#endif /* _KERNEL */ +#endif /* !_KERNEL */ +#ifdef _KERNEL +/* Header file provided outside of Newlib */ +#include +#endif #endif /* !_SYS_UIO_H_ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/un.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/un.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/sys/un.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/sys/un.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)un.h 8.3 (Berkeley) 2/19/95 - * $FreeBSD: head/sys/sys/un.h 314436 2017-02-28 23:42:47Z imp $ + * $FreeBSD: head/sys/sys/un.h 326023 2017-11-20 19:43:44Z pfg $ */ #ifndef _SYS_UN_H_ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/termios.h libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/termios.h --- libnewlib-nano-2.10.0/newlib/libc/sys/rtems/include/termios.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/rtems/include/termios.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1988, 1989, 1993, 1994 * The Regents of the University of California. All rights reserved. * @@ -27,7 +29,7 @@ * SUCH DAMAGE. * * @(#)termios.h 8.3 (Berkeley) 3/28/94 - * $FreeBSD: head/include/termios.h 318780 2017-05-24 09:25:13Z kib $ + * $FreeBSD: head/include/termios.h 326024 2017-11-20 19:45:28Z pfg $ */ #ifndef _TERMIOS_H_ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/sh/configure libnewlib-nano-2.11.2/newlib/libc/sys/sh/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/sh/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/sh/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/sparc64/configure libnewlib-nano-2.11.2/newlib/libc/sys/sparc64/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/sparc64/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/sparc64/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/sparc64/sys/dirent.h libnewlib-nano-2.11.2/newlib/libc/sys/sparc64/sys/dirent.h --- libnewlib-nano-2.10.0/newlib/libc/sys/sparc64/sys/dirent.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/sparc64/sys/dirent.h 2018-11-14 22:26:13.000000000 +0000 @@ -19,13 +19,6 @@ # define __dirfd(dp) ((dp)->dd_fd) -DIR *opendir (const char *); -struct dirent *readdir (DIR *); -int readdir_r (DIR *__restrict, struct dirent *__restrict, - struct dirent **__restrict); -void rewinddir (DIR *); -int closedir (DIR *); - #include #undef MAXNAMLEN /* from unistd.h */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/sun4/configure libnewlib-nano-2.11.2/newlib/libc/sys/sun4/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/sun4/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/sun4/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/sun4/sys/dirent.h libnewlib-nano-2.11.2/newlib/libc/sys/sun4/sys/dirent.h --- libnewlib-nano-2.10.0/newlib/libc/sys/sun4/sys/dirent.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/sun4/sys/dirent.h 2018-11-14 22:26:13.000000000 +0000 @@ -21,13 +21,6 @@ # define __dirfd(dp) ((dp)->dd_fd) -DIR *opendir (const char *); -struct dirent *readdir (DIR *); -int readdir_r (DIR *__restrict, struct dirent *__restrict, - struct dirent **__restrict); -void rewinddir (DIR *); -int closedir (DIR *); - #include #define MAXNAMLEN 255 diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/sysmec/configure libnewlib-nano-2.11.2/newlib/libc/sys/sysmec/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/sysmec/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/sysmec/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/sysnec810/configure libnewlib-nano-2.11.2/newlib/libc/sys/sysnec810/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/sysnec810/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/sysnec810/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/sysnecv850/configure libnewlib-nano-2.11.2/newlib/libc/sys/sysnecv850/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/sysnecv850/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/sysnecv850/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/sysvi386/configure libnewlib-nano-2.11.2/newlib/libc/sys/sysvi386/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/sysvi386/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/sysvi386/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/sysvi386/sys/dirent.h libnewlib-nano-2.11.2/newlib/libc/sys/sysvi386/sys/dirent.h --- libnewlib-nano-2.10.0/newlib/libc/sys/sysvi386/sys/dirent.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/sysvi386/sys/dirent.h 2018-11-14 22:26:13.000000000 +0000 @@ -18,13 +18,6 @@ # define __dirfd(dp) ((dp)->dd_fd) -DIR *opendir (const char *); -struct dirent *readdir (DIR *); -int readdir_r (DIR *__restrict, struct dirent *__restrict, - struct dirent **__restrict); -void rewinddir (DIR *); -int closedir (DIR *); - #include struct dirent { diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/sysvnecv70/configure libnewlib-nano-2.11.2/newlib/libc/sys/sysvnecv70/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/sysvnecv70/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/sysvnecv70/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/tic80/configure libnewlib-nano-2.11.2/newlib/libc/sys/tic80/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/tic80/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/tic80/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/tirtos/configure libnewlib-nano-2.11.2/newlib/libc/sys/tirtos/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/tirtos/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/tirtos/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/w65/configure libnewlib-nano-2.11.2/newlib/libc/sys/w65/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/w65/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/w65/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/sys/z8ksim/configure libnewlib-nano-2.11.2/newlib/libc/sys/z8ksim/configure --- libnewlib-nano-2.10.0/newlib/libc/sys/z8ksim/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/sys/z8ksim/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/dtoa_data.c libnewlib-nano-2.11.2/newlib/libc/tinystdio/dtoa_data.c --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/dtoa_data.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/dtoa_data.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,261 @@ +/* Copyright © 2018, Keith Packard + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +#include "dtoa_engine.h" + +#ifndef DBL_MAX_10_EXP +#error DBL_MAX_10_EXP +#endif + +#ifndef DBL_MIN_10_EXP +#error DBL_MIN_10_EXP +#endif + +#ifndef DBL_DIG +#error DBL_DIG +#endif + +const double __dtoa_scale_up[] = { +#if DBL_MAX_10_EXP >= 1 + 1e1, +#endif +#if DBL_MAX_10_EXP >= 2 + 1e2, +#endif +#if DBL_MAX_10_EXP >= 4 + 1e4, +#endif +#if DBL_MAX_10_EXP >= 8 + 1e8, +#endif +#if DBL_MAX_10_EXP >= 16 + 1e16, +#endif +#if DBL_MAX_10_EXP >= 32 + 1e32, +#endif +#if DBL_MAX_10_EXP >= 64 + 1e64, +#endif +#if DBL_MAX_10_EXP >= 128 + 1e128, +#endif +#if DBL_MAX_10_EXP >= 256 + 1e256, +#endif +#if DBL_MAX_10_EXP >= 512 + 1e512, +#endif +#if DBL_MAX_10_EXP >= 1024 + 1e1024, +#endif +#if DBL_MAX_10_EXP >= 2048 + 1e2048, +#endif +#if DBL_MAX_10_EXP >= 4096 + 1e4096, +#endif +#if DBL_MAX_10_EXP >= 8192 + 1e8192, +#endif +#if DBL_MAX_10_EXP >= 16384 + 1e16384, +#endif +#if DBL_MAX_10_EXP >= 32768 + 1e32768, +#endif +#if DBL_MAX_10_EXP >= 65536 + 1e65536, +#endif +}; + +const double __dtoa_scale_down[] = { +#if DBL_MIN_10_EXP <= -1 + 1e-1, +#endif +#if DBL_MIN_10_EXP <= -2 + 1e-2, +#endif +#if DBL_MIN_10_EXP <= -4 + 1e-4, +#endif +#if DBL_MIN_10_EXP <= -8 + 1e-8, +#endif +#if DBL_MIN_10_EXP <= -16 + 1e-16, +#endif +#if DBL_MIN_10_EXP <= -32 + 1e-32, +#endif +#if DBL_MIN_10_EXP <= -64 + 1e-64, +#endif +#if DBL_MIN_10_EXP <= -128 + 1e-128, +#endif +#if DBL_MIN_10_EXP <= -256 + 1e-256, +#endif +#if DBL_MIN_10_EXP <= -512 + 1e-512, +#endif +#if DBL_MIN_10_EXP <= -1024 + 1e-1024, +#endif +#if DBL_MIN_10_EXP <= -2048 + 1e-2048, +#endif +#if DBL_MIN_10_EXP <= -4096 + 1e-4096, +#endif +#if DBL_MIN_10_EXP <= -8192 + 1e-8192, +#endif +#if DBL_MIN_10_EXP <= -16384 + 1e-16384, +#endif +#if DBL_MIN_10_EXP <= -32768 + 1e-32768, +#endif +#if DBL_MIN_10_EXP <= -65536 + 1e-65536, +#endif +}; + +const double __dtoa_round[] = { +#if DBL_DIG >= 30 + 5e30, +#endif +#if DBL_DIG >= 29 + 5e29, +#endif +#if DBL_DIG >= 28 + 5e28, +#endif +#if DBL_DIG >= 27 + 5e27, +#endif +#if DBL_DIG >= 26 + 5e26, +#endif +#if DBL_DIG >= 25 + 5e25, +#endif +#if DBL_DIG >= 24 + 5e24, +#endif +#if DBL_DIG >= 23 + 5e23, +#endif +#if DBL_DIG >= 22 + 5e22, +#endif +#if DBL_DIG >= 21 + 5e21, +#endif +#if DBL_DIG >= 20 + 5e20, +#endif +#if DBL_DIG >= 19 + 5e19, +#endif +#if DBL_DIG >= 18 + 5e18, +#endif +#if DBL_DIG >= 17 + 5e17, +#endif +#if DBL_DIG >= 16 + 5e16, +#endif +#if DBL_DIG >= 15 + 5e15, +#endif +#if DBL_DIG >= 14 + 5e14, +#endif +#if DBL_DIG >= 13 + 5e13, +#endif +#if DBL_DIG >= 12 + 5e12, +#endif +#if DBL_DIG >= 11 + 5e11, +#endif +#if DBL_DIG >= 10 + 5e10, +#endif +#if DBL_DIG >= 9 + 5e9, +#endif +#if DBL_DIG >= 8 + 5e8, +#endif +#if DBL_DIG >= 7 + 5e7, +#endif +#if DBL_DIG >= 6 + 5e6, +#endif +#if DBL_DIG >= 5 + 5e5, +#endif +#if DBL_DIG >= 4 + 5e4, +#endif +#if DBL_DIG >= 3 + 5e3, +#endif +#if DBL_DIG >= 2 + 5e2, +#endif +#if DBL_DIG >= 1 + 5e1, +#endif +#if DBL_DIG >= 0 + 5e0, +#endif +}; + +/* + * Make sure the computed sizes of the arrays match the actual sizes + * by declaring an array which is legal if the sizes match and illegal + * if they do not + */ + +#define count_of(n) (sizeof (n) / sizeof (n[0])) +#define match(array,size) (count_of(array) == size) +#define check_match(array,size) (match(array, size) ? 1 : -1) + +typedef struct { + int check_up[check_match(__dtoa_scale_up, DTOA_SCALE_UP_NUM)]; + int check_down[check_match(__dtoa_scale_down, DTOA_SCALE_DOWN_NUM)]; + int check_round[check_match(__dtoa_round, DTOA_ROUND_NUM)]; +} check_sizes; diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/dtoa_engine.c libnewlib-nano-2.11.2/newlib/libc/tinystdio/dtoa_engine.c --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/dtoa_engine.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/dtoa_engine.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,134 @@ +/* Copyright © 2018, Keith Packard + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +#include "dtoa_engine.h" +#include + +/* A bit of CPP trickery -- construct the floating-point value 10 ** DBL_DIG + * by pasting the value of DBL_DIG onto '1e' to + */ + +#define paste(a) 1e##a +#define substitute(a) paste(a) +#define MIN_MANT (substitute(DBL_DIG)) +#define MAX_MANT (10.0 * MIN_MANT) +#define MIN_MANT_INT ((uint64_t) MIN_MANT) +#define MIN_MANT_EXP DBL_DIG + +#define max(a, b) ({\ + typeof(a) _a = a;\ + typeof(b) _b = b;\ + _a > _b ? _a : _b; }) + +#define min(a, b) ({\ + typeof(a) _a = a;\ + typeof(b) _b = b;\ + _a < _b ? _a : _b; }) + +int +__dtoa_engine(double x, struct dtoa *dtoa, int max_digits, int max_decimals) +{ + int i; + uint8_t flags = 0; + int32_t exp = 0; + + if (signbit(x)) { + flags |= DTOA_MINUS; + x = -x; + } + if (x == 0) { + flags |= DTOA_ZERO; + for (i = 0; i < max_digits; i++) + dtoa->digits[i] = '0'; + } else if (isnan(x)) { + flags |= DTOA_NAN; + } else if (isinf(x)) { + flags |= DTOA_INF; + } else { + double y; + + exp = MIN_MANT_EXP; + + /* Bring x within range MIN_MANT <= x < MAX_MANT while + * computing exponent value + */ + if (x < MIN_MANT) { + for (i = DTOA_SCALE_UP_NUM - 1; i >= 0; i--) { + y = x * __dtoa_scale_up[i]; + if (y < MAX_MANT) { + x = y; + exp -= (1 << i); + } + } + } else { + for (i = DTOA_SCALE_DOWN_NUM - 1; i >= 0; i--) { + y = x * __dtoa_scale_down[i]; + if (y >= MIN_MANT) { + x = y; + exp += (1 << i); + } + } + } + + /* If limiting decimals, then limit the max digits + * to no more than the number of digits left of the decimal + * plus the number of digits right of the decimal + */ + + if(max_decimals != 0) + max_digits = min(max_digits, max_decimals + max(exp + 1, 1)); + + /* Round nearest by adding 1/2 of the last digit + * before converting to int. Check for overflow + * and adjust mantissa and exponent values + */ + + x = x + __dtoa_round[max_digits]; + + if (x >= MAX_MANT) { + x /= 10.0; + exp++; + } + + /* Now convert mantissa to decimal. */ + + uint64_t mant = (uint64_t) x; + uint64_t decimal = MIN_MANT_INT; + + /* Compute digits */ + for (i = 0; i < max_digits; i++) { + dtoa->digits[i] = mant / decimal + '0'; + mant %= decimal; + decimal /= 10; + } + } + dtoa->digits[max_digits] = '\0'; + dtoa->flags = flags; + dtoa->exp = exp; + return max_digits; +} diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/dtoa_engine.h libnewlib-nano-2.11.2/newlib/libc/tinystdio/dtoa_engine.h --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/dtoa_engine.h 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/dtoa_engine.h 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,161 @@ +/* Copyright © 2018, Keith Packard + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +#ifndef _DTOA_ENGINE_H_ +#define _DTOA_ENGINE_H_ + +#include +#include + +#define DTOA_MAX_DIG DBL_DIG + +#define DTOA_MINUS 1 +#define DTOA_ZERO 2 +#define DTOA_INF 4 +#define DTOA_NAN 8 +#define DTOA_CARRY 16 /* Carry was to master position. */ + +struct dtoa { + int32_t exp; + uint8_t flags; + char digits[DTOA_MAX_DIG + 1]; +}; + +int +__dtoa_engine(double x, struct dtoa *dtoa, int max_digits, int max_decimals); + +extern const double __dtoa_scale_up[]; +extern const double __dtoa_scale_down[]; +extern const double __dtoa_round[]; + +#if DBL_MAX_10_EXP >= 1 && DBL_MAX_10_EXP < 2 +#define DTOA_SCALE_UP_NUM 1 +#endif +#if DBL_MAX_10_EXP >= 2 && DBL_MAX_10_EXP < 4 +#define DTOA_SCALE_UP_NUM 2 +#endif +#if DBL_MAX_10_EXP >= 4 && DBL_MAX_10_EXP < 8 +#define DTOA_SCALE_UP_NUM 3 +#endif +#if DBL_MAX_10_EXP >= 8 && DBL_MAX_10_EXP < 16 +#define DTOA_SCALE_UP_NUM 4 +#endif +#if DBL_MAX_10_EXP >= 16 && DBL_MAX_10_EXP < 32 +#define DTOA_SCALE_UP_NUM 5 +#endif +#if DBL_MAX_10_EXP >= 32 && DBL_MAX_10_EXP < 64 +#define DTOA_SCALE_UP_NUM 6 +#endif +#if DBL_MAX_10_EXP >= 64 && DBL_MAX_10_EXP < 128 +#define DTOA_SCALE_UP_NUM 7 +#endif +#if DBL_MAX_10_EXP >= 128 && DBL_MAX_10_EXP < 256 +#define DTOA_SCALE_UP_NUM 8 +#endif +#if DBL_MAX_10_EXP >= 256 && DBL_MAX_10_EXP < 512 +#define DTOA_SCALE_UP_NUM 9 +#endif +#if DBL_MAX_10_EXP >= 512 && DBL_MAX_10_EXP < 1024 +#define DTOA_SCALE_UP_NUM 10 +#endif +#if DBL_MAX_10_EXP >= 1024 && DBL_MAX_10_EXP < 2048 +#define DTOA_SCALE_UP_NUM 11 +#endif +#if DBL_MAX_10_EXP >= 2048 && DBL_MAX_10_EXP < 4096 +#define DTOA_SCALE_UP_NUM 12 +#endif +#if DBL_MAX_10_EXP >= 4096 && DBL_MAX_10_EXP < 8192 +#define DTOA_SCALE_UP_NUM 13 +#endif +#if DBL_MAX_10_EXP >= 8192 && DBL_MAX_10_EXP < 16384 +#define DTOA_SCALE_UP_NUM 14 +#endif +#if DBL_MAX_10_EXP >= 16384 && DBL_MAX_10_EXP < 32768 +#define DTOA_SCALE_UP_NUM 15 +#endif +#if DBL_MAX_10_EXP >= 32768 && DBL_MAX_10_EXP < 65536 +#define DTOA_SCALE_UP_NUM 16 +#endif +#if DBL_MAX_10_EXP >= 65536 && DBL_MAX_10_EXP < 131072 +#define DTOA_SCALE_UP_NUM 17 +#endif +#if DBL_MIN_10_EXP <= -1 && DBL_MIN_10_EXP > -2 +#define DTOA_SCALE_DOWN_NUM 1 +#endif +#if DBL_MIN_10_EXP <= -2 && DBL_MIN_10_EXP > -4 +#define DTOA_SCALE_DOWN_NUM 2 +#endif +#if DBL_MIN_10_EXP <= -4 && DBL_MIN_10_EXP > -8 +#define DTOA_SCALE_DOWN_NUM 3 +#endif +#if DBL_MIN_10_EXP <= -8 && DBL_MIN_10_EXP > -16 +#define DTOA_SCALE_DOWN_NUM 4 +#endif +#if DBL_MIN_10_EXP <= -16 && DBL_MIN_10_EXP > -32 +#define DTOA_SCALE_DOWN_NUM 5 +#endif +#if DBL_MIN_10_EXP <= -32 && DBL_MIN_10_EXP > -64 +#define DTOA_SCALE_DOWN_NUM 6 +#endif +#if DBL_MIN_10_EXP <= -64 && DBL_MIN_10_EXP > -128 +#define DTOA_SCALE_DOWN_NUM 7 +#endif +#if DBL_MIN_10_EXP <= -128 && DBL_MIN_10_EXP > -256 +#define DTOA_SCALE_DOWN_NUM 8 +#endif +#if DBL_MIN_10_EXP <= -256 && DBL_MIN_10_EXP > -512 +#define DTOA_SCALE_DOWN_NUM 9 +#endif +#if DBL_MIN_10_EXP <= -512 && DBL_MIN_10_EXP > -1024 +#define DTOA_SCALE_DOWN_NUM 10 +#endif +#if DBL_MIN_10_EXP <= -1024 && DBL_MIN_10_EXP > -2048 +#define DTOA_SCALE_DOWN_NUM 11 +#endif +#if DBL_MIN_10_EXP <= -2048 && DBL_MIN_10_EXP > -4096 +#define DTOA_SCALE_DOWN_NUM 12 +#endif +#if DBL_MIN_10_EXP <= -4096 && DBL_MIN_10_EXP > -8192 +#define DTOA_SCALE_DOWN_NUM 13 +#endif +#if DBL_MIN_10_EXP <= -8192 && DBL_MIN_10_EXP > -16384 +#define DTOA_SCALE_DOWN_NUM 14 +#endif +#if DBL_MIN_10_EXP <= -16384 && DBL_MIN_10_EXP > -32768 +#define DTOA_SCALE_DOWN_NUM 15 +#endif +#if DBL_MIN_10_EXP <= -32768 && DBL_MIN_10_EXP > -65536 +#define DTOA_SCALE_DOWN_NUM 16 +#endif +#if DBL_MIN_10_EXP <= -65536 && DBL_MIN_10_EXP > -131072 +#define DTOA_SCALE_DOWN_NUM 17 +#endif + +#define DTOA_ROUND_NUM (DBL_DIG + 1) + +#endif /* !_DTOA_ENGINE_H_ */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/ftoa_engine.c libnewlib-nano-2.11.2/newlib/libc/tinystdio/ftoa_engine.c --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/ftoa_engine.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/ftoa_engine.c 2018-11-14 22:26:13.000000000 +0000 @@ -23,6 +23,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #include "ftoa_engine.h" #include @@ -40,6 +41,7 @@ 3, 5, 8, 10, 12, 15, 17, 20, 22, 24, 27, 29, 32, 34, 36, 39 }; + static const uint32_t factorTable[32] = { 2295887404UL, 587747175UL, @@ -74,113 +76,175 @@ 4056481921UL, 1038459372UL }; -int __ftoa_engine(float val, char *buf, uint8_t precision, uint8_t maxDecimals) + +static uint8_t min_uint8(uint8_t a, uint8_t b) { - uint8_t flags; + if (a < b) + return a; + return b; +} + +int __ftoa_engine(float val, struct ftoa *ftoa, uint8_t maxDigits, uint8_t maxDecimals) +{ + uint8_t flags = 0; + union { float v; uint32_t u; } x; + x.v = val; + uint32_t frac = x.u & 0x007fffffUL; - if (precision > FTOA_MAX_DIG) precision=FTOA_MAX_DIG; - // Read the sign, shift the exponent in place and delete it from frac. - if (x.u & (1 << 31)) flags = FTOA_MINUS; else flags = 0; + + if (maxDigits > FTOA_MAX_DIG) + maxDigits = FTOA_MAX_DIG; + + /* Read the sign, shift the exponent in place and delete it from frac. + */ + if (x.u & (1 << 31)) + flags = FTOA_MINUS; + uint8_t exp = (x.u >> 24) << 1; - if(x.u & (1 << 23)) exp++; // TODO possible but in case of subnormal - // Test for easy cases, zero and NaN - if(exp==0 && frac==0) { - buf[0] = flags | FTOA_ZERO; + + if(x.u & (1 << 23)) + exp++; // TODO possible but in case of subnormal + + /* + * Test for easy cases, zero and NaN + */ + if(exp==0 && frac==0) + { + ftoa->flags = flags | FTOA_ZERO; uint8_t i; - for(i=0; i<=precision; i++) { - buf[i+1] = '0'; + for(i=0; i<=maxDigits; i++) { + ftoa->digits[i] = '0'; } return 0; } + if(exp == 0xff) { - if(frac == 0) flags |= FTOA_INF; else flags |= FTOA_NAN; + if(frac == 0) + flags |= FTOA_INF; + else + flags |= FTOA_NAN; } - // The implicit leading 1 is made explicit, except if value subnormal. - if (exp != 0) frac |= (1UL<<23); + + /* The implicit leading 1 is made explicit, except if value + * subnormal. + */ + if (exp != 0) + frac |= (1UL<<23); + uint8_t idx = exp>>3; int8_t exp10 = exponentTable[idx]; - // We COULD try making the multiplication in situ, where we make - // frac and a 64 bit int overlap in memory and select/weigh the - // upper 32 bits that way. For starters, this is less risky: + + /* + * We COULD try making the multiplication in situ, where we make + * frac and a 64 bit int overlap in memory and select/weigh the + * upper 32 bits that way. For starters, this is less risky: + */ int64_t prod = (int64_t)frac * (int64_t)factorTable[idx]; - // The expConvFactorTable are factor are correct iff the lower 3 exponent - // bits are 1 (=7). Else we need to compensate by divding frac. - // If the lower 3 bits are 7 we are right. - // If the lower 3 bits are 6 we right-shift once - // .. - // If the lower 3 bits are 0 we right-shift 7x + + /* + * The expConvFactorTable are factor are correct iff the lower 3 exponent + * bits are 1 (=7). Else we need to compensate by divding frac. + * If the lower 3 bits are 7 we are right. + * If the lower 3 bits are 6 we right-shift once + * .. + * If the lower 3 bits are 0 we right-shift 7x + */ prod >>= (15-(exp & 7)); - // Now convert to decimal. - uint8_t hadNonzeroDigit = 0; // a flag + + /* + * Now convert to decimal. + */ + + uint8_t hadNonzeroDigit = 0; /* have seen a non-zero digit flag */ uint8_t outputIdx = 0; int64_t decimal = 100000000000000ull; + do { - char digit = '0'; - while(1) {// find the first nonzero digit or any of the next digits. - digit += prod / decimal; - prod = prod % decimal; - decimal /= 10; - // If already found a leading nonzero digit, accept zeros. - if (hadNonzeroDigit) break; - // Else, don't return results with a leading zero! Instead - // skip those and decrement exp10 accordingly. - if(digit == '0') { - exp10--; - continue; - } - hadNonzeroDigit = 1; - // Compute how many digits N to output. - if(maxDecimals != 0) { // If limiting decimals... - int8_t beforeDP = exp10+1; // Digits before point - if (beforeDP < 1) beforeDP = 1; // Numbers < 1 should also output at least 1 digit. - /* - * Below a simpler version of this: - int8_t afterDP = outputNum - beforeDP; - if (afterDP > maxDecimals-1) - afterDP = maxDecimals-1; - outputNum = beforeDP + afterDP; - */ - maxDecimals = maxDecimals+beforeDP-1; - if (precision > maxDecimals) - precision = maxDecimals; - } - break; + /* Compute next digit */ + char digit = prod / decimal + '0'; + prod = prod % decimal; + decimal /= 10; + + if(!hadNonzeroDigit) + { + /* Don't return results with a leading zero! Instead + * skip those and decrement exp10 accordingly. + */ + if (digit == '0') { + exp10--; + continue; + } + + /* Found the first non-zero digit */ + hadNonzeroDigit = 1; + + /* If limiting decimals... */ + if(maxDecimals != 0) + { + int8_t beforeDP = exp10+1; // Digits before point + + /* Numbers < 1 should also output at least 1 digit. */ + if (beforeDP < 1) + beforeDP = 1; + + maxDigits = min_uint8 (maxDigits, maxDecimals + beforeDP); + } + } + + /* Now we have a digit. */ + if(digit < '0' + 10) { + /* normal case. */ + ftoa->digits[outputIdx] = digit; + } else { + /* + * Uh, oh. Something went wrong with our conversion. Write + * 9s and use the round-up code to report back to the caller + * that we've carried + */ + for(outputIdx = 0; outputIdx < maxDigits; outputIdx++) + ftoa->digits[outputIdx] = '9'; + goto round_up; } - // Now have a digit. outputIdx++; - if(digit < '0' + 10) // normal case. - buf[outputIdx] = digit; - else { - // Abnormal case, write 9s and bail. - // We might as well abuse hadNonzeroDigit as counter, it will not be used again. - for(hadNonzeroDigit=outputIdx; hadNonzeroDigit>0; hadNonzeroDigit--) - buf[hadNonzeroDigit] = '9'; - goto roundup; // this is ugly but it _is_ code derived from assembler :) - } - } while (outputIdx> 1) >= 0) { - roundup: - // Increment digit, cascade + if (prod - (decimal >> 1) >= 0) + { + round_up: + while(outputIdx != 0) { - if(++buf[outputIdx] == '0' + 10) { - if(outputIdx == 1) { - buf[outputIdx] = '1'; - exp10++; - flags |= FTOA_CARRY; - break; - } else - buf[outputIdx--] = '0'; // and the loop continues, carrying to next digit. - } - else break; + + /* Increment digit, check if we're done */ + if(++ftoa->digits[outputIdx-1] < '0' + 10) + break; + + /* Rounded past the first digit; + * reset the leading digit to 1, + * bump exp and tell the caller we've carried. + * The remaining digits will already be '0', + * so we don't need to mess with them + */ + if(outputIdx == 1) + { + ftoa->digits[0] = '1'; + exp10++; + flags |= FTOA_CARRY; + break; + } + + ftoa->digits[--outputIdx] = '0'; + /* and the loop continues, carrying to next digit. */ } } - buf[0] = flags; - return exp10; + + ftoa->flags = flags; + ftoa->exp = exp10; + return maxDigits; } diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/ftoa_engine.h libnewlib-nano-2.11.2/newlib/libc/tinystdio/ftoa_engine.h --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/ftoa_engine.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/ftoa_engine.h 2018-11-14 22:26:13.000000000 +0000 @@ -36,10 +36,15 @@ #define FTOA_MAX_DIG (__FLT_DIG__ + 1) -int __ftoa_engine (float val, char *buf, - uint8_t prec, uint8_t maxdgs); +struct ftoa { + int16_t exp; + uint8_t flags; + char digits[FTOA_MAX_DIG + 1]; +}; -/* '__ftoa_engine' return next flags (in buf[0]): */ +int __ftoa_engine (float val, struct ftoa *ftoa, uint8_t maxDigits, uint8_t maxDecimal); + +/* '__ftoa_engine' flags return value */ #define FTOA_MINUS 1 #define FTOA_ZERO 2 #define FTOA_INF 4 diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/make-dtoa-data libnewlib-nano-2.11.2/newlib/libc/tinystdio/make-dtoa-data --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/make-dtoa-data 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/make-dtoa-data 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,71 @@ +#!/usr/bin/nickle + +/* Copyright © 2018, Keith Packard + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +printf ("const dtoa_type __dtoa_scale_up[] = {\n"); +for (int i = 1; i <= 65536; i *= 2) { + printf("#if DTOA_MAX_10_EXP >= %d\n", i); + printf("\t1e%d,\n", i); + printf("#endif\n"); +} +printf("};\n"); + +printf ("const dtoa_type __dtoa_scale_down[] = {\n"); +for (int i = 1; i <= 65536; i *= 2) { + printf("#if DTOA_MIN_10_EXP <= -%d\n", i); + printf("\t1e-%d,\n", i); + printf("#endif\n"); +} +printf("};\n"); + +printf ("const dtoa_type __dtoa_round[] = {\n"); + +for (int i = 30; i >= 0; i--) { + printf("#if DTOA_DIG >= %d\n", i); + printf("\t5e%d,\n", i); + printf("#endif\n"); +} + +printf("};\n"); + +int j = 0; +for (int i = 1; i <= 65536; i *= 2) { + printf("#if DTOA_MAX_10_EXP >= %d && DTOA_MAX_10_EXP < %d\n", i, i*2); + printf("#define DTOA_SCALE_UP_NUM %d\n", j + 1); + printf("#endif\n"); + j++; +} + +int j = 0; +for (int i = 1; i <= 65536; i *= 2) { + printf("#if DTOA_MIN_10_EXP <= -%d && DTOA_MIN_10_EXP > -%d\n", i, i*2); + printf ("#define DTOA_SCALE_DOWN_NUM %d\n", j + 1); + printf("#endif\n"); + j++; +} diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/meson.build libnewlib-nano-2.11.2/newlib/libc/tinystdio/meson.build --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/meson.build 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -2,6 +2,8 @@ srcs_tinystdio = [ 'clearerr.c', + 'dtoa_engine.c', + 'dtoa_data.c', 'fclose.c', 'fdevopen.c', 'feof.c', @@ -34,6 +36,7 @@ 'sprintf.c', 'sscanf.c', 'strtof.c', + 'strtod.c', 'ultoa_invert.c', 'ungetc.c', 'vfiprintf.c', @@ -56,6 +59,7 @@ ] hdrs_tinystdio = [ + 'dtoa_engine.h', 'ftoa_engine.h', 'stdio.h', 'stdio_private.h', diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/stdio.h libnewlib-nano-2.11.2/newlib/libc/tinystdio/stdio.h --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/stdio.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/stdio.h 2018-11-14 22:26:13.000000000 +0000 @@ -889,6 +889,7 @@ #define PRINTF_LEVEL PRINTF_STD #define SCANF_LEVEL SCANF_STD +#define vsnprintf vsniprintf #define vfprintf vfiprintf #define vprintf viprintf #define fprintf fiprintf diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/strtod.c libnewlib-nano-2.11.2/newlib/libc/tinystdio/strtod.c --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/strtod.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/strtod.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,209 @@ +/* Copyright (c) 2002-2005 Michael Stumpf + Copyright (c) 2006,2008 Dmitry Xmelkov + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +/* $Id: strtod.c 2191 2010-11-05 13:45:57Z arcanum $ */ + + +#include +#include +#include +#include /* INFINITY, NAN */ +#include +#include + +static const double pwr_p10 [6] = { + 1e+1, 1e+2, 1e+4, 1e+8, 1e+16, 1e+32 +}; +static const double pwr_m10 [6] = { + 1e-1, 1e-2, 1e-4, 1e-8, 1e-16, 1e-32 +}; + +/* PSTR() is not used to save 1 byte per string: '\0' at the tail. */ +static const char pstr_inf[] = {'I','N','F'}; +static const char pstr_inity[] = {'I','N','I','T','Y'}; +static const char pstr_nan[] = {'N','A','N'}; + +/** The strtod() function converts the initial portion of the string pointed + to by \a nptr to double representation. + + The expected form of the string is an optional plus ( \c '+' ) or minus + sign ( \c '-' ) followed by a sequence of digits optionally containing + a decimal-point character, optionally followed by an exponent. An + exponent consists of an \c 'E' or \c 'e', followed by an optional plus + or minus sign, followed by a sequence of digits. + + Leading white-space characters in the string are skipped. + + The strtod() function returns the converted value, if any. + + If \a endptr is not \c NULL, a pointer to the character after the last + character used in the conversion is stored in the location referenced by + \a endptr. + + If no conversion is performed, zero is returned and the value of + \a nptr is stored in the location referenced by \a endptr. + + If the correct value would cause overflow, plus or minus \c INFINITY is + returned (according to the sign of the value), and \c ERANGE is stored + in \c errno. If the correct value would cause underflow, zero is + returned and \c ERANGE is stored in \c errno. + */ + +double +strtod (const char * nptr, char ** endptr) +{ + uint64_t u64; + double flt; + unsigned char c; + int exp; + + unsigned char flag; +#define FL_MINUS 0x01 /* number is negative */ +#define FL_ANY 0x02 /* any digit was readed */ +#define FL_OVFL 0x04 /* overflow was */ +#define FL_DOT 0x08 /* decimal '.' was */ +#define FL_MEXP 0x10 /* exponent 'e' is neg. */ + + if (endptr) + *endptr = (char *)nptr; + + do { + c = *nptr++; + } while (isspace (c)); + + flag = 0; + if (c == '-') { + flag = FL_MINUS; + c = *nptr++; + } else if (c == '+') { + c = *nptr++; + } + + if (!strncmp (nptr - 1, pstr_inf, 3)) { + nptr += 2; + if (!strncmp (nptr, pstr_inity, 5)) + nptr += 5; + if (endptr) + *endptr = (char *)nptr; + return flag & FL_MINUS ? -INFINITY : +INFINITY; + } + + /* NAN() construction is not realised. + Length would be 3 characters only. */ + if (!strncmp (nptr - 1, pstr_nan, 3)) { + if (endptr) + *endptr = (char *)nptr + 2; + return NAN; + } + + u64 = 0; + exp = 0; + while (1) { + + c -= '0'; + + if (c <= 9) { + flag |= FL_ANY; + if (flag & FL_OVFL) { + if (!(flag & FL_DOT)) + exp += 1; + } else { + if (flag & FL_DOT) + exp -= 1; + u64 = u64 * 10 + c; + if (u64 >= (0xffffffffffffffffULL - 9) / 10) + flag |= FL_OVFL; + } + + } else if (c == (('.'-'0') & 0xff) && !(flag & FL_DOT)) { + flag |= FL_DOT; + } else { + break; + } + c = *nptr++; + } + + if (c == (('e'-'0') & 0xff) || c == (('E'-'0') & 0xff)) + { + int i; + c = *nptr++; + i = 2; + if (c == '-') { + flag |= FL_MEXP; + c = *nptr++; + } else if (c == '+') { + c = *nptr++; + } else { + i = 1; + } + c -= '0'; + if (c > 9) { + nptr -= i; + } else { + i = 0; + do { + if (i < 3200) + i = (((i << 2) + i) << 1) + c; /* i = 10*i + c */ + c = *nptr++ - '0'; + } while (c <= 9); + if (flag & FL_MEXP) + i = -i; + exp += i; + } + } + + if ((flag & FL_ANY) && endptr) + *endptr = (char *)nptr - 1; + + flt = (double) (u64); /* manually */ + if ((flag & FL_MINUS) && (flag & FL_ANY)) + flt = -flt; + + if (flt != 0) { + int pwr; + const double *pptr; + if (exp < 0) { + pptr = (pwr_m10 + 5); + exp = -exp; + } else { + pptr = (pwr_p10 + 5); + } + for (pwr = 32; pwr; pwr >>= 1) { + for (; exp >= pwr; exp -= pwr) { + flt *= *pptr; + } + pptr--; + } +// if (!isfinite(flt) || flt == 0) +// errno = ERANGE; + } + + return flt; +} diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/strtof.c libnewlib-nano-2.11.2/newlib/libc/tinystdio/strtof.c --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/strtof.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/strtof.c 2018-11-14 22:26:13.000000000 +0000 @@ -202,8 +202,8 @@ } pptr--; } - if (!isfinite(flt) || flt == 0) - errno = ERANGE; +// if (!isfinite(flt) || flt == 0) +// errno = ERANGE; } return flt; diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/ultoa_invert.c libnewlib-nano-2.11.2/newlib/libc/tinystdio/ultoa_invert.c --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/ultoa_invert.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/ultoa_invert.c 2018-11-14 22:26:13.000000000 +0000 @@ -26,9 +26,17 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "xtoa_fast.h" + char * -__ultoa_invert(unsigned long val, char *str, int base, int upper) +__ultoa_invert(unsigned long val, char *str, int base) { + int upper = 0; + + if (base & XTOA_UPPER) { + upper = 1; + base &= ~XTOA_UPPER; + } do { int v; diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/vfprintf.c libnewlib-nano-2.11.2/newlib/libc/tinystdio/vfprintf.c --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/vfprintf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/vfprintf.c 2018-11-14 22:26:13.000000000 +0000 @@ -33,14 +33,24 @@ /* From: Id: printf_p_new.c,v 1.1.1.9 2002/10/15 20:10:28 joerg_wunsch Exp */ /* $Id: vfprintf.c 2191 2010-11-05 13:45:57Z arcanum $ */ -#if !defined(__AVR_TINY__) - #include #include #include #include #include "stdio_private.h" +#if 0 #include "ftoa_engine.h" +#define dtoa ftoa +#define DTOA_MINUS FTOA_MINUS +#define DTOA_ZERO FTOA_ZERO +#define DTOA_INF FTOA_INF +#define DTOA_NAN FTOA_NAN +#define DTOA_CARRY FTOA_CARRY +#define DTOA_MAX_DIG FTOA_MAX_DIG +#define __dtoa_engine(x,dtoa,dig,dec) __ftoa_engine(x,dtoa,dig,dec) +#else +#include "dtoa_engine.h" +#endif #include "xtoa_fast.h" /* @@ -157,6 +167,7 @@ case 'u': flags &= ~FL_ALT; base = 10; + sign = 0; goto ultoa; case 'o': base = 8; @@ -207,31 +218,48 @@ /* -------------------------------------------------------------------- */ #else /* i.e. PRINTF_LEVEL > PRINTF_MIN */ -#define FL_ZFILL 0x01 -#define FL_PLUS 0x02 -#define FL_SPACE 0x04 -#define FL_LPAD 0x08 -#define FL_ALT 0x10 -#define FL_WIDTH 0x20 -#define FL_PREC 0x40 -#define FL_LONG 0x80 - -#define FL_NEGATIVE FL_LONG - -#define FL_ALTUPP FL_PLUS -#define FL_ALTHEX FL_SPACE - -#define FL_FLTUPP FL_ALT -#define FL_FLTEXP FL_PREC -#define FL_FLTFIX FL_LONG +/* Order is relevant here and matches order in format string */ + +#define FL_ZFILL 0x0001 +#define FL_PLUS 0x0002 +#define FL_SPACE 0x0004 +#define FL_LPAD 0x0008 +#define FL_ALT 0x0010 + +#define FL_WIDTH 0x0020 +#define FL_PREC 0x0040 + +#define FL_LONG 0x0080 +#define FL_LONGLONG 0x0100 +#define FL_SHORT 0x0200 + +#define FL_NEGATIVE 0x0400 + +#define FL_ALTUPP 0x0800 +#define FL_ALTHEX 0x1000 + +#define FL_FLTUPP 0x2000 +#define FL_FLTEXP 0x4000 +#define FL_FLTFIX 0x8000 int vfprintf (FILE * stream, const char *fmt, va_list ap) { unsigned char c; /* holds a char from the format string */ - unsigned char flags; - unsigned char width; - unsigned char prec; - unsigned char buf[11]; /* size for -1 in octal, without '\0' */ + uint16_t flags; + int width; + int prec; + union { + unsigned char __buf[11]; /* size for -1 in octal, without '\0' */ +#if PRINTF_LEVEL >= PRINTF_FLT + struct dtoa __dtoa; +#endif + } u; + const char * pnt; + size_t size; + unsigned char len; + +#define buf (u.__buf) +#define _dtoa (u.__dtoa) stream->len = 0; @@ -286,20 +314,43 @@ flags |= FL_WIDTH; continue; } + if (c == '*') { + if (flags & FL_PREC) { + prec = va_arg(ap, int); + if (prec < 0) + prec = 0; + } else { + width = va_arg(ap, int); + flags |= FL_WIDTH; + if (width < 0) { + width = -width; + flags |= FL_LPAD; + } + } + continue; + } if (c == '.') { if (flags & FL_PREC) goto ret; flags |= FL_PREC; continue; } - if (c == 'l') { - flags |= FL_LONG; - continue; - } - if (c == 'h') - continue; } - + + if (c == 'l') { + if (flags & FL_LONG) + flags |= FL_LONGLONG; + flags |= FL_LONG; + flags &= ~FL_SHORT; + continue; + } + + if (c == 'h') { + flags |= FL_SHORT; + flags &= ~FL_LONG; + continue; + } + break; } while ( (c = *fmt++) != 0); @@ -316,42 +367,50 @@ goto flt_oper; } else if (c >= 'e' && c <= 'g') { - - int exp; /* exponent of master decimal digit */ + int exp; /* exponent of master decimal digit */ int n; - unsigned char vtype; /* result of float value parse */ - unsigned char sign; /* sign character (or 0) */ - unsigned char ndigs; /* number of digits to convert */ + uint8_t sign; /* sign character (or 0) */ + uint8_t ndigs; /* number of digits to convert */ flags &= ~FL_FLTUPP; flt_oper: + ndigs = 0; if (!(flags & FL_PREC)) prec = 6; flags &= ~(FL_FLTEXP | FL_FLTFIX); - if (c == 'e') + + uint8_t ndecimal; /* digits after decimal (for 'f' format), 0 if no limit */ + + if (c == 'e') { + ndigs = prec + 1; + ndecimal = 0; flags |= FL_FLTEXP; - else if (c == 'f') + } else if (c == 'f') { + ndigs = DTOA_MAX_DIG; + ndecimal = prec; flags |= FL_FLTFIX; + } else { + ndigs = prec; + ndecimal = 0; + } - /* number of digits past the decimal for 'f' format */ - if (flags & FL_FLTFIX) - ndigs = prec < FTOA_MAX_DIG ? prec : FTOA_MAX_DIG; - else - ndigs = 0; + if (ndigs > DTOA_MAX_DIG) + ndigs = DTOA_MAX_DIG; - exp = __ftoa_engine (va_arg(ap,double), (char *)buf, prec, ndigs); - vtype = buf[0]; + ndigs = __dtoa_engine (va_arg(ap,double), &_dtoa, ndigs, ndecimal); + exp = _dtoa.exp; sign = 0; - if ((vtype & FTOA_MINUS) && !(vtype & FTOA_NAN)) + if ((_dtoa.flags & DTOA_MINUS) && !(_dtoa.flags & DTOA_NAN)) sign = '-'; else if (flags & FL_PLUS) sign = '+'; else if (flags & FL_SPACE) sign = ' '; - if (vtype & (FTOA_NAN | FTOA_INF)) { + if (_dtoa.flags & (DTOA_NAN | DTOA_INF)) + { const char *p; ndigs = sign ? 4 : 3; if (width > ndigs) { @@ -367,7 +426,7 @@ if (sign) putc (sign, stream); p = "inf"; - if (vtype & FTOA_NAN) + if (_dtoa.flags & DTOA_NAN) p = "nan"; # if ('I'-'i' != 'N'-'n') || ('I'-'i' != 'F'-'f') || ('I'-'i' != 'A'-'a') # error @@ -381,17 +440,28 @@ goto tail; } - /* Output format adjustment, number of decimal digits in buf[] */ + if (!(flags & (FL_FLTEXP|FL_FLTFIX))) { + + /* 'g(G)' format */ + + prec = ndigs; + + /* Remove trailing zeros */ + while (ndigs > 0 && _dtoa.digits[ndigs-1] == '0') + ndigs--; - if (!(flags & (FL_FLTEXP|FL_FLTFIX))) { /* 'g(G)' format */ - if (exp <= prec && exp >= -4) { + if (-4 <= exp && exp < prec) + { flags |= FL_FLTFIX; - /* XXX this may mis-round the output */ - ndigs = prec < FTOA_MAX_DIG ? prec : FTOA_MAX_DIG; + + if (exp < 0 || ndigs > exp) + prec = ndigs - (exp + 1); + else + prec = 0; } else { - /* remove trailing zeros */ - while (prec && buf[1+prec] == '0') - prec--; + + /* Limit displayed precision to available precision */ + prec = ndigs - 1; } } @@ -400,8 +470,13 @@ n = (exp>0 ? exp+1 : 1); else n = 5; /* 1e+00 */ - if (sign) n += 1; - if (prec) n += prec; + if (sign) + n += 1; + if (prec) + n += prec + 1; + else if (flags & FL_ALT) + n += 1; + width = width > n ? width - n : 0; /* Output before first digit */ @@ -411,20 +486,22 @@ width--; } } - if (sign) putc (sign, stream); + if (sign) + putc (sign, stream); + if (!(flags & FL_LPAD)) { while (width) { putc ('0', stream); width--; } } - + if (flags & FL_FLTFIX) { /* 'f' format */ char out; /* At this point, we should have * - * exp exponent of leftmost digit in buf + * exp exponent of leftmost digit in _dtoa.digits * ndigs number of buffer digits to print * prec number of digits after decimal * @@ -441,16 +518,19 @@ * otherwise use 0 */ if (0 <= exp - n && exp - n < ndigs) - out = buf[exp - n + 1]; + out = _dtoa.digits[exp - n]; else out = '0'; - if (--n < -prec) + if (--n < -prec) { + if ((flags & FL_ALT) && n == -1) + putc('.', stream); break; + } putc (out, stream); } while (1); if (n == exp - && (buf[1] > '5' - || (buf[1] == '5' && !(vtype & FTOA_CARRY))) ) + && (_dtoa.digits[0] > '5' + || (_dtoa.digits[0] == '5' && !(_dtoa.flags & DTOA_CARRY))) ) { out = '1'; } @@ -459,22 +539,21 @@ } else { /* 'e(E)' format */ /* mantissa */ - if (buf[1] != '1') - vtype &= ~FTOA_CARRY; - putc (buf[1], stream); - if (prec) { + if (_dtoa.digits[0] != '1') + _dtoa.flags &= ~DTOA_CARRY; + putc (_dtoa.digits[0], stream); + if (prec > 0) { + putc ('.', stream); + uint8_t pos = 1; + for (pos = 1; pos < 1 + prec; pos++) + putc (pos < ndigs ? _dtoa.digits[pos] : '0', stream); + } else if (flags & FL_ALT) putc ('.', stream); - sign = 2; - do { - putc (sign < FTOA_MAX_DIG + 1 ? buf[sign] : '0', stream); - sign++; - } while (--prec); - } /* exponent */ putc (flags & FL_FLTUPP ? 'E' : 'e', stream); ndigs = '+'; - if (exp < 0 || (exp == 0 && (vtype & FTOA_CARRY) != 0)) { + if (exp < 0 || (exp == 0 && (_dtoa.flags & DTOA_CARRY) != 0)) { exp = -exp; ndigs = '-'; } @@ -486,82 +565,88 @@ } goto tail; -# undef ndigs } #else /* to: PRINTF_LEVEL >= PRINTF_FLT */ if ((c >= 'E' && c <= 'G') || (c >= 'e' && c <= 'g')) { (void) va_arg (ap, double); - buf[0] = '?'; - goto buf_addr; + pnt = "*float*"; + size = sizeof ("*float*") - 1; + goto str_lpad; } - #endif - { - const char * pnt; - size_t size; + switch (c) { - switch (c) { + case 'c': + buf[0] = va_arg (ap, int); + pnt = (char *)buf; + size = 1; + goto str_lpad; + + case 's': + case 'S': + pnt = va_arg (ap, char *); + size = strnlen (pnt, (flags & FL_PREC) ? prec : ~0); - case 'c': - buf[0] = va_arg (ap, int); -#if PRINTF_LEVEL < PRINTF_FLT - buf_addr: -#endif - pnt = (char *)buf; - size = 1; - goto str_lpad; - - case 's': - case 'S': - pnt = va_arg (ap, char *); - size = strnlen (pnt, (flags & FL_PREC) ? prec : ~0); - goto str_lpad; - - pnt = va_arg (ap, char *); - size = strnlen (pnt, (flags & FL_PREC) ? prec : ~0); - - str_lpad: - if (!(flags & FL_LPAD)) { - while (size < width) { - putc (' ', stream); - width--; - } - } - while (size) { - putc (*pnt++, stream); - if (width) width -= 1; - size -= 1; + str_lpad: + if (!(flags & FL_LPAD)) { + while (size < width) { + putc (' ', stream); + width--; } - goto tail; } + while (size) { + putc (*pnt++, stream); + if (width) width -= 1; + size -= 1; + } + goto tail; } if (c == 'd' || c == 'i') { - long x = (flags & FL_LONG) ? va_arg(ap,long) : va_arg(ap,int); + long x; + + if (flags & FL_LONG) + x = va_arg(ap, long); + else { + x = va_arg(ap, int); + if (flags & FL_SHORT) + x = (short) x; + } + flags &= ~(FL_NEGATIVE | FL_ALT); if (x < 0) { x = -x; flags |= FL_NEGATIVE; } - c = __ultoa_invert (x, (char *)buf, 10) - (char *)buf; + if ((flags & FL_PREC) && prec == 0 && x == 0) + c = 0; + else + c = __ultoa_invert (x, (char *)buf, 10) - (char *)buf; } else { int base; + unsigned long x; - if (c == 'u') { - flags &= ~FL_ALT; - base = 10; - goto ultoa; + if (flags & FL_LONG) + x = va_arg(ap, unsigned long); + else { + x = va_arg(ap, unsigned int); + if (flags & FL_SHORT) + x = (unsigned short) x; } flags &= ~(FL_PLUS | FL_SPACE); switch (c) { + case 'u': + flags &= ~FL_ALT; + base = 10; + break; case 'o': base = 8; - goto ultoa; + break; case 'p': flags |= FL_ALT; /* no break */ @@ -569,85 +654,81 @@ if (flags & FL_ALT) flags |= FL_ALTHEX; base = 16; - goto ultoa; + break; case 'X': if (flags & FL_ALT) flags |= (FL_ALTHEX | FL_ALTUPP); base = 16 | XTOA_UPPER; - ultoa: - c = __ultoa_invert ((flags & FL_LONG) - ? va_arg(ap, unsigned long) - : va_arg(ap, unsigned int), - (char *)buf, base) - (char *)buf; - flags &= ~FL_NEGATIVE; break; - default: - goto ret; + putc('%', stream); + putc(c, stream); + continue; } + if ((flags & FL_PREC) && prec == 0 && x == 0) + c = 0; + else + c = __ultoa_invert (x, (char *)buf, base) - (char *)buf; + flags &= ~FL_NEGATIVE; } - { - unsigned char len; + len = c; - len = c; - if (flags & FL_PREC) { - flags &= ~FL_ZFILL; - if (len < prec) { - len = prec; - if ((flags & FL_ALT) && !(flags & FL_ALTHEX)) - flags &= ~FL_ALT; - } + if (flags & FL_PREC) { + flags &= ~FL_ZFILL; + if (len < prec) { + len = prec; + if ((flags & FL_ALT) && !(flags & FL_ALTHEX)) + flags &= ~FL_ALT; } - if (flags & FL_ALT) { - if (buf[c-1] == '0') { - flags &= ~(FL_ALT | FL_ALTHEX | FL_ALTUPP); - } else { - len += 1; - if (flags & FL_ALTHEX) - len += 1; - } - } else if (flags & (FL_NEGATIVE | FL_PLUS | FL_SPACE)) { + } + if (flags & FL_ALT) { + if (buf[c-1] == '0') { + flags &= ~(FL_ALT | FL_ALTHEX | FL_ALTUPP); + } else { len += 1; + if (flags & FL_ALTHEX) + len += 1; } + } else if (flags & (FL_NEGATIVE | FL_PLUS | FL_SPACE)) { + len += 1; + } - if (!(flags & FL_LPAD)) { - if (flags & FL_ZFILL) { - prec = c; - if (len < width) { - prec += width - len; - len = width; - } - } - while (len < width) { - putc (' ', stream); - len++; + if (!(flags & FL_LPAD)) { + if (flags & FL_ZFILL) { + prec = c; + if (len < width) { + prec += width - len; + len = width; } } - - width = (len < width) ? width - len : 0; - - if (flags & FL_ALT) { - putc ('0', stream); - if (flags & FL_ALTHEX) - putc (flags & FL_ALTUPP ? 'X' : 'x', stream); - } else if (flags & (FL_NEGATIVE | FL_PLUS | FL_SPACE)) { - unsigned char z = ' '; - if (flags & FL_PLUS) z = '+'; - if (flags & FL_NEGATIVE) z = '-'; - putc (z, stream); - } - - while (prec > c) { - putc ('0', stream); - prec--; + while (len < width) { + putc (' ', stream); + len++; } - - do { - putc (buf[--c], stream); - } while (c); } - + + width = (len < width) ? width - len : 0; + + if (flags & FL_ALT) { + putc ('0', stream); + if (flags & FL_ALTHEX) + putc (flags & FL_ALTUPP ? 'X' : 'x', stream); + } else if (flags & (FL_NEGATIVE | FL_PLUS | FL_SPACE)) { + unsigned char z = ' '; + if (flags & FL_PLUS) z = '+'; + if (flags & FL_NEGATIVE) z = '-'; + putc (z, stream); + } + + while (prec > c) { + putc ('0', stream); + prec--; + } + + while (c) + putc (buf[--c], stream); + tail: /* Tail is possible. */ while (width) { @@ -661,5 +742,3 @@ } #endif /* PRINTF_LEVEL > PRINTF_MIN */ - -#endif /* !defined(__AVR_TINY__) */ diff -Nru libnewlib-nano-2.10.0/newlib/libc/tinystdio/vfscanf.c libnewlib-nano-2.11.2/newlib/libc/tinystdio/vfscanf.c --- libnewlib-nano-2.10.0/newlib/libc/tinystdio/vfscanf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libc/tinystdio/vfscanf.c 2018-11-14 22:26:13.000000000 +0000 @@ -32,8 +32,6 @@ /* $Id: vfscanf.c 2191 2010-11-05 13:45:57Z arcanum $ */ -#if !defined(__AVR_TINY__) - #include #include #include @@ -86,10 +84,8 @@ # endif #endif -/* Add noinline attribute to avoid GCC 4.2 optimization. */ - -__attribute__((noinline)) -static void putval (void *addr, long val, uint16_t flags) +static void +putval (void *addr, long val, uint16_t flags) { if (!(flags & FL_STAR)) { if (flags & FL_CHAR) @@ -103,7 +99,6 @@ } } -__attribute__((noinline)) static unsigned long mulacc (unsigned long val, uint16_t flags, unsigned char c) { @@ -122,7 +117,6 @@ return val + c; } -__attribute__((noinline)) static unsigned char conv_int (FILE *stream, width_t width, void *addr, uint16_t flags) { @@ -195,7 +189,6 @@ } #if SCANF_BRACKET -__attribute__((noinline)) static const char * conv_brk (FILE *stream, width_t width, char *addr, const char *fmt) { @@ -277,30 +270,19 @@ #if SCANF_FLOAT -/* GCC before 4.2 does not use a library function to convert an unsigned - long to float. Instead it uses a signed long to float conversion - function along with a large inline code to correct the result. - Seems, GCC 4.3 does not use it also. */ -extern double __floatunsisf (unsigned long); - -static const float pwr_p10 [6] = { - 1e+1, 1e+2, 1e+4, 1e+8, 1e+16, 1e+32 -}; -static const float pwr_m10 [6] = { - 1e-1, 1e-2, 1e-4, 1e-8, 1e-16, 1e-32 -}; +#include "dtoa_engine.h" static const char pstr_nfinity[] = "nfinity"; static const char pstr_an[] = "an"; -__attribute__((noinline)) -static unsigned char conv_flt (FILE *stream, width_t width, float *addr) +static unsigned char +conv_flt (FILE *stream, width_t width, void *addr, uint16_t flags) { - uint32_t u32; - float flt; + uint64_t u64; + double flt; int i; const char *p; - const float *f; + const double *f; int exp; uint16_t flag; @@ -351,7 +333,7 @@ default: exp = 0; - u32 = 0; + u64 = 0; do { unsigned char c = i - '0'; @@ -364,8 +346,8 @@ } else { if (flag & FL_DOT) exp -= 1; - u32 = mulacc (u32, FL_DEC, c); - if (u32 >= (0xffffffffUL - 9) / 10) + u64 = u64 * 10 + c; + if (u64 >= (0xffffffffffffffffULL - 9) / 10) flag |= FL_OVFL; } @@ -397,7 +379,7 @@ expacc = 0; do { - expacc = mulacc (expacc, FL_DEC, i - '0'); + expacc = expacc * 10 + (i - '0'); } while (--width && isdigit (i = getc(stream))); if (flag & FL_MEXP) expacc = -expacc; @@ -405,26 +387,36 @@ } if (width && i >= 0) ungetc (i, stream); - - flt = u32; + + flt = u64; if (exp < 0) { - f = pwr_m10 + 5; + f = __dtoa_scale_down + DTOA_SCALE_DOWN_NUM - 1; exp = -exp; + width = 1 << (DTOA_SCALE_DOWN_NUM - 1); } else { - f = pwr_p10 + 5; + f = __dtoa_scale_up + DTOA_SCALE_UP_NUM - 1; + width = 1 << (DTOA_SCALE_UP_NUM - 1); } - for (width = 32; width; width >>= 1) { - for (; (unsigned)exp >= width; exp -= width) { + + while (exp) { + if (exp >= width) { flt *= *f; + exp -= width; } f--; + width >>= 1; } } /* switch */ if (flag & FL_MINUS) flt = -flt; - if (addr) *addr = flt; + if (addr) { + if (flags & FL_LONG) + *((double *) addr) = flt; + else + *((float *) addr) = flt; + } return 1; err: @@ -432,7 +424,6 @@ } #endif /* SCANF_FLOAT */ -__attribute__((noinline)) static int skip_spaces (FILE *stream) { int i; @@ -619,7 +610,7 @@ width = 0; while ((c -= '0') < 10) { flags |= FL_WIDTH; - width = mulacc (width, FL_DEC, c); + width = width * 10 + c; c = *fmt++; } c += '0'; @@ -726,7 +717,7 @@ break; default: /* e,E,f,F,g,G */ - c = conv_flt (stream, width, addr); + c = conv_flt (stream, width, addr, flags); #else case 'd': case 'u': @@ -760,5 +751,3 @@ eof: return nconvs ? nconvs : EOF; } - -#endif /* !defined(__AVR_TINY__) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/cosf.c libnewlib-nano-2.11.2/newlib/libm/common/cosf.c --- libnewlib-nano-2.10.0/newlib/libm/common/cosf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/cosf.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,6 +1,8 @@ /* Single-precision cos function. Copyright (c) 2018 Arm Ltd. All rights reserved. + SPDX-License-Identifier: BSD-3-Clause + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, @@ -32,11 +34,10 @@ #include "math_config.h" #include "sincosf.h" -/* Fast cosf implementation. Worst-case ULP is 0.56072, maximum relative - error is 0.5303p-23. A single-step signed range reduction is used for +/* Fast cosf implementation. Worst-case ULP is 0.5607, maximum relative + error is 0.5303 * 2^-23. A single-step range reduction is used for small values. Large inputs have their range reduced using fast integer - arithmetic. -*/ + arithmetic. */ float cosf (float y) { diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/exp2.c libnewlib-nano-2.11.2/newlib/libm/common/exp2.c --- libnewlib-nano-2.10.0/newlib/libm/common/exp2.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/exp2.c 2018-11-14 22:26:13.000000000 +0000 @@ -15,10 +15,10 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY Arm LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL Arm LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/exp.c libnewlib-nano-2.11.2/newlib/libm/common/exp.c --- libnewlib-nano-2.10.0/newlib/libm/common/exp.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/exp.c 2018-11-14 22:26:13.000000000 +0000 @@ -15,10 +15,10 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY Arm LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL Arm LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/exp_data.c libnewlib-nano-2.11.2/newlib/libm/common/exp_data.c --- libnewlib-nano-2.10.0/newlib/libm/common/exp_data.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/exp_data.c 2018-11-14 22:26:13.000000000 +0000 @@ -15,10 +15,10 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY Arm LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL Arm LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/log2.c libnewlib-nano-2.11.2/newlib/libm/common/log2.c --- libnewlib-nano-2.10.0/newlib/libm/common/log2.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/log2.c 2018-11-14 22:26:13.000000000 +0000 @@ -15,10 +15,10 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY Arm LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS'' IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL Arm LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/log2_data.c libnewlib-nano-2.11.2/newlib/libm/common/log2_data.c --- libnewlib-nano-2.10.0/newlib/libm/common/log2_data.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/log2_data.c 2018-11-14 22:26:13.000000000 +0000 @@ -15,10 +15,10 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY Arm LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL Arm LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF @@ -66,6 +66,32 @@ 0x1.a6225e117f92ep-3, #endif }, +/* Algorithm: + + x = 2^k z + log2(x) = k + log2(c) + log2(z/c) + log2(z/c) = poly(z/c - 1) + +where z is in [1.6p-1; 1.6p0] which is split into N subintervals and z falls +into the ith one, then table entries are computed as + + tab[i].invc = 1/c + tab[i].logc = (double)log2(c) + tab2[i].chi = (double)c + tab2[i].clo = (double)(c - (double)c) + +where c is near the center of the subinterval and is chosen by trying +-2^29 +floating point invc candidates around 1/center and selecting one for which + + 1) the rounding error in 0x1.8p10 + logc is 0, + 2) the rounding error in z - chi - clo is < 0x1p-64 and + 3) the rounding error in (double)log2(c) is minimized (< 0x1p-68). + +Note: 1) ensures that k + logc can be computed without rounding error, 2) +ensures that z/c - 1 can be computed as (z - chi - clo)*invc with close to a +single rounding error when there is no fast fma for z*invc - 1, 3) ensures +that logc + poly(z/c - 1) has small error, however near x == 1 when +|log2(x)| < 0x1p-4, this is not enough so that is special cased. */ .tab = { #if N == 64 {0x1.724286bb1acf8p+0, -0x1.1095feecdb000p-1}, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/log.c libnewlib-nano-2.11.2/newlib/libm/common/log.c --- libnewlib-nano-2.10.0/newlib/libm/common/log.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/log.c 2018-11-14 22:26:13.000000000 +0000 @@ -15,10 +15,10 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY Arm LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL Arm LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/log_data.c libnewlib-nano-2.11.2/newlib/libm/common/log_data.c --- libnewlib-nano-2.10.0/newlib/libm/common/log_data.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/log_data.c 2018-11-14 22:26:13.000000000 +0000 @@ -15,10 +15,10 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY Arm LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL Arm LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF @@ -110,6 +110,32 @@ 0x1.2493c29331a5cp-3, #endif }, +/* Algorithm: + + x = 2^k z + log(x) = k ln2 + log(c) + log(z/c) + log(z/c) = poly(z/c - 1) + +where z is in [1.6p-1; 1.6p0] which is split into N subintervals and z falls +into the ith one, then table entries are computed as + + tab[i].invc = 1/c + tab[i].logc = (double)log(c) + tab2[i].chi = (double)c + tab2[i].clo = (double)(c - (double)c) + +where c is near the center of the subinterval and is chosen by trying +-2^29 +floating point invc candidates around 1/center and selecting one for which + + 1) the rounding error in 0x1.8p9 + logc is 0, + 2) the rounding error in z - chi - clo is < 0x1p-66 and + 3) the rounding error in (double)log(c) is minimized (< 0x1p-66). + +Note: 1) ensures that k*ln2hi + logc can be computed without rounding error, +2) ensures that z/c - 1 can be computed as (z - chi - clo)*invc with close to +a single rounding error when there is no fast fma for z*invc - 1, 3) ensures +that logc + poly(z/c - 1) has small error, however near x == 1 when +|log(x)| < 0x1p-4, this is not enough so that is special cased. */ .tab = { #if N == 64 {0x1.7242886495cd8p+0, -0x1.79e267bdfe000p-2}, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/math_config.h libnewlib-nano-2.11.2/newlib/libm/common/math_config.h --- libnewlib-nano-2.10.0/newlib/libm/common/math_config.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/math_config.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,6 +1,8 @@ /* Configuration for math routines. Copyright (c) 2017-2018 Arm Ltd. All rights reserved. + SPDX-License-Identifier: BSD-3-Clause + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, @@ -155,7 +157,7 @@ uint32_t ix = asuint (x); if (!IEEE_754_2008_SNAN) return (ix & 0x7fc00000) == 0x7fc00000; - return 2 * (ix ^ 0x00400000) > 2u * 0x7fc00000; + return 2 * (ix ^ 0x00400000) > 0xFF800000u; } static inline int diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/math_err.c libnewlib-nano-2.11.2/newlib/libm/common/math_err.c --- libnewlib-nano-2.10.0/newlib/libm/common/math_err.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/math_err.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,5 @@ /* Double-precision math error handling. - Copyright (c) 2018 ARM Ltd. All rights reserved. + Copyright (c) 2018 Arm Ltd. All rights reserved. SPDX-License-Identifier: BSD-3-Clause @@ -15,10 +15,10 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY Arm LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL Arm LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/math_errf.c libnewlib-nano-2.11.2/newlib/libm/common/math_errf.c --- libnewlib-nano-2.10.0/newlib/libm/common/math_errf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/math_errf.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,7 @@ /* Single-precision math error handling. - Copyright (c) 2017-2018 ARM Ltd. All rights reserved. + Copyright (c) 2017-2018 Arm Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/meson.build libnewlib-nano-2.11.2/newlib/libm/common/meson.build --- libnewlib-nano-2.10.0/newlib/libm/common/meson.build 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -163,6 +163,10 @@ srcs_common = dsrc_common + fsrc_common +if have_long_double + srcs_common += lsrc_common +endif + hdrs_common = [ 'fdlibm.h', 'local.h', diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/nanl.c libnewlib-nano-2.11.2/newlib/libm/common/nanl.c --- libnewlib-nano-2.10.0/newlib/libm/common/nanl.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/nanl.c 2018-11-14 22:26:13.000000000 +0000 @@ -38,5 +38,11 @@ { return nan(tagp); } +#elif __GNUC_PREREQ (3, 3) +long double +nanl (const char *tagp) +{ + return __builtin_nanl(""); +} #endif diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/pow.c libnewlib-nano-2.11.2/newlib/libm/common/pow.c --- libnewlib-nano-2.10.0/newlib/libm/common/pow.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/pow.c 2018-11-14 22:26:13.000000000 +0000 @@ -15,10 +15,10 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY Arm LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL Arm LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF @@ -268,7 +268,8 @@ return scale + scale * tmp; } -/* Returns 0 if not int, 1 if odd int, 2 if even int. */ +/* Returns 0 if not int, 1 if odd int, 2 if even int. The argument is + the bit representation of a non-zero finite floating-point value. */ static inline int checkint (uint64_t iy) { diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/pow_log_data.c libnewlib-nano-2.11.2/newlib/libm/common/pow_log_data.c --- libnewlib-nano-2.10.0/newlib/libm/common/pow_log_data.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/pow_log_data.c 2018-11-14 22:26:13.000000000 +0000 @@ -15,10 +15,10 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY Arm LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL Arm LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF @@ -50,6 +50,28 @@ -0x1.0002b8b263fc3p-3 * -8, #endif }, +/* Algorithm: + + x = 2^k z + log(x) = k ln2 + log(c) + log(z/c) + log(z/c) = poly(z/c - 1) + +where z is in [0x1.69555p-1; 0x1.69555p0] which is split into N subintervals +and z falls into the ith one, then table entries are computed as + + tab[i].invc = 1/c + tab[i].logc = round(0x1p43*log(c))/0x1p43 + tab[i].logctail = (double)(log(c) - logc) + +where c is chosen near the center of the subinterval such that 1/c has only a +few precision bits so z/c - 1 is exactly representible as double: + + 1/c = center < 1 ? round(N/center)/N : round(2*N/center)/N/2 + +Note: |z/c - 1| < 1/N for the chosen c, |log(c) - logc - logctail| < 0x1p-97, +the last few bits of logc are rounded away so k*ln2hi + logc has no rounding +error and the interval for z is selected such that near x == 1, where log(x) +is tiny, large cancellation error is avoided in logc + poly(z/c - 1). */ .tab = { #if N == 128 #define A(a,b,c) {a,0,b,c}, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sf_exp2.c libnewlib-nano-2.11.2/newlib/libm/common/sf_exp2.c --- libnewlib-nano-2.10.0/newlib/libm/common/sf_exp2.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sf_exp2.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,7 @@ /* Single-precision 2^x function. - Copyright (c) 2017 ARM Ltd. All rights reserved. + Copyright (c) 2017 Arm Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sf_exp2_data.c libnewlib-nano-2.11.2/newlib/libm/common/sf_exp2_data.c --- libnewlib-nano-2.10.0/newlib/libm/common/sf_exp2_data.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sf_exp2_data.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,7 @@ /* Shared data between expf, exp2f and powf. - Copyright (c) 2017 ARM Ltd. All rights reserved. + Copyright (c) 2017 Arm Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sf_exp.c libnewlib-nano-2.11.2/newlib/libm/common/sf_exp.c --- libnewlib-nano-2.10.0/newlib/libm/common/sf_exp.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sf_exp.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,7 @@ /* Single-precision e^x function. - Copyright (c) 2017 ARM Ltd. All rights reserved. + Copyright (c) 2017 Arm Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sf_log2.c libnewlib-nano-2.11.2/newlib/libm/common/sf_log2.c --- libnewlib-nano-2.10.0/newlib/libm/common/sf_log2.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sf_log2.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,7 @@ /* Single-precision log2 function. - Copyright (c) 2017 ARM Ltd. All rights reserved. + Copyright (c) 2017 Arm Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sf_log2_data.c libnewlib-nano-2.11.2/newlib/libm/common/sf_log2_data.c --- libnewlib-nano-2.10.0/newlib/libm/common/sf_log2_data.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sf_log2_data.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,7 @@ /* Data definition for log2f. - Copyright (c) 2017 ARM Ltd. All rights reserved. + Copyright (c) 2017 Arm Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sf_log.c libnewlib-nano-2.11.2/newlib/libm/common/sf_log.c --- libnewlib-nano-2.10.0/newlib/libm/common/sf_log.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sf_log.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,7 @@ /* Single-precision log function. - Copyright (c) 2017 ARM Ltd. All rights reserved. + Copyright (c) 2017 Arm Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sf_log_data.c libnewlib-nano-2.11.2/newlib/libm/common/sf_log_data.c --- libnewlib-nano-2.10.0/newlib/libm/common/sf_log_data.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sf_log_data.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,7 @@ /* Data definition for logf. - Copyright (c) 2017 ARM Ltd. All rights reserved. + Copyright (c) 2017 Arm Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sf_pow.c libnewlib-nano-2.11.2/newlib/libm/common/sf_pow.c --- libnewlib-nano-2.10.0/newlib/libm/common/sf_pow.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sf_pow.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,7 @@ /* Single-precision pow function. - Copyright (c) 2017-2018 ARM Ltd. All rights reserved. + Copyright (c) 2017-2018 Arm Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, @@ -127,7 +129,8 @@ return y; } -/* Returns 0 if not int, 1 if odd int, 2 if even int. */ +/* Returns 0 if not int, 1 if odd int, 2 if even int. The argument is + the bit representation of a non-zero finite floating-point value. */ static inline int checkint (uint32_t iy) { diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sf_pow_log2_data.c libnewlib-nano-2.11.2/newlib/libm/common/sf_pow_log2_data.c --- libnewlib-nano-2.10.0/newlib/libm/common/sf_pow_log2_data.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sf_pow_log2_data.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,7 @@ /* Data definition for powf. - Copyright (c) 2017 ARM Ltd. All rights reserved. + Copyright (c) 2017 Arm Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sincosf.c libnewlib-nano-2.11.2/newlib/libm/common/sincosf.c --- libnewlib-nano-2.10.0/newlib/libm/common/sincosf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sincosf.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,6 +1,8 @@ /* Single-precision sincos function. Copyright (c) 2018 Arm Ltd. All rights reserved. + SPDX-License-Identifier: BSD-3-Clause + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, @@ -32,11 +34,10 @@ #include "math_config.h" #include "sincosf.h" -/* Fast sincosf implementation. Worst-case ULP is 0.56072, maximum relative - error is 0.5303p-23. A single-step signed range reduction is used for +/* Fast sincosf implementation. Worst-case ULP is 0.5607, maximum relative + error is 0.5303 * 2^-23. A single-step range reduction is used for small values. Large inputs have their range reduced using fast integer - arithmetic. -*/ + arithmetic. */ void sincosf (float y, float *sinp, float *cosp) { diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sincosf_data.c libnewlib-nano-2.11.2/newlib/libm/common/sincosf_data.c --- libnewlib-nano-2.10.0/newlib/libm/common/sincosf_data.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sincosf_data.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,6 +1,8 @@ /* Data definitions for sinf, cosf and sincosf. Copyright (c) 2018 Arm Ltd. All rights reserved. + SPDX-License-Identifier: BSD-3-Clause + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sincosf.h libnewlib-nano-2.11.2/newlib/libm/common/sincosf.h --- libnewlib-nano-2.10.0/newlib/libm/common/sincosf.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sincosf.h 2018-11-14 22:26:13.000000000 +0000 @@ -1,6 +1,8 @@ /* Header for single-precision sin/cos/sincos functions. Copyright (c) 2018 Arm Ltd. All rights reserved. + SPDX-License-Identifier: BSD-3-Clause + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, @@ -28,19 +30,25 @@ #include #include "math_config.h" -/* PI * 2^-64. */ -static const double pi64 = 0x1.921FB54442D18p-62; +/* 2PI * 2^-64. */ +static const double pi63 = 0x1.921FB54442D18p-62; /* PI / 4. */ static const double pio4 = 0x1.921FB54442D18p-1; +/* The constants and polynomials for sine and cosine. */ typedef struct { - double sign[4]; - double hpi_inv, hpi, c0, c1, c2, c3, c4, s1, s2, s3; + double sign[4]; /* Sign of sine in quadrants 0..3. */ + double hpi_inv; /* 2 / PI ( * 2^24 if !TOINT_INTRINSICS). */ + double hpi; /* PI / 2. */ + double c0, c1, c2, c3, c4; /* Cosine polynomial. */ + double s1, s2, s3; /* Sine polynomial. */ } sincos_t; +/* Polynomial data (the cosine polynomial is negated in the 2nd entry). */ extern const sincos_t __sincosf_table[2] HIDDEN; +/* Table with 4/PI to 192 bit precision. */ extern const uint32_t __inv_pio4[] HIDDEN; /* Top 12 bits of the float representation with the sign bit cleared. */ @@ -114,18 +122,20 @@ X as a value between -PI/4 and PI/4 and store the quadrant in NP. The values for PI/2 and 2/PI are accessed via P. Since PI/2 as a double is accurate to 55 bits and the worst-case cancellation happens at 6 * PI/4, - only 2 multiplies are required and the result is accurate for |X| <= 120.0. - Use round/lround if inlined, otherwise convert to int. To avoid inaccuracies - introduced by truncating negative values, compute the quadrant * 2^24. */ + the result is accurate for |X| <= 120.0. */ static inline double reduce_fast (double x, const sincos_t *p, int *np) { double r; #if TOINT_INTRINSICS + /* Use fast round and lround instructions when available. */ r = x * p->hpi_inv; *np = converttoint (r); return x - roundtoint (r) * p->hpi; #else + /* Use scaled float to int conversion with explicit rounding. + hpi_inv is prescaled by 2^24 so the quadrant ends up in bits 24..31. + This avoids inaccuracies introduced by truncating negative values. */ r = x * p->hpi_inv; int n = ((int32_t)r + 0x800000) >> 24; *np = n; @@ -133,7 +143,7 @@ #endif } -/* Reduce the range of XI to a multiple of PI/4 using fast integer arithmetic. +/* Reduce the range of XI to a multiple of PI/2 using fast integer arithmetic. XI is a reinterpreted float and must be >= 2.0f (the sign bit is ignored). Return the modulo between -PI/4 and PI/4 and store the quadrant in NP. Reduction uses a table of 4/PI with 192 bits of precision. A 32x96->128 bit @@ -160,5 +170,5 @@ res0 -= n << 62; double x = (int64_t)res0; *np = n; - return x * pi64; + return x * pi63; } diff -Nru libnewlib-nano-2.10.0/newlib/libm/common/sinf.c libnewlib-nano-2.11.2/newlib/libm/common/sinf.c --- libnewlib-nano-2.10.0/newlib/libm/common/sinf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/common/sinf.c 2018-11-14 22:26:13.000000000 +0000 @@ -1,6 +1,8 @@ /* Single-precision sin function. Copyright (c) 2018 Arm Ltd. All rights reserved. + SPDX-License-Identifier: BSD-3-Clause + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +15,7 @@ products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, @@ -31,11 +33,10 @@ #include "math_config.h" #include "sincosf.h" -/* Fast sinf implementation. Worst-case ULP is 0.56072, maximum relative - error is 0.5303p-23. A single-step signed range reduction is used for +/* Fast sinf implementation. Worst-case ULP is 0.5607, maximum relative + error is 0.5303 * 2^-23. A single-step range reduction is used for small values. Large inputs have their range reduced using fast integer - arithmetic. -*/ + arithmetic. */ float sinf (float y) { diff -Nru libnewlib-nano-2.10.0/newlib/libm/configure libnewlib-nano-2.11.2/newlib/libm/configure --- libnewlib-nano-2.10.0/newlib/libm/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/configure 2018-11-14 22:26:13.000000000 +0000 @@ -768,6 +768,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1417,6 +1418,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2879,6 +2881,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3725,8 +3739,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11495,7 +11507,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11498 "configure" +#line 11510 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11601,7 +11613,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11604 "configure" +#line 11616 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libm/machine/aarch64/configure libnewlib-nano-2.11.2/newlib/libm/machine/aarch64/configure --- libnewlib-nano-2.10.0/newlib/libm/machine/aarch64/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/machine/aarch64/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libm/machine/arm/configure libnewlib-nano-2.11.2/newlib/libm/machine/arm/configure --- libnewlib-nano-2.10.0/newlib/libm/machine/arm/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/machine/arm/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libm/machine/arm/meson.build libnewlib-nano-2.11.2/newlib/libm/machine/arm/meson.build --- libnewlib-nano-2.10.0/newlib/libm/machine/arm/meson.build 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/machine/arm/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,26 @@ +srcs_libm_machine = [ + 'e_sqrt.c', + 'ef_sqrt.c', + 's_ceil.c', + 's_floor.c', + 's_nearbyint.c', + 's_rint.c', + 's_round.c', + 's_trunc.c', + 'sf_ceil.c', + 'sf_floor.c', + 'sf_nearbyint.c', + 'sf_rint.c', + 'sf_round.c', + 'sf_trunc.c', +] + +foreach target : targets + value = get_variable('target_' + target) + set_variable('lib_machine' + target, + static_library('machine' + target, + srcs_libm_machine, + pic: false, + include_directories: [ inc, include_directories('../../common') ], + c_args: value[1] + ['-fno-builtin'])) +endforeach diff -Nru libnewlib-nano-2.10.0/newlib/libm/machine/configure libnewlib-nano-2.11.2/newlib/libm/machine/configure --- libnewlib-nano-2.10.0/newlib/libm/machine/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/machine/configure 2018-11-14 22:26:13.000000000 +0000 @@ -3671,8 +3671,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11441,7 +11439,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11444 "configure" +#line 11442 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11547,7 +11545,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11550 "configure" +#line 11548 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libm/machine/i386/configure libnewlib-nano-2.11.2/newlib/libm/machine/i386/configure --- libnewlib-nano-2.10.0/newlib/libm/machine/i386/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/machine/i386/configure 2018-11-14 22:26:13.000000000 +0000 @@ -760,6 +760,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode enable_shared @@ -1408,6 +1409,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2815,6 +2817,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3661,8 +3675,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} @@ -11431,7 +11443,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11434 "configure" +#line 11446 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11537,7 +11549,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11540 "configure" +#line 11552 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Nru libnewlib-nano-2.10.0/newlib/libm/machine/nds32/configure libnewlib-nano-2.11.2/newlib/libm/machine/nds32/configure --- libnewlib-nano-2.10.0/newlib/libm/machine/nds32/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/machine/nds32/configure 2018-11-14 22:26:13.000000000 +0000 @@ -700,6 +700,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1341,6 +1342,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2512,6 +2514,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3358,8 +3372,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libm/machine/riscv/configure libnewlib-nano-2.11.2/newlib/libm/machine/riscv/configure --- libnewlib-nano-2.10.0/newlib/libm/machine/riscv/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/machine/riscv/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libm/machine/spu/configure libnewlib-nano-2.11.2/newlib/libm/machine/spu/configure --- libnewlib-nano-2.10.0/newlib/libm/machine/spu/configure 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/machine/spu/configure 2018-11-14 22:26:13.000000000 +0000 @@ -689,6 +689,7 @@ enable_newlib_elix_level enable_newlib_io_float enable_newlib_supplied_syscalls +enable_newlib_fno_builtin enable_dependency_tracking enable_maintainer_mode ' @@ -1325,6 +1326,7 @@ --enable-newlib-elix-level supply desired elix library level (1-4) --disable-newlib-io-float disable printf/scanf family float support --disable-newlib-supplied-syscalls disable newlib from supplying syscalls + --disable-newlib-fno-builtin disable -fno-builtin flag to allow compiler to use builtin library functions --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-maintainer-mode enable make rules and dependencies not useful @@ -2489,6 +2491,18 @@ fi +# Check whether --enable-newlib-fno-builtin was given. +if test "${enable_newlib_fno_builtin+set}" = set; then : + enableval=$enable_newlib_fno_builtin; case "${enableval}" in + yes) newlib_fno_builtin=yes ;; + no) newlib_fno_builtin=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-fno-builtin option" "$LINENO" 5 ;; + esac +else + newlib_fno_builtin= +fi + + test -z "${with_target_subdir}" && with_target_subdir=. @@ -3335,8 +3349,6 @@ . ${newlib_basedir}/configure.host -newlib_cflags="${newlib_cflags} -fno-builtin" - NEWLIB_CFLAGS=${newlib_cflags} diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_acos.c libnewlib-nano-2.11.2/newlib/libm/math/e_acos.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_acos.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_acos.c 2018-11-14 22:26:13.000000000 +0000 @@ -59,6 +59,10 @@ qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_acos, acos); +#endif + #ifdef __STDC__ double __ieee754_acos(double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_acosh.c libnewlib-nano-2.11.2/newlib/libm/math/e_acosh.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_acosh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_acosh.c 2018-11-14 22:26:13.000000000 +0000 @@ -38,6 +38,10 @@ one = 1.0, ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_acosh, acosh); +#endif + #ifdef __STDC__ double __ieee754_acosh(double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_asin.c libnewlib-nano-2.11.2/newlib/libm/math/e_asin.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_asin.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_asin.c 2018-11-14 22:26:13.000000000 +0000 @@ -68,6 +68,10 @@ qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_asin, asin); +#endif + #ifdef __STDC__ double __ieee754_asin(double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_atan2.c libnewlib-nano-2.11.2/newlib/libm/math/e_atan2.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_atan2.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_atan2.c 2018-11-14 22:26:13.000000000 +0000 @@ -55,6 +55,10 @@ pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_atan2, atan2); +#endif + #ifdef __STDC__ double __ieee754_atan2(double y, double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_atanh.c libnewlib-nano-2.11.2/newlib/libm/math/e_atanh.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_atanh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_atanh.c 2018-11-14 22:26:13.000000000 +0000 @@ -46,6 +46,10 @@ static double zero = 0.0; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_atanh, atanh); +#endif + #ifdef __STDC__ double __ieee754_atanh(double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_cosh.c libnewlib-nano-2.11.2/newlib/libm/math/e_cosh.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_cosh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_cosh.c 2018-11-14 22:26:13.000000000 +0000 @@ -42,6 +42,10 @@ static double one = 1.0, half=0.5, huge = 1.0e300; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_cosh, cosh); +#endif + #ifdef __STDC__ double __ieee754_cosh(double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_exp.c libnewlib-nano-2.11.2/newlib/libm/math/e_exp.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_exp.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_exp.c 2018-11-14 22:26:13.000000000 +0000 @@ -102,6 +102,10 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_exp, exp); +#endif + #ifdef __STDC__ double __ieee754_exp(double x) /* default IEEE double exp */ #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_acos.c libnewlib-nano-2.11.2/newlib/libm/math/ef_acos.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_acos.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_acos.c 2018-11-14 22:26:13.000000000 +0000 @@ -35,6 +35,10 @@ qS3 = -6.8828397989e-01, /* 0xbf303361 */ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_acosf, acosf); +#endif + #ifdef __STDC__ float __ieee754_acosf(float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_acosh.c libnewlib-nano-2.11.2/newlib/libm/math/ef_acosh.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_acosh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_acosh.c 2018-11-14 22:26:13.000000000 +0000 @@ -24,6 +24,10 @@ one = 1.0, ln2 = 6.9314718246e-01; /* 0x3f317218 */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_acoshf, acoshf); +#endif + #ifdef __STDC__ float __ieee754_acoshf(float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_asin.c libnewlib-nano-2.11.2/newlib/libm/math/ef_asin.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_asin.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_asin.c 2018-11-14 22:26:13.000000000 +0000 @@ -37,6 +37,10 @@ qS3 = -6.8828397989e-01, /* 0xbf303361 */ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_asinf, asinf); +#endif + #ifdef __STDC__ float __ieee754_asinf(float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_atan2.c libnewlib-nano-2.11.2/newlib/libm/math/ef_atan2.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_atan2.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_atan2.c 2018-11-14 22:26:13.000000000 +0000 @@ -28,6 +28,10 @@ pi = 3.1415927410e+00, /* 0x40490fdb */ pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_atan2f, atan2f); +#endif + #ifdef __STDC__ float __ieee754_atan2f(float y, float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_atanh.c libnewlib-nano-2.11.2/newlib/libm/math/ef_atanh.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_atanh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_atanh.c 2018-11-14 22:26:13.000000000 +0000 @@ -28,6 +28,10 @@ static float zero = 0.0; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_atanhf, atanhf); +#endif + #ifdef __STDC__ float __ieee754_atanhf(float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_cosh.c libnewlib-nano-2.11.2/newlib/libm/math/ef_cosh.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_cosh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_cosh.c 2018-11-14 22:26:13.000000000 +0000 @@ -25,6 +25,10 @@ static float one = 1.0, half=0.5, huge = 1.0e30; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_coshf, coshf); +#endif + #ifdef __STDC__ float __ieee754_coshf(float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_exp.c libnewlib-nano-2.11.2/newlib/libm/math/ef_exp.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_exp.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_exp.c 2018-11-14 22:26:13.000000000 +0000 @@ -40,6 +40,10 @@ P4 = -1.6533901999e-06, /* 0xb5ddea0e */ P5 = 4.1381369442e-08; /* 0x3331bb4c */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_expf, expf); +#endif + #ifdef __STDC__ float __ieee754_expf(float x) /* default IEEE double exp */ #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_fmod.c libnewlib-nano-2.11.2/newlib/libm/math/ef_fmod.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_fmod.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_fmod.c 2018-11-14 22:26:13.000000000 +0000 @@ -27,6 +27,10 @@ static float one = 1.0, Zero[] = {0.0, -0.0,}; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_fmodf, fmodf); +#endif + #ifdef __STDC__ float __ieee754_fmodf(float x, float y) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_hypot.c libnewlib-nano-2.11.2/newlib/libm/math/ef_hypot.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_hypot.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_hypot.c 2018-11-14 22:26:13.000000000 +0000 @@ -15,6 +15,10 @@ #include "fdlibm.h" +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_hypotf, hypotf); +#endif + #ifdef __STDC__ float __ieee754_hypotf(float x, float y) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_j0.c libnewlib-nano-2.11.2/newlib/libm/math/ef_j0.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_j0.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_j0.c 2018-11-14 22:26:13.000000000 +0000 @@ -46,6 +46,10 @@ static float zero = 0.0; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_j0f, j0f); +#endif + #ifdef __STDC__ float __ieee754_j0f(float x) #else @@ -115,6 +119,10 @@ v03 = 2.5915085189e-07, /* 0x348b216c */ v04 = 4.4111031494e-10; /* 0x2ff280c2 */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_y0f, y0f); +#endif + #ifdef __STDC__ float __ieee754_y0f(float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_j1.c libnewlib-nano-2.11.2/newlib/libm/math/ef_j1.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_j1.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_j1.c 2018-11-14 22:26:13.000000000 +0000 @@ -47,6 +47,10 @@ static float zero = 0.0; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_j1f, j1f); +#endif + #ifdef __STDC__ float __ieee754_j1f(float x) #else @@ -116,6 +120,10 @@ 1.6655924903e-11, /* 0x2d9281cf */ }; +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_y1f, y1f); +#endif + #ifdef __STDC__ float __ieee754_y1f(float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_jn.c libnewlib-nano-2.11.2/newlib/libm/math/ef_jn.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_jn.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_jn.c 2018-11-14 22:26:13.000000000 +0000 @@ -29,6 +29,10 @@ static float zero = 0.0000000000e+00; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_jnf, jnf); +#endif + #ifdef __STDC__ float __ieee754_jnf(int n, float x) #else @@ -166,6 +170,10 @@ if(sgn==1) return -b; else return b; } +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_ynf, ynf); +#endif + #ifdef __STDC__ float __ieee754_ynf(int n, float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_log10.c libnewlib-nano-2.11.2/newlib/libm/math/ef_log10.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_log10.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_log10.c 2018-11-14 22:26:13.000000000 +0000 @@ -31,6 +31,10 @@ static float zero = 0.0; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_log10f, log10f); +#endif + #ifdef __STDC__ float __ieee754_log10f(float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_log.c libnewlib-nano-2.11.2/newlib/libm/math/ef_log.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_log.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_log.c 2018-11-14 22:26:13.000000000 +0000 @@ -38,6 +38,10 @@ static float zero = 0.0; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_logf, logf); +#endif + #ifdef __STDC__ float __ieee754_logf(float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_fmod.c libnewlib-nano-2.11.2/newlib/libm/math/e_fmod.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_fmod.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_fmod.c 2018-11-14 22:26:13.000000000 +0000 @@ -27,6 +27,10 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_fmod, fmod); +#endif + #ifdef __STDC__ double __ieee754_fmod(double x, double y) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_pow.c libnewlib-nano-2.11.2/newlib/libm/math/ef_pow.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_pow.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_pow.c 2018-11-14 22:26:13.000000000 +0000 @@ -57,6 +57,10 @@ ivln2_h = 1.4426879883e+00, /* 0x3fb8aa00 =16b 1/ln2*/ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_powf, powf); +#endif + #ifdef __STDC__ float __ieee754_powf(float x, float y) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_remainder.c libnewlib-nano-2.11.2/newlib/libm/math/ef_remainder.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_remainder.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_remainder.c 2018-11-14 22:26:13.000000000 +0000 @@ -22,6 +22,10 @@ #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_remainderf, remainderf); +#endif + #ifdef __STDC__ float __ieee754_remainderf(float x, float p) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_rem_pio2.c libnewlib-nano-2.11.2/newlib/libm/math/ef_rem_pio2.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_rem_pio2.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_rem_pio2.c 2018-11-14 22:26:13.000000000 +0000 @@ -95,6 +95,10 @@ pio2_3 = 6.0770943833e-11, /* 0x2e85a300 */ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_rem_pio2f, rem_pio2f); +#endif + #ifdef __STDC__ __int32_t __ieee754_rem_pio2f(float x, float *y) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_scalb.c libnewlib-nano-2.11.2/newlib/libm/math/ef_scalb.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_scalb.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_scalb.c 2018-11-14 22:26:13.000000000 +0000 @@ -16,6 +16,10 @@ #include "fdlibm.h" #include +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_scalbf, scalbf); +#endif + #ifdef _SCALB_INT #ifdef __STDC__ float __ieee754_scalbf(float x, int fn) diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_sinh.c libnewlib-nano-2.11.2/newlib/libm/math/ef_sinh.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_sinh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_sinh.c 2018-11-14 22:26:13.000000000 +0000 @@ -15,6 +15,10 @@ #include "fdlibm.h" +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_sinhf, sinhf); +#endif + #ifdef __STDC__ static const float one = 1.0, shuge = 1.0e37; #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/ef_sqrt.c libnewlib-nano-2.11.2/newlib/libm/math/ef_sqrt.c --- libnewlib-nano-2.10.0/newlib/libm/math/ef_sqrt.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/ef_sqrt.c 2018-11-14 22:26:13.000000000 +0000 @@ -21,6 +21,10 @@ static float one = 1.0, tiny=1.0e-30; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_sqrtf, sqrtf); +#endif + #ifdef __STDC__ float __ieee754_sqrtf(float x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_hypot.c libnewlib-nano-2.11.2/newlib/libm/math/e_hypot.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_hypot.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_hypot.c 2018-11-14 22:26:13.000000000 +0000 @@ -47,6 +47,10 @@ #ifndef _DOUBLE_IS_32BITS +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_hypot, hypot); +#endif + #ifdef __STDC__ double __ieee754_hypot(double x, double y) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_j0.c libnewlib-nano-2.11.2/newlib/libm/math/e_j0.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_j0.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_j0.c 2018-11-14 22:26:13.000000000 +0000 @@ -91,6 +91,10 @@ static double zero = 0.0; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_j0, j0); +#endif + #ifdef __STDC__ double __ieee754_j0(double x) #else @@ -160,6 +164,10 @@ v03 = 2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */ v04 = 4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_y0, y0); +#endif + #ifdef __STDC__ double __ieee754_y0(double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_j1.c libnewlib-nano-2.11.2/newlib/libm/math/e_j1.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_j1.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_j1.c 2018-11-14 22:26:13.000000000 +0000 @@ -92,6 +92,10 @@ static double zero = 0.0; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_j1, j1); +#endif + #ifdef __STDC__ double __ieee754_j1(double x) #else @@ -161,6 +165,10 @@ 1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */ }; +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_y1, y1); +#endif + #ifdef __STDC__ double __ieee754_y1(double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_jn.c libnewlib-nano-2.11.2/newlib/libm/math/e_jn.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_jn.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_jn.c 2018-11-14 22:26:13.000000000 +0000 @@ -56,6 +56,10 @@ static double zero = 0.00000000000000000000e+00; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_jn, jn); +#endif + #ifdef __STDC__ double __ieee754_jn(int n, double x) #else @@ -216,6 +220,10 @@ if(sgn==1) return -b; else return b; } +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_yn, yn); +#endif + #ifdef __STDC__ double __ieee754_yn(int n, double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/el_hypot.c libnewlib-nano-2.11.2/newlib/libm/math/el_hypot.c --- libnewlib-nano-2.10.0/newlib/libm/math/el_hypot.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/el_hypot.c 2018-11-14 22:26:13.000000000 +0000 @@ -6,6 +6,10 @@ #include "fdlibm.h" +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_hypotl, hypotl); +#endif + long double __ieee754_hypotl (long double x, long double y) { diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_log10.c libnewlib-nano-2.11.2/newlib/libm/math/e_log10.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_log10.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_log10.c 2018-11-14 22:26:13.000000000 +0000 @@ -64,6 +64,10 @@ static double zero = 0.0; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_log10, log10); +#endif + #ifdef __STDC__ double __ieee754_log10(double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_log.c libnewlib-nano-2.11.2/newlib/libm/math/e_log.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_log.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_log.c 2018-11-14 22:26:13.000000000 +0000 @@ -89,6 +89,10 @@ static double zero = 0.0; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_log, log); +#endif + #ifdef __STDC__ double __ieee754_log(double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_pow.c libnewlib-nano-2.11.2/newlib/libm/math/e_pow.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_pow.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_pow.c 2018-11-14 22:26:13.000000000 +0000 @@ -99,6 +99,10 @@ ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_pow, pow); +#endif + #ifdef __STDC__ double __ieee754_pow(double x, double y) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_remainder.c libnewlib-nano-2.11.2/newlib/libm/math/e_remainder.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_remainder.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_remainder.c 2018-11-14 22:26:13.000000000 +0000 @@ -31,6 +31,10 @@ #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_remainder, remainder); +#endif + #ifdef __STDC__ double __ieee754_remainder(double x, double p) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_rem_pio2.c libnewlib-nano-2.11.2/newlib/libm/math/e_rem_pio2.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_rem_pio2.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_rem_pio2.c 2018-11-14 22:26:13.000000000 +0000 @@ -82,6 +82,10 @@ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_rem_pio2, rem_pio2); +#endif + #ifdef __STDC__ __int32_t __ieee754_rem_pio2(double x, double *y) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/erf_gamma.c libnewlib-nano-2.11.2/newlib/libm/math/erf_gamma.c --- libnewlib-nano-2.10.0/newlib/libm/math/erf_gamma.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/erf_gamma.c 2018-11-14 22:26:13.000000000 +0000 @@ -23,6 +23,10 @@ #include "fdlibm.h" +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_gammaf_r, gammaf_r); +#endif + #ifdef __STDC__ float __ieee754_gammaf_r(float x, int *signgamp) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/erf_lgamma.c libnewlib-nano-2.11.2/newlib/libm/math/erf_lgamma.c --- libnewlib-nano-2.10.0/newlib/libm/math/erf_lgamma.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/erf_lgamma.c 2018-11-14 22:26:13.000000000 +0000 @@ -144,6 +144,10 @@ } +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_lgammaf_r, lgammaf_r); +#endif + #ifdef __STDC__ float __ieee754_lgammaf_r(float x, int *signgamp) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/er_gamma.c libnewlib-nano-2.11.2/newlib/libm/math/er_gamma.c --- libnewlib-nano-2.10.0/newlib/libm/math/er_gamma.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/er_gamma.c 2018-11-14 22:26:13.000000000 +0000 @@ -21,6 +21,10 @@ #include "fdlibm.h" +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_gamma_r, gamma_r); +#endif + #ifdef __STDC__ double __ieee754_gamma_r(double x, int *signgamp) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/er_lgamma.c libnewlib-nano-2.11.2/newlib/libm/math/er_lgamma.c --- libnewlib-nano-2.10.0/newlib/libm/math/er_lgamma.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/er_lgamma.c 2018-11-14 22:26:13.000000000 +0000 @@ -209,6 +209,10 @@ } +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_lgamma_r, lgamma_r); +#endif + #ifdef __STDC__ double __ieee754_lgamma_r(double x, int *signgamp) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_scalb.c libnewlib-nano-2.11.2/newlib/libm/math/e_scalb.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_scalb.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_scalb.c 2018-11-14 22:26:13.000000000 +0000 @@ -21,6 +21,10 @@ #ifndef _DOUBLE_IS_32BITS +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_scalb, scalb); +#endif + #ifdef _SCALB_INT #ifdef __STDC__ double __ieee754_scalb(double x, int fn) @@ -46,8 +50,13 @@ else return x/(-fn); } if (rint(fn)!=fn) return (fn-fn)/(fn-fn); +#if INT_MAX == 32767 + if ( fn > 65000.0) return scalbln(x, 65000); + if (-fn > 65000.0) return scalbln(x,-65000); +#else if ( fn > 65000.0) return scalbn(x, 65000); if (-fn > 65000.0) return scalbn(x,-65000); +#endif return scalbn(x,(int)fn); #endif } diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_sinh.c libnewlib-nano-2.11.2/newlib/libm/math/e_sinh.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_sinh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_sinh.c 2018-11-14 22:26:13.000000000 +0000 @@ -39,6 +39,10 @@ static double one = 1.0, shuge = 1.0e307; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_sinh, sinh); +#endif + #ifdef __STDC__ double __ieee754_sinh(double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/e_sqrt.c libnewlib-nano-2.11.2/newlib/libm/math/e_sqrt.c --- libnewlib-nano-2.10.0/newlib/libm/math/e_sqrt.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/e_sqrt.c 2018-11-14 22:26:13.000000000 +0000 @@ -91,6 +91,10 @@ static double one = 1.0, tiny=1.0e-300; #endif +#if defined(_IEEE_LIBM) && defined(HAVE_ALIAS_ATTRIBUTE) +__strong_reference(__ieee754_sqrt, sqrt); +#endif + #ifdef __STDC__ double __ieee754_sqrt(double x) #else diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/meson.build libnewlib-nano-2.11.2/newlib/libm/math/meson.build --- libnewlib-nano-2.10.0/newlib/libm/math/meson.build 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -31,7 +31,6 @@ 'e_j0.c', 'e_j1.c', 'e_jn.c', - 'el_hypot.c', 'e_log10.c', 'e_log.c', 'e_pow.c', @@ -135,6 +134,15 @@ 'w_sqrt.c', 'w_tgamma.c', ] + +l_srcs_math = [ + 'el_hypot.c', + ] + +if have_long_double + srcs_math += l_srcs_math +endif + foreach target : targets value = get_variable('target_' + target) set_variable('lib_math' + target, diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_acos.c libnewlib-nano-2.11.2/newlib/libm/math/w_acos.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_acos.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_acos.c 2018-11-14 22:26:13.000000000 +0000 @@ -70,6 +70,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifndef _DOUBLE_IS_32BITS #ifdef __STDC__ @@ -79,9 +80,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_acos(x); -#else double z; struct exception exc; z = __ieee754_acos(x); @@ -103,7 +101,7 @@ return exc.retval; } else return z; -#endif } #endif /* defined(_DOUBLE_IS_32BITS) */ +#endif /* defined(_IEEE_LIBM) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_acosh.c libnewlib-nano-2.11.2/newlib/libm/math/w_acosh.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_acosh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_acosh.c 2018-11-14 22:26:13.000000000 +0000 @@ -76,6 +76,8 @@ #include "fdlibm.h" #include + +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifndef _DOUBLE_IS_32BITS #ifdef __STDC__ @@ -85,9 +87,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_acosh(x); -#else double z; struct exception exc; z = __ieee754_acosh(x); @@ -109,7 +108,7 @@ return exc.retval; } else return z; -#endif } #endif /* defined(_DOUBLE_IS_32BITS) */ +#endif /* defined(_IEEE_LIBM) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_asin.c libnewlib-nano-2.11.2/newlib/libm/math/w_asin.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_asin.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_asin.c 2018-11-14 22:26:13.000000000 +0000 @@ -76,6 +76,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double asin(double x) /* wrapper asin */ #else @@ -83,9 +84,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_asin(x); -#else double z; struct exception exc; z = __ieee754_asin(x); @@ -107,7 +105,7 @@ return exc.retval; } else return z; -#endif } #endif /* defined(_DOUBLE_IS_32BITS) */ +#endif diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_atanh.c libnewlib-nano-2.11.2/newlib/libm/math/w_atanh.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_atanh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_atanh.c 2018-11-14 22:26:13.000000000 +0000 @@ -74,6 +74,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifndef _DOUBLE_IS_32BITS #ifdef __STDC__ @@ -83,9 +84,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_atanh(x); -#else double z,y; struct exception exc; z = __ieee754_atanh(x); @@ -122,11 +120,7 @@ return exc.retval; } else return z; -#endif } #endif /* defined(_DOUBLE_IS_32BITS) */ - - - - +#endif diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_cosh.c libnewlib-nano-2.11.2/newlib/libm/math/w_cosh.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_cosh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_cosh.c 2018-11-14 22:26:13.000000000 +0000 @@ -60,8 +60,9 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifndef _DOUBLE_IS_32BITS - + #ifdef __STDC__ double cosh(double x) /* wrapper cosh */ #else @@ -69,9 +70,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_cosh(x); -#else double z; struct exception exc; z = __ieee754_cosh(x); @@ -102,7 +100,7 @@ return exc.retval; } else return z; -#endif } #endif /* defined(_DOUBLE_IS_32BITS) */ +#endif diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_exp.c libnewlib-nano-2.11.2/newlib/libm/math/w_exp.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_exp.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_exp.c 2018-11-14 22:26:13.000000000 +0000 @@ -58,7 +58,7 @@ #ifndef _DOUBLE_IS_32BITS -#ifndef _IEEE_LIBM +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ static const double #else @@ -66,7 +66,6 @@ #endif o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */ u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */ -#endif #ifdef __STDC__ double exp(double x) /* wrapper exp */ @@ -75,9 +74,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_exp(x); -#else double z; struct exception exc; z = __ieee754_exp(x); @@ -125,8 +121,8 @@ } } return z; -#endif } #endif /* defined(_DOUBLE_IS_32BITS) */ +#endif #endif /* __OBSOLETE_MATH */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_acos.c libnewlib-nano-2.11.2/newlib/libm/math/wf_acos.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_acos.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_acos.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,11 +20,9 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) float acosf(float x) /* wrapper acosf */ { -#ifdef _IEEE_LIBM - return __ieee754_acosf(x); -#else float z; struct exception exc; z = __ieee754_acosf(x); @@ -46,8 +44,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_acosh.c libnewlib-nano-2.11.2/newlib/libm/math/wf_acosh.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_acosh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_acosh.c 2018-11-14 22:26:13.000000000 +0000 @@ -21,6 +21,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float acoshf(float x) /* wrapper acoshf */ #else @@ -28,9 +29,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_acoshf(x); -#else float z; struct exception exc; z = __ieee754_acoshf(x); @@ -52,8 +50,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_asin.c libnewlib-nano-2.11.2/newlib/libm/math/wf_asin.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_asin.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_asin.c 2018-11-14 22:26:13.000000000 +0000 @@ -22,6 +22,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float asinf(float x) /* wrapper asinf */ #else @@ -29,9 +30,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_asinf(x); -#else float z; struct exception exc; z = __ieee754_asinf(x); @@ -53,8 +51,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_atanh.c libnewlib-nano-2.11.2/newlib/libm/math/wf_atanh.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_atanh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_atanh.c 2018-11-14 22:26:13.000000000 +0000 @@ -19,6 +19,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float atanhf(float x) /* wrapper atanhf */ #else @@ -26,9 +27,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_atanhf(x); -#else float z,y; struct exception exc; z = __ieee754_atanhf(x); @@ -65,8 +63,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_cosh.c libnewlib-nano-2.11.2/newlib/libm/math/wf_cosh.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_cosh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_cosh.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float coshf(float x) /* wrapper coshf */ #else @@ -27,9 +28,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_coshf(x); -#else float z; struct exception exc; z = __ieee754_coshf(x); @@ -60,8 +58,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_exp.c libnewlib-nano-2.11.2/newlib/libm/math/wf_exp.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_exp.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_exp.c 2018-11-14 22:26:13.000000000 +0000 @@ -21,7 +21,7 @@ #if __OBSOLETE_MATH #include -#ifndef _IEEE_LIBM +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ static const float #else @@ -29,7 +29,6 @@ #endif o_threshold= 8.8721679688e+01, /* 0x42b17180 */ u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */ -#endif #ifdef __STDC__ float expf(float x) /* wrapper expf */ @@ -38,9 +37,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_expf(x); -#else float z; struct exception exc; z = __ieee754_expf(x); @@ -88,8 +84,8 @@ } } return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_fmod.c libnewlib-nano-2.11.2/newlib/libm/math/wf_fmod.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_fmod.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_fmod.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float fmodf(float x, float y) /* wrapper fmodf */ #else @@ -27,9 +28,6 @@ float x,y; #endif { -#ifdef _IEEE_LIBM - return __ieee754_fmodf(x,y); -#else float z; struct exception exc; z = __ieee754_fmodf(x,y); @@ -55,8 +53,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_gamma.c libnewlib-nano-2.11.2/newlib/libm/math/wf_gamma.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_gamma.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_gamma.c 2018-11-14 22:26:13.000000000 +0000 @@ -18,6 +18,7 @@ #include #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float gammaf(float x) #else @@ -25,9 +26,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_gammaf_r(x,&(_REENT_SIGNGAM(_REENT))); -#else float y; struct exception exc; y = __ieee754_gammaf_r(x,&(_REENT_SIGNGAM(_REENT))); @@ -75,8 +73,8 @@ return (float)exc.retval; } else return y; +} #endif -} #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_hypot.c libnewlib-nano-2.11.2/newlib/libm/math/wf_hypot.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_hypot.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_hypot.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float hypotf(float x, float y) /* wrapper hypotf */ #else @@ -27,9 +28,6 @@ float x,y; #endif { -#ifdef _IEEE_LIBM - return __ieee754_hypotf(x,y); -#else float z; struct exception exc; z = __ieee754_hypotf(x,y); @@ -61,8 +59,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_j0.c libnewlib-nano-2.11.2/newlib/libm/math/wf_j0.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_j0.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_j0.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float j0f(float x) /* wrapper j0f */ #else @@ -27,9 +28,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_j0f(x); -#else struct exception exc; float z = __ieee754_j0f(x); if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; @@ -50,9 +48,10 @@ return (float)exc.retval; } else return z; -#endif } +#endif +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float y0f(float x) /* wrapper y0f */ #else @@ -60,9 +59,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_y0f(x); -#else float z; struct exception exc; z = __ieee754_y0f(x); @@ -109,8 +105,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_j1.c libnewlib-nano-2.11.2/newlib/libm/math/wf_j1.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_j1.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_j1.c 2018-11-14 22:26:13.000000000 +0000 @@ -21,6 +21,7 @@ #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float j1f(float x) /* wrapper j1f */ #else @@ -28,9 +29,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_j1f(x); -#else float z; struct exception exc; z = __ieee754_j1f(x); @@ -52,9 +50,10 @@ return exc.retval; } else return z; -#endif } +#endif +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float y1f(float x) /* wrapper y1f */ #else @@ -62,9 +61,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_y1f(x); -#else float z; struct exception exc; z = __ieee754_y1f(x); @@ -111,8 +107,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_jn.c libnewlib-nano-2.11.2/newlib/libm/math/wf_jn.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_jn.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_jn.c 2018-11-14 22:26:13.000000000 +0000 @@ -17,6 +17,7 @@ #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float jnf(int n, float x) /* wrapper jnf */ #else @@ -24,9 +25,6 @@ float x; int n; #endif { -#ifdef _IEEE_LIBM - return __ieee754_jnf(n,x); -#else float z; struct exception exc; z = __ieee754_jnf(n,x); @@ -49,9 +47,10 @@ return exc.retval; } else return z; -#endif } +#endif +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float ynf(int n, float x) /* wrapper ynf */ #else @@ -59,9 +58,6 @@ float x; int n; #endif { -#ifdef _IEEE_LIBM - return __ieee754_ynf(n,x); -#else float z; struct exception exc; z = __ieee754_ynf(n,x); @@ -110,8 +106,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_lgamma.c libnewlib-nano-2.11.2/newlib/libm/math/wf_lgamma.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_lgamma.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_lgamma.c 2018-11-14 22:26:13.000000000 +0000 @@ -18,6 +18,7 @@ #include #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float lgammaf(float x) #else @@ -25,9 +26,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_lgammaf_r(x,&(_REENT_SIGNGAM(_REENT))); -#else float y; struct exception exc; y = __ieee754_lgammaf_r(x,&(_REENT_SIGNGAM(_REENT))); @@ -69,8 +67,8 @@ return (float)exc.retval; } else return y; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_log10.c libnewlib-nano-2.11.2/newlib/libm/math/wf_log10.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_log10.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_log10.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float log10f(float x) /* wrapper log10f */ #else @@ -27,9 +28,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_log10f(x); -#else float z; struct exception exc; z = __ieee754_log10f(x); @@ -71,8 +69,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_log.c libnewlib-nano-2.11.2/newlib/libm/math/wf_log.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_log.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_log.c 2018-11-14 22:26:13.000000000 +0000 @@ -21,6 +21,7 @@ #if __OBSOLETE_MATH #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float logf(float x) /* wrapper logf */ #else @@ -28,9 +29,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_logf(x); -#else float z; struct exception exc; z = __ieee754_logf(x); @@ -69,8 +67,8 @@ if (exc.err != 0) errno = exc.err; return (float)exc.retval; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_fmod.c libnewlib-nano-2.11.2/newlib/libm/math/w_fmod.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_fmod.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_fmod.c 2018-11-14 22:26:13.000000000 +0000 @@ -58,6 +58,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double fmod(double x, double y) /* wrapper fmod */ #else @@ -65,9 +66,6 @@ double x,y; #endif { -#ifdef _IEEE_LIBM - return __ieee754_fmod(x,y); -#else double z; struct exception exc; z = __ieee754_fmod(x,y); @@ -93,7 +91,7 @@ return exc.retval; } else return z; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_pow.c libnewlib-nano-2.11.2/newlib/libm/math/wf_pow.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_pow.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_pow.c 2018-11-14 22:26:13.000000000 +0000 @@ -21,6 +21,7 @@ #if __OBSOLETE_MATH #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float powf(float x, float y) /* wrapper powf */ #else @@ -28,9 +29,6 @@ float x,y; #endif { -#ifdef _IEEE_LIBM - return __ieee754_powf(x,y); -#else float z; struct exception exc; z=__ieee754_powf(x,y); @@ -164,8 +162,8 @@ return (float)exc.retval; } return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_remainder.c libnewlib-nano-2.11.2/newlib/libm/math/wf_remainder.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_remainder.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_remainder.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float remainderf(float x, float y) /* wrapper remainder */ #else @@ -27,9 +28,6 @@ float x,y; #endif { -#ifdef _IEEE_LIBM - return __ieee754_remainderf(x,y); -#else float z; struct exception exc; z = __ieee754_remainderf(x,y); @@ -52,8 +50,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_scalb.c libnewlib-nano-2.11.2/newlib/libm/math/wf_scalb.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_scalb.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_scalb.c 2018-11-14 22:26:13.000000000 +0000 @@ -22,6 +22,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ #ifdef _SCALB_INT float scalbf(float x, int fn) /* wrapper scalbf */ @@ -37,9 +38,6 @@ #endif #endif { -#ifdef _IEEE_LIBM - return __ieee754_scalbf(x,fn); -#else float z; #ifndef HUGE_VAL #define HUGE_VAL inf @@ -88,8 +86,8 @@ if(!finitef(fn)) errno = ERANGE; #endif return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_sinh.c libnewlib-nano-2.11.2/newlib/libm/math/wf_sinh.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_sinh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_sinh.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float sinhf(float x) /* wrapper sinhf */ #else @@ -27,9 +28,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_sinhf(x); -#else float z; struct exception exc; z = __ieee754_sinhf(x); @@ -60,8 +58,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wf_sqrt.c libnewlib-nano-2.11.2/newlib/libm/math/wf_sqrt.c --- libnewlib-nano-2.10.0/newlib/libm/math/wf_sqrt.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wf_sqrt.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float sqrtf(float x) /* wrapper sqrtf */ #else @@ -27,9 +28,6 @@ float x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_sqrtf(x); -#else float z; struct exception exc; z = __ieee754_sqrtf(x); @@ -54,8 +52,8 @@ return (float)exc.retval; } else return z; -#endif } +#endif #ifdef _DOUBLE_IS_32BITS diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_hypot.c libnewlib-nano-2.11.2/newlib/libm/math/w_hypot.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_hypot.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_hypot.c 2018-11-14 22:26:13.000000000 +0000 @@ -55,6 +55,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double hypot(double x, double y)/* wrapper hypot */ #else @@ -62,9 +63,6 @@ double x,y; #endif { -#ifdef _IEEE_LIBM - return __ieee754_hypot(x,y); -#else double z; struct exception exc; z = __ieee754_hypot(x,y); @@ -96,7 +94,7 @@ return exc.retval; } else return z; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_j0.c libnewlib-nano-2.11.2/newlib/libm/math/w_j0.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_j0.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_j0.c 2018-11-14 22:26:13.000000000 +0000 @@ -94,6 +94,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double j0(double x) /* wrapper j0 */ #else @@ -101,9 +102,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_j0(x); -#else struct exception exc; double z = __ieee754_j0(x); if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; @@ -124,9 +122,10 @@ return exc.retval; } else return z; -#endif } +#endif +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double y0(double x) /* wrapper y0 */ #else @@ -134,9 +133,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_y0(x); -#else double z; struct exception exc; z = __ieee754_y0(x); @@ -183,8 +179,8 @@ return exc.retval; } else return z; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_j1.c libnewlib-nano-2.11.2/newlib/libm/math/w_j1.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_j1.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_j1.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double j1(double x) /* wrapper j1 */ #else @@ -27,9 +28,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_j1(x); -#else double z; struct exception exc; z = __ieee754_j1(x); @@ -51,9 +49,10 @@ return exc.retval; } else return z; -#endif } +#endif +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double y1(double x) /* wrapper y1 */ #else @@ -61,9 +60,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_y1(x); -#else double z; struct exception exc; z = __ieee754_y1(x); @@ -110,8 +106,8 @@ return exc.retval; } else return z; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_jn.c libnewlib-nano-2.11.2/newlib/libm/math/w_jn.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_jn.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_jn.c 2018-11-14 22:26:13.000000000 +0000 @@ -42,6 +42,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double jn(int n, double x) /* wrapper jn */ #else @@ -49,9 +50,6 @@ double x; int n; #endif { -#ifdef _IEEE_LIBM - return __ieee754_jn(n,x); -#else double z; struct exception exc; z = __ieee754_jn(n,x); @@ -74,9 +72,10 @@ return exc.retval; } else return z; -#endif } +#endif +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double yn(int n, double x) /* wrapper yn */ #else @@ -84,9 +83,6 @@ double x; int n; #endif { -#ifdef _IEEE_LIBM - return __ieee754_yn(n,x); -#else double z; struct exception exc; z = __ieee754_yn(n,x); @@ -135,7 +131,7 @@ return exc.retval; } else return z; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_log10.c libnewlib-nano-2.11.2/newlib/libm/math/w_log10.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_log10.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_log10.c 2018-11-14 22:26:13.000000000 +0000 @@ -50,6 +50,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double log10(double x) /* wrapper log10 */ #else @@ -57,9 +58,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_log10(x); -#else double z; struct exception exc; z = __ieee754_log10(x); @@ -102,7 +100,7 @@ return exc.retval; } else return z; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_log.c libnewlib-nano-2.11.2/newlib/libm/math/w_log.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_log.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_log.c 2018-11-14 22:26:13.000000000 +0000 @@ -54,6 +54,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double log(double x) /* wrapper log */ #else @@ -61,9 +62,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_log(x); -#else double z; struct exception exc; z = __ieee754_log(x); @@ -103,8 +101,8 @@ if (exc.err != 0) errno = exc.err; return exc.retval; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ #endif /* __OBSOLETE_MATH */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_pow.c libnewlib-nano-2.11.2/newlib/libm/math/w_pow.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_pow.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_pow.c 2018-11-14 22:26:13.000000000 +0000 @@ -57,6 +57,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double pow(double x, double y) /* wrapper pow */ #else @@ -64,9 +65,6 @@ double x,y; #endif { -#ifdef _IEEE_LIBM - return __ieee754_pow(x,y); -#else double z; #ifndef HUGE_VAL #define HUGE_VAL inf @@ -204,8 +202,8 @@ return exc.retval; } return z; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ #endif /* __OBSOLETE_MATH */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_remainder.c libnewlib-nano-2.11.2/newlib/libm/math/w_remainder.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_remainder.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_remainder.c 2018-11-14 22:26:13.000000000 +0000 @@ -46,6 +46,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double remainder(double x, double y) /* wrapper remainder */ #else @@ -53,9 +54,6 @@ double x,y; #endif { -#ifdef _IEEE_LIBM - return __ieee754_remainder(x,y); -#else double z; struct exception exc; z = __ieee754_remainder(x,y); @@ -78,8 +76,8 @@ return exc.retval; } else return z; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wrf_gamma.c libnewlib-nano-2.11.2/newlib/libm/math/wrf_gamma.c --- libnewlib-nano-2.10.0/newlib/libm/math/wrf_gamma.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wrf_gamma.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float gammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */ #else @@ -27,9 +28,6 @@ float x; int *signgamp; #endif { -#ifdef _IEEE_LIBM - return __ieee754_gammaf_r(x,signgamp); -#else float y; struct exception exc; y = __ieee754_gammaf_r(x,signgamp); @@ -70,5 +68,5 @@ return (float)exc.retval; } else return y; -#endif } +#endif diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wrf_lgamma.c libnewlib-nano-2.11.2/newlib/libm/math/wrf_lgamma.c --- libnewlib-nano-2.10.0/newlib/libm/math/wrf_lgamma.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wrf_lgamma.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ float lgammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */ #else @@ -27,9 +28,6 @@ float x; int *signgamp; #endif { -#ifdef _IEEE_LIBM - return __ieee754_lgammaf_r(x,signgamp); -#else float y; struct exception exc; y = __ieee754_lgammaf_r(x,signgamp); @@ -71,5 +69,5 @@ return (float)exc.retval; } else return y; -#endif } +#endif diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wr_gamma.c libnewlib-nano-2.11.2/newlib/libm/math/wr_gamma.c --- libnewlib-nano-2.10.0/newlib/libm/math/wr_gamma.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wr_gamma.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double gamma_r(double x, int *signgamp) /* wrapper lgamma_r */ #else @@ -27,9 +28,6 @@ double x; int *signgamp; #endif { -#ifdef _IEEE_LIBM - return __ieee754_gamma_r(x,signgamp); -#else double y; struct exception exc; y = __ieee754_gamma_r(x,signgamp); @@ -70,7 +68,7 @@ return exc.retval; } else return y; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/wr_lgamma.c libnewlib-nano-2.11.2/newlib/libm/math/wr_lgamma.c --- libnewlib-nano-2.10.0/newlib/libm/math/wr_lgamma.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/wr_lgamma.c 2018-11-14 22:26:13.000000000 +0000 @@ -20,6 +20,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */ #else @@ -27,9 +28,6 @@ double x; int *signgamp; #endif { -#ifdef _IEEE_LIBM - return __ieee754_lgamma_r(x,signgamp); -#else double y; struct exception exc; y = __ieee754_lgamma_r(x,signgamp); @@ -71,7 +69,7 @@ return exc.retval; } else return y; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_scalb.c libnewlib-nano-2.11.2/newlib/libm/math/w_scalb.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_scalb.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_scalb.c 2018-11-14 22:26:13.000000000 +0000 @@ -22,6 +22,8 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) + #ifdef __STDC__ #ifdef _SCALB_INT double scalb(double x, int fn) /* wrapper scalb */ @@ -37,9 +39,6 @@ #endif #endif { -#ifdef _IEEE_LIBM - return __ieee754_scalb(x,fn); -#else double z; #ifndef HUGE_VAL #define HUGE_VAL inf @@ -88,7 +87,7 @@ if(!finite(fn)) errno = ERANGE; #endif return z; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_sinh.c libnewlib-nano-2.11.2/newlib/libm/math/w_sinh.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_sinh.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_sinh.c 2018-11-14 22:26:13.000000000 +0000 @@ -66,6 +66,7 @@ #ifndef _DOUBLE_IS_32BITS +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifdef __STDC__ double sinh(double x) /* wrapper sinh */ #else @@ -73,9 +74,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_sinh(x); -#else double z; struct exception exc; z = __ieee754_sinh(x); @@ -106,7 +104,7 @@ return exc.retval; } else return z; -#endif } +#endif #endif /* defined(_DOUBLE_IS_32BITS) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/math/w_sqrt.c libnewlib-nano-2.11.2/newlib/libm/math/w_sqrt.c --- libnewlib-nano-2.10.0/newlib/libm/math/w_sqrt.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/math/w_sqrt.c 2018-11-14 22:26:13.000000000 +0000 @@ -47,6 +47,7 @@ #include "fdlibm.h" #include +#if !defined(_IEEE_LIBM) || !defined(HAVE_ALIAS_ATTRIBUTE) #ifndef _DOUBLE_IS_32BITS #ifdef __STDC__ @@ -56,9 +57,6 @@ double x; #endif { -#ifdef _IEEE_LIBM - return __ieee754_sqrt(x); -#else struct exception exc; double z; z = __ieee754_sqrt(x); @@ -82,7 +80,7 @@ return exc.retval; } else return z; -#endif } #endif /* defined(_DOUBLE_IS_32BITS) */ +#endif /* defined(_IEEE_LIBM) */ diff -Nru libnewlib-nano-2.10.0/newlib/libm/meson.build libnewlib-nano-2.11.2/newlib/libm/meson.build --- libnewlib-nano-2.10.0/newlib/libm/meson.build 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/newlib/libm/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -1,3 +1,15 @@ +libm_machine_dirs = { + 'aarch64' : 'aarch64', + 'arm' : 'arm', + 'i386' : 'i386', + 'i486' : 'i386', + 'i586' : 'i386', + 'i686' : 'i386', + 'nds32' : 'nds32', + 'riscv' : 'riscv', + 'spu' : 'spu', + } + libdirs = ['common', 'complex'] if hw_fp libdirs += 'mathfp' @@ -5,6 +17,15 @@ libdirs += 'math' endif +libnames = libdirs + +if libm_machine_dirs.has_key(host_cpu) + libdirs = [join_paths('machine', libm_machine_dirs[host_cpu])] + libdirs + libnames = ['machine'] + libnames +else + warning('No libm machine directory for cpu ' + host_cpu) +endif + foreach libdir : libdirs subdir(libdir) endforeach @@ -13,14 +34,12 @@ value = get_variable('target_' + target) libobjs = [] - foreach libdir : libdirs - libobjs += get_variable('lib_' + libdir + target).extract_all_objects(recursive:true) + foreach libname : libnames + libobjs += get_variable('lib_' + libname + target).extract_all_objects(recursive:true) endforeach instdir = join_paths(get_option('libdir'), value[0]) - message(instdir) - if target == '' libm_name = 'm' else diff -Nru libnewlib-nano-2.10.0/README.md libnewlib-nano-2.11.2/README.md --- libnewlib-nano-2.10.0/README.md 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/README.md 2018-11-14 22:26:13.000000000 +0000 @@ -1,6 +1,202 @@ # Newlib-nano -Copyright ©🄯 2018 Keith Packard +Copyright © 2018 Keith Packard 🄯 This is a fork of newlib which integrates the stdio code from gcc-avr to make it much smaller for tiny embedded systems. There's debian packaging which builds for arm-none-eabi targets. + +### Selecting newlib options + +I've tried to expose all of the same code selection options that are +provided in the autotools. Use -D={true,false} to change +from the default value. + +| Option | Default | Description | +| ------ | ------- | ----------- | +| target-optspace | false | Compile with -Os | +| hw-fp | false | Turn on hardware floating point math | +| tests | false | Enable tests | +| newlib-tinystdio | false | Use tiny stdio from avr libc | +| newlib-io-pos-args | false | Enable printf-family positional arg support | +| newlib-io-c99-formats | false | Enable C99 support in IO functions like printf/scanf | +| newlib-register-fini | false | Enable finalization function registration using atexit | +| newlib-io-long-long | false | Enable long long type support in IO functions like printf/scanf | +| newlib-io-long-double | false | Enable long double type support in IO functions printf/scanf | +| newlib-mb | false | Enable multibyte support | +| newlib-iconv-encodings | false | Enable specific comma-separated list of bidirectional iconv encodings to be built-in | +| newlib-iconv-from-encodings | false | Enable specific comma-separated list of "from" iconv encodings to be built-in | +| newlib-iconv-to-encodings | false | Enable specific comma-separated list of "to" iconv encodings to be built-in | +| newlib-iconv-external-ccs | false | Enable capabilities to load external CCS files for iconv | +| newlib-atexit-dynamic-alloc | false | Enable dynamic allocation of atexit entries | +| newlib-global-atexit | false | Enable atexit data structure as global | +| newlib-reent-small | false | Enable small reentrant struct support | +| newlib-global-stdio-streams | false | Enable global stdio streams | +| newlib-fvwrite-in-streamio | false | Disable iov in streamio | +| newlib-fseek-optimization | false | Disable fseek optimization | +| newlib_wide_orient | false | Turn off wide orientation in streamio | +| newlib-nano-malloc | false | Use small-footprint nano-malloc implementation | +| newlib-unbuf-stream-opt | false | Enable unbuffered stream optimization in streamio | +| lite-exit | false | Enable light weight exit | +| newlib_nano_formatted_io | false | Use nano version formatted IO | +| newlib-retargetable-locking | false | Allow locking routines to be retargeted at link time | +| newlib-long-time_t | false | Define time_t to long | +| newlib-multithread | false | Enable support for multiple threads | +| newlib-iconv | false | Enable iconv library support | +| newlib-io-float | false | Enable printf/scanf family float support | +| newlib-supplied-syscalls | false | Enable newlib supplied syscalls | + +## Building for embedded arm systems + +Unlike autotools, which has you specify all of the cross-compilation +bits on the command line, meson sticks them in a separate +configuration file. There are a bunch of things you need to set, which +the build system really shouldn't care about. In any case, you can +find the cross-compilation details for the arm-none-eabi toolchain in +the cross-arm-none-eabi.txt file: + + [binaries] + c = 'arm-none-eabi-gcc' + ar = 'arm-none-eabi-ar' + as = 'arm-none-eabi-as' + + [host_machine] + system = '' + cpu_family = '' + cpu = '' + endian = '' + +If those programs aren't in your path, you can edit the file to point +wherever they may be. + +### Auto-detecting the compiler configurations + +The key trick here is that the meson configuration, just like the +autotools configuration it replaces, figures out all of the target CPU +architectures supported by the compiler by doing: + + $ arm-none-eabi-gcc --print-multi-lib + .; + thumb;@mthumb + hard;@mfloat-abi=hard + thumb/v6-m;@mthumb@march=armv6s-m + thumb/v7-m;@mthumb@march=armv7-m + thumb/v7e-m;@mthumb@march=armv7e-m + thumb/v7-ar;@mthumb@march=armv7 + thumb/v8-m.base;@mthumb@march=armv8-m.base + thumb/v8-m.main;@mthumb@march=armv8-m.main + thumb/v7e-m/fpv4-sp/softfp;@mthumb@march=armv7e-m@mfpu=fpv4-sp-d16@mfloat-abi=softfp + thumb/v7e-m/fpv4-sp/hard;@mthumb@march=armv7e-m@mfpu=fpv4-sp-d16@mfloat-abi=hard + thumb/v7e-m/fpv5/softfp;@mthumb@march=armv7e-m@mfpu=fpv5-d16@mfloat-abi=softfp + thumb/v7e-m/fpv5/hard;@mthumb@march=armv7e-m@mfpu=fpv5-d16@mfloat-abi=hard + thumb/v7-ar/fpv3/softfp;@mthumb@march=armv7@mfpu=vfpv3-d16@mfloat-abi=softfp + thumb/v7-ar/fpv3/hard;@mthumb@march=armv7@mfpu=vfpv3-d16@mfloat-abi=hard + thumb/v7-ar/fpv3/hard/be;@mthumb@march=armv7@mfpu=vfpv3-d16@mfloat-abi=hard@mbig-endian + thumb/v8-m.main/fpv5-sp/softfp;@mthumb@march=armv8-m.main@mfpu=fpv5-sp-d16@mfloat-abi=softfp + thumb/v8-m.main/fpv5-sp/hard;@mthumb@march=armv8-m.main@mfpu=fpv5-sp-d16@mfloat-abi=hard + thumb/v8-m.main/fpv5/softfp;@mthumb@march=armv8-m.main@mfpu=fpv5-d16@mfloat-abi=softfp + thumb/v8-m.main/fpv5/hard;@mthumb@march=armv8-m.main@mfpu=fpv5-d16@mfloat-abi=hard + +Yes, we're going to compile all of the code 20 times with the +specified compiler options (replace the '@'s with '-' to see what they +will be). + +### Running meson + +Because I'm targeting smaller systems like the STM32F042 Cortex-M0 +parts with 4kB of RAM and 32kB of flash, I enable all of the 'make it +smaller' options. This example is in the do-arm-configure file: + + #!/bin/sh + ARCH=arm-none-eabi + DIR=`dirname $0` + meson $DIR \ + -Dtarget-optspace=true \ + -Dnewlib-tinystdio=true \ + -Dnewlib-supplied-syscalls=false \ + -Dnewlib-reentrant-small=true\ + -Dnewlib-wide-orient=false\ + -Dnewlib-nano-malloc=true\ + -Dlite-exit=true\ + -Dnewlib-global-atexit=true\ + -Dincludedir=lib/newlib-nano/$ARCH/include \ + -Dlibdir=lib/newlib-nano/$ARCH/lib \ + --cross-file $DIR/cross-$ARCH.txt \ + --buildtype plain + +Note the use of '--buildtype plain'. This stops meson from adding +compilation options so that the '-Dtarget-optspace=true' option can +select '-Os'. + +This script is designed to be run from a build directory, so you'd do: + + $ mkdir build-arm-none-eabi + $ cd build-arm-none-eabi + $ ../do-arm-configure + +### Compiling + +Once configured, you can compile the libraries with + + $ ninja + ... + $ ninja install + ... + $ + +### Using the library + +Eventually, we could go configure the compiler so that selecting a +suitable target architecture combination would set up the library +paths to match, but for now you'll have to figure out the right -L +line by yourself by matching the path name on the left side of the +--print-multi-lib output with the compiler options on the right +side. For instance, my STM32F042 cortex-M0 parts use + + $ arm-none-eabi-gcc -mlittle-endian -mcpu=cortex-m0 -mthumb + +To gcc, '-mcpu=cortex=m0' is the same as '-march=armv6s-m', so looking +at the output above, the libraries we want are in + + /usr/local/lib/newlib-nano/arm-none-eabi/lib/thumb/v6-m + +so, to link, we need to use: + + $ arm-none-eabi-gcc ... -L/usr/local/lib/newlib-nano/arm-none-eabi/lib/thumb/v6-m -lm -lc -lgcc + +## Building for the local processor + +If you want to compile the library for your local processor to test +changes in the library, the meson configuration is happy to do that +for you. You won't need a meson cross compilation configuration file, +so all you need is the right compile options. They're mostly the same +as the embedded version, but you don't want the multi-architecture +stuff and I prefer plain debug to an -Os, as that makes debugging the +library easier. + +The do-native-configure script has an example: + + #!/bin/sh + DIR=`dirname $0` + meson $DIR \ + -Dmultilib=false \ + -Dnewlib-tinystdio=true \ + -Dnewlib-supplied-syscalls=false \ + -Dnewlib-wide-orient=false\ + -Dnewlib-nano-malloc=true\ + -Dlite-exit=true\ + -Dnewlib-global-atexit=true\ + -Dincludedir=lib/newlib-nano/include \ + -Dlibdir=lib/newlib-nano/lib \ + -Dtests=true \ + --buildtype debug + +Again, create a directory and build there: + + $ mkdir build-native + $ cd build-native + $ ../do-native-configure + $ ninja + +This will also build a test case for printf and scanf in the +'test' directory, which I used to fix up the floating point input and +output code. diff -Nru libnewlib-nano-2.10.0/test/meson.build libnewlib-nano-2.11.2/test/meson.build --- libnewlib-nano-2.10.0/test/meson.build 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/test/meson.build 2018-11-14 22:26:13.000000000 +0000 @@ -1,5 +1,9 @@ -if newlib_tinystdio - executable('printf_scanf', 'printf_scanf.c', - link_with: [lib_m, lib_c], - include_directories: inc) -endif +test('Round-trip printf/scanf test', + executable('printf_scanf', 'printf_scanf.c', + link_with: [lib_m, lib_c], + include_directories: inc)) + +test('Bart Massey printf test', + executable('printf-tests', 'printf-tests.c', + link_with: [lib_m, lib_c], + include_directories: inc)) diff -Nru libnewlib-nano-2.10.0/test/printf_scanf.c libnewlib-nano-2.11.2/test/printf_scanf.c --- libnewlib-nano-2.10.0/test/printf_scanf.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/test/printf_scanf.c 2018-11-14 22:26:13.000000000 +0000 @@ -2,7 +2,10 @@ #include #include #include +#include +#include +#ifdef TINY_STDIO /* Buffered output routines for newlib-nano stdio */ static char write_buf[512]; @@ -63,9 +66,13 @@ FILE *const __iob[3] = { &__stdio, &__stdio, &__stdio }; -/* Make sure the desired floating point conversion functions are linked in */ -void *x = vfprintf; -void *y = vfscanf; +#else +int fstat(int fd, struct stat *statb) { errno = ENOTTY; return -1; } +#endif + +extern double strtod(char *, char **); + +static const double test_vals[] = { 1.234567, 1.1, M_PI }; int main(int argc, char **argv) @@ -73,7 +80,28 @@ int x = -35; char buf[256]; int errors = 0; +#if 0 + double a; + printf ("hello world\n"); + for (x = 1; x < 20; x++) { + printf("%.*f\n", x, 9.99999999999); + } + + for (a = 1e-10; a < 1e10; a *= 10.0) { + printf("g format: %10.3g %10.3g\n", 1.2345678 * a, 1.1 * a); + fflush(stdout); + } + for (a = 1e-10; a < 1e10; a *= 10.0) { + printf("f format: %10.3f %10.3f\n", 1.2345678 * a, 1.1 * a); + fflush(stdout); + } + for (a = 1e-10; a < 1e10; a *= 10.0) { + printf("e format: %10.3e %10.3e\n", 1.2345678 * a, 1.1 * a); + fflush(stdout); + } + printf ("%g\n", exp(11)); +#endif for (x = 0; x < 32; x++) { uint32_t v = 0x12345678ul >> x; uint32_t r; @@ -101,30 +129,46 @@ } } - for (x = -37; x <= 37; x = x + 1) + for (x = -37; x <= 37; x++) { - float v = 1.23456f * powf(10.0f, (float) x); - float r; - float e; - - sprintf(buf, "%.45f", v); - sscanf(buf, "%f", &r); - e = fabsf(v-r) / v; - if (e > 1e-6) { - printf("\t%3d: wanted %.7e got %.7e (error %.7e\n", x, v, r, e); - errors++; - fflush(stdout); - } + int t; + for (t = 0; t < sizeof(test_vals)/sizeof(test_vals[0]); t++) { + double v = test_vals[t] * pow(10.0, (double) x); + double r; + double e; + + sprintf(buf, "%.45f", v); + sscanf(buf, "%lf", &r); + e = fabs(v-r) / v; + if (e > 1e-6) { + printf("\t%3d: wanted %.7e got %.7e (error %.7e\n", x, v, r, e); + errors++; + fflush(stdout); + } - sprintf(buf, "%.7e", v); - sscanf(buf, "%f", &r); - e = fabsf(v-r) / v; - if (e > 1e-6) { - printf("\t%3d: wanted %.7e got %.7e (error %.7e, buf %s)\n", x, v, r, e, buf); - errors++; - fflush(stdout); + + sprintf(buf, "%.14e", v); + sscanf(buf, "%lf", &r); + e = fabs(v-r) / v; + if (e > 1e-6) { + printf("\t%3d: wanted %.7e got %.7e (error %.7e, buf %s)\n", x, v, r, e, buf); + errors++; + fflush(stdout); + } + + + sprintf(buf, "%.7g", v); + sscanf(buf, "%lf", &r); + e = fabs(v-r) / v; + if (e > 1e-6) { + printf("\t%3d: wanted %.7e got %.7e (error %.7e, buf %s)\n", x, v, r, e, buf); + errors++; + fflush(stdout); + } } } + if (!errors) + printf("success\n"); fflush(stdout); return errors; } diff -Nru libnewlib-nano-2.10.0/test/printf-tests.c libnewlib-nano-2.11.2/test/printf-tests.c --- libnewlib-nano-2.10.0/test/printf-tests.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/test/printf-tests.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,49 @@ +/* Copyright © 2013 Bart Massey */ +/* This program is licensed under the GPL version 2 or later. + Please see the file COPYING in this distribution for + license terms. */ + +#include +#include +#include + +#include "stdio-bits.c" + +static char buf[1024]; + +static void failmsg(int serial, char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + printf("test %d failed: ", serial); + vprintf(fmt, ap); + printf("\n"); + va_end(ap); +} + +static int test(int serial, char *expect, char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + int n = vsnprintf(buf, 1024, fmt, ap); + va_end(ap); + if (n >= 1024) { + failmsg(serial, "buffer overflow"); + return 1; + } + if (n != strlen(expect)) { + failmsg(serial, "expected \"%s\" (%d), got \"%s\" (%d)", + expect, strlen(expect), buf, n); + return 1; + } + if (strcmp(buf, expect)) { + failmsg(serial, "expected \"%s\", got \"%s\"", expect, buf); + return 1; + } + return 0; +} + +int main() { + int result = 0; +#include "testcases.c" + fflush(stdout); + return result; +} diff -Nru libnewlib-nano-2.10.0/test/stdio-bits.c libnewlib-nano-2.11.2/test/stdio-bits.c --- libnewlib-nano-2.10.0/test/stdio-bits.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/test/stdio-bits.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,71 @@ +#include +#include +#include +#include +#include +#include + +#ifdef TINY_STDIO +/* Buffered output routines for newlib-nano stdio */ + +static char write_buf[512]; +static int write_len; + +static int +ao_flush(FILE *ignore) +{ + if (write_len) { + int off = 0; + while (write_len) { + int this = write(1, write_buf + off, write_len); + if (this < 0) { + write_len = 0; + return -1; + } + off += this; + write_len -= this; + } + } + return 0; +} + +static int +ao_putc(char c, FILE *ignore) +{ + write_buf[write_len++] = c; + if (write_len < sizeof (write_buf)) + return 0; + return ao_flush(ignore); +} + +static char read_buf[512]; +static int read_len; +static int read_off; + +static int +ao_getc(FILE *ignore) +{ + if (read_off >= read_len) { + (void) ao_flush(ignore); + read_off = 0; + read_len = read(0, read_buf, sizeof (read_buf)); + if (read_len <= 0) { + read_len = 0; + return -1; + } + } + return (unsigned char) read_buf[read_off++]; +} + +static FILE __stdio = { + .flags = __SRD|__SWR, + .put = ao_putc, + .get = ao_getc, + .flush = ao_flush, +}; + +FILE *const __iob[3] = { &__stdio, &__stdio, &__stdio }; + +#else +int fstat(int fd, struct stat *statb) { errno = ENOTTY; return -1; } +#endif diff -Nru libnewlib-nano-2.10.0/test/testcases.c libnewlib-nano-2.11.2/test/testcases.c --- libnewlib-nano-2.10.0/test/testcases.c 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/test/testcases.c 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,411 @@ +/* + * This file was generated from printf-tests.txt included + * as a part of the printf test suite developed by + * Bart Massey: + * + * https://github.com/BartMassey/printf-tests + * + * printf-tests.txt carries the following Copyright, which + * probably extends to this file as well given the transformations + * are fairly mechanical: + * +# Various printf tests compiled from various sources +# Copyright © 2013 Bart Massey +# This program is licensed under the GPL version 2 or later. +# Please see the file COPYING in this distribution for +# license terms. + +*/ + +/* XXX This code generated automatically by gen-testcases.hs + from ../../printf-tests.txt . You probably do not want to + manually edit this file. */ + result |= test(1, "0.33", "%.*f", 2, 0.33333333); + result |= test(2, "foo", "%.3s", "foobar"); + result |= test(3, " 00004", "%10.5d", 4); + result |= test(4, " 42", "% d", 42); + result |= test(5, "-42", "% d", -42); + result |= test(6, " 42", "% 5d", 42); + result |= test(7, " -42", "% 5d", -42); + result |= test(8, " 42", "% 15d", 42); + result |= test(9, " -42", "% 15d", -42); + result |= test(10, "+42", "%+d", 42); + result |= test(11, "-42", "%+d", -42); + result |= test(12, " +42", "%+5d", 42); + result |= test(13, " -42", "%+5d", -42); + result |= test(14, " +42", "%+15d", 42); + result |= test(15, " -42", "%+15d", -42); + result |= test(16, "42", "%0d", 42); + result |= test(17, "-42", "%0d", -42); + result |= test(18, "00042", "%05d", 42); + result |= test(19, "-0042", "%05d", -42); + result |= test(20, "000000000000042", "%015d", 42); + result |= test(21, "-00000000000042", "%015d", -42); + result |= test(22, "42", "%-d", 42); + result |= test(23, "-42", "%-d", -42); + result |= test(24, "42 ", "%-5d", 42); + result |= test(25, "-42 ", "%-5d", -42); + result |= test(26, "42 ", "%-15d", 42); + result |= test(27, "-42 ", "%-15d", -42); + result |= test(28, "42", "%-0d", 42); + result |= test(29, "-42", "%-0d", -42); + result |= test(30, "42 ", "%-05d", 42); + result |= test(31, "-42 ", "%-05d", -42); + result |= test(32, "42 ", "%-015d", 42); + result |= test(33, "-42 ", "%-015d", -42); + result |= test(34, "42", "%0-d", 42); + result |= test(35, "-42", "%0-d", -42); + result |= test(36, "42 ", "%0-5d", 42); + result |= test(37, "-42 ", "%0-5d", -42); + result |= test(38, "42 ", "%0-15d", 42); + result |= test(39, "-42 ", "%0-15d", -42); + result |= test(43, "42.90", "%.2f", 42.8952); + result |= test(44, "42.90", "%.2F", 42.8952); + result |= test(45, "42.8952000000", "%.10f", 42.8952); + result |= test(46, "42.90", "%1.2f", 42.8952); + result |= test(47, " 42.90", "%6.2f", 42.8952); + result |= test(49, "+42.90", "%+6.2f", 42.8952); + result |= test(50, "42.8952000000", "%5.10f", 42.8952); + /* 51: anti-test */ + /* 52: anti-test */ + /* 53: excluded for C */ +// result |= test(55, "Hot Pocket", "%1$s %2$s", "Hot", "Pocket"); +// result |= test(56, "12.0 Hot Pockets", "%1$.1f %2$s %3$ss", 12.0, "Hot", "Pocket"); + /* 58: anti-test */ + result |= test(59, "%(foo", "%(foo"); + result |= test(60, " foo", "%*s", 4, "foo"); + result |= test(61, " 3.14", "%*.*f", 10, 2, 3.14159265); + result |= test(63, "3.14 ", "%-*.*f", 10, 2, 3.14159265); + /* 64: anti-test */ + /* 65: anti-test */ + result |= test(66, "+hello+", "+%s+", "hello"); + result |= test(67, "+10+", "+%d+", 10); + result |= test(68, "a", "%c", 'a'); + result |= test(69, " ", "%c", 32); + result |= test(70, "$", "%c", 36); + result |= test(71, "10", "%d", 10); + /* 72: anti-test */ + /* 73: anti-test */ + /* 74: excluded for C */ + /* 75: excluded for C */ + result |= test(76, "+7.894561230000000e+08", "%+#22.15e", 7.89456123e8); + result |= test(77, "7.894561230000000e+08 ", "%-#22.15e", 7.89456123e8); + result |= test(78, " 7.894561230000000e+08", "%#22.15e", 7.89456123e8); + result |= test(79, "8.e+08", "%#1.1g", 7.89456123e8); + result |= test(81, " +100", "%+8lld", 100LL); + result |= test(82, "+00000100", "%+.8lld", 100LL); + result |= test(83, " +00000100", "%+10.8lld", 100LL); + result |= test(84, "%_1lld", "%_1lld", 100LL); + result |= test(85, "-00100", "%-1.5lld", -100LL); + result |= test(86, " 100", "%5lld", 100LL); + result |= test(87, " -100", "%5lld", -100LL); + result |= test(88, "100 ", "%-5lld", 100LL); + result |= test(89, "-100 ", "%-5lld", -100LL); + result |= test(90, "00100", "%-.5lld", 100LL); + result |= test(91, "-00100", "%-.5lld", -100LL); + result |= test(92, "00100 ", "%-8.5lld", 100LL); + result |= test(93, "-00100 ", "%-8.5lld", -100LL); + result |= test(94, "00100", "%05lld", 100LL); + result |= test(95, "-0100", "%05lld", -100LL); + result |= test(96, " 100", "% lld", 100LL); + result |= test(97, "-100", "% lld", -100LL); + result |= test(98, " 100", "% 5lld", 100LL); + result |= test(99, " -100", "% 5lld", -100LL); + result |= test(100, " 00100", "% .5lld", 100LL); + result |= test(101, "-00100", "% .5lld", -100LL); + result |= test(102, " 00100", "% 8.5lld", 100LL); + result |= test(103, " -00100", "% 8.5lld", -100LL); + result |= test(104, "", "%.0lld", 0LL); + result |= test(105, " 0x00ffffffffffffff9c", "%#+21.18llx", -100LL); + result |= test(106, "0001777777777777777777634", "%#.25llo", -100LL); + result |= test(107, " 01777777777777777777634", "%#+24.20llo", -100LL); + result |= test(108, "0X00000FFFFFFFFFFFFFF9C", "%#+18.21llX", -100LL); + result |= test(109, "001777777777777777777634", "%#+20.24llo", -100LL); + result |= test(110, " 0018446744073709551615", "%#+25.22llu", -1LL); + result |= test(111, " 0018446744073709551615", "%#+25.22llu", -1LL); + result |= test(112, " 0000018446744073709551615", "%#+30.25llu", -1LL); + result |= test(113, " -0000000000000000000001", "%+#25.22lld", -1LL); + result |= test(114, "00144 ", "%#-8.5llo", 100LL); + result |= test(115, "+00100 ", "%#-+ 08.5lld", 100LL); + result |= test(116, "+00100 ", "%#-+ 08.5lld", 100LL); + result |= test(117, "0000000000000000000000000000000000000001", "%.40lld", 1LL); + result |= test(118, " 0000000000000000000000000000000000000001", "% .40lld", 1LL); + result |= test(119, " 0000000000000000000000000000000000000001", "% .40d", 1); + /* 121: excluded for C */ + /* 124: excluded for C */ + result |= test(125, " 1", "% d", 1); + result |= test(126, "+1", "%+ d", 1); + result |= test(129, "0x0000000001", "%#012x", 1); + result |= test(130, "0x00000001", "%#04.8x", 1); + result |= test(131, "0x01 ", "%#-08.2x", 1); + result |= test(132, "00000001", "%#08o", 1); + result |= test(133, "0x39", "%p", (void *)57ULL); + result |= test(137, "0x39", "%p", (void *)57U); + result |= test(142, "f", "%.1s", "foo"); + result |= test(143, "f", "%.*s", 1, "foo"); + result |= test(144, "foo ", "%*s", -5, "foo"); + result |= test(145, "hello", "hello"); + result |= test(147, "%b", "%b"); + result |= test(148, " a", "%3c", 'a'); + result |= test(149, "1234", "%3d", 1234); + /* 150: excluded for C */ + result |= test(152, "2", "%-1d", 2); + result |= test(153, "8.6000", "%2.4f", 8.6); + result |= test(154, "0.600000", "%0f", 0.6); + result |= test(155, "1", "%.0f", 0.6); + result |= test(156, "8.6000e+00", "%2.4e", 8.6); + result |= test(157, " 8.6000e+00", "% 2.4e", 8.6); + result |= test(159, "-8.6000e+00", "% 2.4e", -8.6); + result |= test(160, "+8.6000e+00", "%+2.4e", 8.6); + result |= test(161, "8.6", "%2.4g", 8.6); + result |= test(162, "-1", "%-i", -1); + result |= test(163, "1", "%-i", 1); + result |= test(164, "+1", "%+i", 1); + result |= test(165, "12", "%o", 10); + /* 166: excluded for C */ + /* 167: excluded for C */ + result |= test(169, "%%%%", "%s", "%%%%"); + result |= test(170, "4294967295", "%u", -1); + result |= test(171, "%w", "%w", -1); + /* 172: excluded for C */ + /* 173: excluded for C */ + /* 174: excluded for C */ + result |= test(176, "%H", "%H", -1); + result |= test(177, "%0", "%%0"); + result |= test(178, "2345", "%hx", 74565); + result |= test(179, "61", "%hhx", 'a'); + result |= test(181, "Hallo heimur", "Hallo heimur"); + result |= test(182, "Hallo heimur", "%s", "Hallo heimur"); + result |= test(183, "1024", "%d", 1024); + result |= test(184, "-1024", "%d", -1024); + result |= test(185, "1024", "%i", 1024); + result |= test(186, "-1024", "%i", -1024); + result |= test(187, "1024", "%u", 1024); + result |= test(188, "4294966272", "%u", 4294966272U); + result |= test(189, "777", "%o", 511); + result |= test(190, "37777777001", "%o", 4294966785U); + result |= test(191, "1234abcd", "%x", 305441741); + result |= test(192, "edcb5433", "%x", 3989525555U); + result |= test(193, "1234ABCD", "%X", 305441741); + result |= test(194, "EDCB5433", "%X", 3989525555U); + result |= test(195, "x", "%c", 'x'); + result |= test(196, "%", "%%"); + result |= test(197, "Hallo heimur", "%+s", "Hallo heimur"); + result |= test(198, "+1024", "%+d", 1024); + result |= test(199, "-1024", "%+d", -1024); + result |= test(200, "+1024", "%+i", 1024); + result |= test(201, "-1024", "%+i", -1024); + result |= test(202, "1024", "%+u", 1024); + result |= test(203, "4294966272", "%+u", 4294966272U); + result |= test(204, "777", "%+o", 511); + result |= test(205, "37777777001", "%+o", 4294966785U); + result |= test(206, "1234abcd", "%+x", 305441741); + result |= test(207, "edcb5433", "%+x", 3989525555U); + result |= test(208, "1234ABCD", "%+X", 305441741); + result |= test(209, "EDCB5433", "%+X", 3989525555U); + result |= test(210, "x", "%+c", 'x'); + result |= test(211, "Hallo heimur", "% s", "Hallo heimur"); + result |= test(212, " 1024", "% d", 1024); + result |= test(213, "-1024", "% d", -1024); + result |= test(214, " 1024", "% i", 1024); + result |= test(215, "-1024", "% i", -1024); + result |= test(216, "1024", "% u", 1024); + result |= test(217, "4294966272", "% u", 4294966272U); + result |= test(218, "777", "% o", 511); + result |= test(219, "37777777001", "% o", 4294966785U); + result |= test(220, "1234abcd", "% x", 305441741); + result |= test(221, "edcb5433", "% x", 3989525555U); + result |= test(222, "1234ABCD", "% X", 305441741); + result |= test(223, "EDCB5433", "% X", 3989525555U); + result |= test(224, "x", "% c", 'x'); + result |= test(225, "Hallo heimur", "%+ s", "Hallo heimur"); + result |= test(226, "+1024", "%+ d", 1024); + result |= test(227, "-1024", "%+ d", -1024); + result |= test(228, "+1024", "%+ i", 1024); + result |= test(229, "-1024", "%+ i", -1024); + result |= test(230, "1024", "%+ u", 1024); + result |= test(231, "4294966272", "%+ u", 4294966272U); + result |= test(232, "777", "%+ o", 511); + result |= test(233, "37777777001", "%+ o", 4294966785U); + result |= test(234, "1234abcd", "%+ x", 305441741); + result |= test(235, "edcb5433", "%+ x", 3989525555U); + result |= test(236, "1234ABCD", "%+ X", 305441741); + result |= test(237, "EDCB5433", "%+ X", 3989525555U); + result |= test(238, "x", "%+ c", 'x'); + result |= test(239, "0777", "%#o", 511); + result |= test(240, "037777777001", "%#o", 4294966785U); + result |= test(241, "0x1234abcd", "%#x", 305441741); + result |= test(242, "0xedcb5433", "%#x", 3989525555U); + result |= test(243, "0X1234ABCD", "%#X", 305441741); + result |= test(244, "0XEDCB5433", "%#X", 3989525555U); + result |= test(245, "0", "%#o", 0U); + result |= test(246, "0", "%#x", 0U); + result |= test(247, "0", "%#X", 0U); + result |= test(248, "Hallo heimur", "%1s", "Hallo heimur"); + result |= test(249, "1024", "%1d", 1024); + result |= test(250, "-1024", "%1d", -1024); + result |= test(251, "1024", "%1i", 1024); + result |= test(252, "-1024", "%1i", -1024); + result |= test(253, "1024", "%1u", 1024); + result |= test(254, "4294966272", "%1u", 4294966272U); + result |= test(255, "777", "%1o", 511); + result |= test(256, "37777777001", "%1o", 4294966785U); + result |= test(257, "1234abcd", "%1x", 305441741); + result |= test(258, "edcb5433", "%1x", 3989525555U); + result |= test(259, "1234ABCD", "%1X", 305441741); + result |= test(260, "EDCB5433", "%1X", 3989525555U); + result |= test(261, "x", "%1c", 'x'); + result |= test(262, " Hallo", "%20s", "Hallo"); + result |= test(263, " 1024", "%20d", 1024); + result |= test(264, " -1024", "%20d", -1024); + result |= test(265, " 1024", "%20i", 1024); + result |= test(266, " -1024", "%20i", -1024); + result |= test(267, " 1024", "%20u", 1024); + result |= test(268, " 4294966272", "%20u", 4294966272U); + result |= test(269, " 777", "%20o", 511); + result |= test(270, " 37777777001", "%20o", 4294966785U); + result |= test(271, " 1234abcd", "%20x", 305441741); + result |= test(272, " edcb5433", "%20x", 3989525555U); + result |= test(273, " 1234ABCD", "%20X", 305441741); + result |= test(274, " EDCB5433", "%20X", 3989525555U); + result |= test(275, " x", "%20c", 'x'); + result |= test(276, "Hallo ", "%-20s", "Hallo"); + result |= test(277, "1024 ", "%-20d", 1024); + result |= test(278, "-1024 ", "%-20d", -1024); + result |= test(279, "1024 ", "%-20i", 1024); + result |= test(280, "-1024 ", "%-20i", -1024); + result |= test(281, "1024 ", "%-20u", 1024); + result |= test(282, "4294966272 ", "%-20u", 4294966272U); + result |= test(283, "777 ", "%-20o", 511); + result |= test(284, "37777777001 ", "%-20o", 4294966785U); + result |= test(285, "1234abcd ", "%-20x", 305441741); + result |= test(286, "edcb5433 ", "%-20x", 3989525555U); + result |= test(287, "1234ABCD ", "%-20X", 305441741); + result |= test(288, "EDCB5433 ", "%-20X", 3989525555U); + result |= test(289, "x ", "%-20c", 'x'); + result |= test(290, "00000000000000001024", "%020d", 1024); + result |= test(291, "-0000000000000001024", "%020d", -1024); + result |= test(292, "00000000000000001024", "%020i", 1024); + result |= test(293, "-0000000000000001024", "%020i", -1024); + result |= test(294, "00000000000000001024", "%020u", 1024); + result |= test(295, "00000000004294966272", "%020u", 4294966272U); + result |= test(296, "00000000000000000777", "%020o", 511); + result |= test(297, "00000000037777777001", "%020o", 4294966785U); + result |= test(298, "0000000000001234abcd", "%020x", 305441741); + result |= test(299, "000000000000edcb5433", "%020x", 3989525555U); + result |= test(300, "0000000000001234ABCD", "%020X", 305441741); + result |= test(301, "000000000000EDCB5433", "%020X", 3989525555U); + result |= test(302, " 0777", "%#20o", 511); + result |= test(303, " 037777777001", "%#20o", 4294966785U); + result |= test(304, " 0x1234abcd", "%#20x", 305441741); + result |= test(305, " 0xedcb5433", "%#20x", 3989525555U); + result |= test(306, " 0X1234ABCD", "%#20X", 305441741); + result |= test(307, " 0XEDCB5433", "%#20X", 3989525555U); + result |= test(308, "00000000000000000777", "%#020o", 511); + result |= test(309, "00000000037777777001", "%#020o", 4294966785U); + result |= test(310, "0x00000000001234abcd", "%#020x", 305441741); + result |= test(311, "0x0000000000edcb5433", "%#020x", 3989525555U); + result |= test(312, "0X00000000001234ABCD", "%#020X", 305441741); + result |= test(313, "0X0000000000EDCB5433", "%#020X", 3989525555U); + result |= test(314, "Hallo ", "%0-20s", "Hallo"); + result |= test(315, "1024 ", "%0-20d", 1024); + result |= test(316, "-1024 ", "%0-20d", -1024); + result |= test(317, "1024 ", "%0-20i", 1024); + result |= test(318, "-1024 ", "%0-20i", -1024); + result |= test(319, "1024 ", "%0-20u", 1024); + result |= test(320, "4294966272 ", "%0-20u", 4294966272U); + result |= test(321, "777 ", "%-020o", 511); + result |= test(322, "37777777001 ", "%-020o", 4294966785U); + result |= test(323, "1234abcd ", "%-020x", 305441741); + result |= test(324, "edcb5433 ", "%-020x", 3989525555U); + result |= test(325, "1234ABCD ", "%-020X", 305441741); + result |= test(326, "EDCB5433 ", "%-020X", 3989525555U); + result |= test(327, "x ", "%-020c", 'x'); + result |= test(328, " Hallo", "%*s", 20, "Hallo"); + result |= test(329, " 1024", "%*d", 20, 1024); + result |= test(330, " -1024", "%*d", 20, -1024); + result |= test(331, " 1024", "%*i", 20, 1024); + result |= test(332, " -1024", "%*i", 20, -1024); + result |= test(333, " 1024", "%*u", 20, 1024); + result |= test(334, " 4294966272", "%*u", 20, 4294966272U); + result |= test(335, " 777", "%*o", 20, 511); + result |= test(336, " 37777777001", "%*o", 20, 4294966785U); + result |= test(337, " 1234abcd", "%*x", 20, 305441741); + result |= test(338, " edcb5433", "%*x", 20, 3989525555U); + result |= test(339, " 1234ABCD", "%*X", 20, 305441741); + result |= test(340, " EDCB5433", "%*X", 20, 3989525555U); + result |= test(341, " x", "%*c", 20, 'x'); + result |= test(342, "Hallo heimur", "%.20s", "Hallo heimur"); + result |= test(343, "00000000000000001024", "%.20d", 1024); + result |= test(344, "-00000000000000001024", "%.20d", -1024); + result |= test(345, "00000000000000001024", "%.20i", 1024); + result |= test(346, "-00000000000000001024", "%.20i", -1024); + result |= test(347, "00000000000000001024", "%.20u", 1024); + result |= test(348, "00000000004294966272", "%.20u", 4294966272U); + result |= test(349, "00000000000000000777", "%.20o", 511); + result |= test(350, "00000000037777777001", "%.20o", 4294966785U); + result |= test(351, "0000000000001234abcd", "%.20x", 305441741); + result |= test(352, "000000000000edcb5433", "%.20x", 3989525555U); + result |= test(353, "0000000000001234ABCD", "%.20X", 305441741); + result |= test(354, "000000000000EDCB5433", "%.20X", 3989525555U); + result |= test(355, " Hallo", "%20.5s", "Hallo heimur"); + result |= test(356, " 01024", "%20.5d", 1024); + result |= test(357, " -01024", "%20.5d", -1024); + result |= test(358, " 01024", "%20.5i", 1024); + result |= test(359, " -01024", "%20.5i", -1024); + result |= test(360, " 01024", "%20.5u", 1024); + result |= test(361, " 4294966272", "%20.5u", 4294966272U); + result |= test(362, " 00777", "%20.5o", 511); + result |= test(363, " 37777777001", "%20.5o", 4294966785U); + result |= test(364, " 1234abcd", "%20.5x", 305441741); + result |= test(365, " 00edcb5433", "%20.10x", 3989525555U); + result |= test(366, " 1234ABCD", "%20.5X", 305441741); + result |= test(367, " 00EDCB5433", "%20.10X", 3989525555U); + result |= test(369, " 01024", "%020.5d", 1024); + result |= test(370, " -01024", "%020.5d", -1024); + result |= test(371, " 01024", "%020.5i", 1024); + result |= test(372, " -01024", "%020.5i", -1024); + result |= test(373, " 01024", "%020.5u", 1024); + result |= test(374, " 4294966272", "%020.5u", 4294966272U); + result |= test(375, " 00777", "%020.5o", 511); + result |= test(376, " 37777777001", "%020.5o", 4294966785U); + result |= test(377, " 1234abcd", "%020.5x", 305441741); + result |= test(378, " 00edcb5433", "%020.10x", 3989525555U); + result |= test(379, " 1234ABCD", "%020.5X", 305441741); + result |= test(380, " 00EDCB5433", "%020.10X", 3989525555U); + result |= test(381, "", "%.0s", "Hallo heimur"); + result |= test(382, " ", "%20.0s", "Hallo heimur"); + result |= test(383, "", "%.s", "Hallo heimur"); + result |= test(384, " ", "%20.s", "Hallo heimur"); + result |= test(385, " 1024", "%20.0d", 1024); + result |= test(386, " -1024", "%20.d", -1024); + result |= test(387, " ", "%20.d", 0); + result |= test(388, " 1024", "%20.0i", 1024); + result |= test(389, " -1024", "%20.i", -1024); + result |= test(390, " ", "%20.i", 0); + result |= test(391, " 1024", "%20.u", 1024); + result |= test(392, " 4294966272", "%20.0u", 4294966272U); + result |= test(393, " ", "%20.u", 0U); + result |= test(394, " 777", "%20.o", 511); + result |= test(395, " 37777777001", "%20.0o", 4294966785U); + result |= test(396, " ", "%20.o", 0U); + result |= test(397, " 1234abcd", "%20.x", 305441741); + result |= test(398, " edcb5433", "%20.0x", 3989525555U); + result |= test(399, " ", "%20.x", 0U); + result |= test(400, " 1234ABCD", "%20.X", 305441741); + result |= test(401, " EDCB5433", "%20.0X", 3989525555U); + result |= test(402, " ", "%20.X", 0U); + result |= test(403, "Hallo ", "% -0+*.*s", 20, 5, "Hallo heimur"); + result |= test(404, "+01024 ", "% -0+*.*d", 20, 5, 1024); + result |= test(405, "-01024 ", "% -0+*.*d", 20, 5, -1024); + result |= test(406, "+01024 ", "% -0+*.*i", 20, 5, 1024); + result |= test(407, "-01024 ", "% 0-+*.*i", 20, 5, -1024); + result |= test(408, "01024 ", "% 0-+*.*u", 20, 5, 1024); + result |= test(409, "4294966272 ", "% 0-+*.*u", 20, 5, 4294966272U); + result |= test(410, "00777 ", "%+ -0*.*o", 20, 5, 511); + result |= test(411, "37777777001 ", "%+ -0*.*o", 20, 5, 4294966785U); + result |= test(412, "1234abcd ", "%+ -0*.*x", 20, 5, 305441741); + result |= test(413, "00edcb5433 ", "%+ -0*.*x", 20, 10, 3989525555U); + result |= test(414, "1234ABCD ", "% -+0*.*X", 20, 5, 305441741); + result |= test(415, "00EDCB5433 ", "% -+0*.*X", 20, 10, 3989525555U); + result |= test(416, "hi x", "%*sx", -3, "hi"); diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/autoload.cc libnewlib-nano-2.11.2/winsup/cygwin/autoload.cc --- libnewlib-nano-2.10.0/winsup/cygwin/autoload.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/autoload.cc 2018-11-14 22:26:13.000000000 +0000 @@ -640,6 +640,12 @@ LoadDLLfunc (SHGetDesktopFolder, 4, shell32) +LoadDLLfunc (CreateFontW, 56, gdi32) +LoadDLLfunc (DeleteObject, 4, gdi32) +LoadDLLfunc (EnumFontFamiliesExW, 20, gdi32) +LoadDLLfunc (GetGlyphIndicesW, 20, gdi32) +LoadDLLfunc (SelectObject, 8, gdi32) + LoadDLLfunc (CloseClipboard, 0, user32) LoadDLLfunc (CloseDesktop, 4, user32) LoadDLLfunc (CloseWindowStation, 4, user32) @@ -651,6 +657,7 @@ LoadDLLfunc (EmptyClipboard, 0, user32) LoadDLLfunc (EnumWindows, 8, user32) LoadDLLfunc (GetClipboardData, 4, user32) +LoadDLLfunc (GetDC, 4, user32) LoadDLLfunc (GetForegroundWindow, 0, user32) LoadDLLfunc (GetKeyboardLayout, 4, user32) LoadDLLfunc (GetMessageW, 16, user32) diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/cygerrno.h libnewlib-nano-2.11.2/winsup/cygwin/cygerrno.h --- libnewlib-nano-2.10.0/winsup/cygwin/cygerrno.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/cygerrno.h 2018-11-14 22:26:13.000000000 +0000 @@ -37,7 +37,7 @@ __set_errno (const char *fn, int ln, int val) { debug_printf ("%s:%d setting errno %d", fn, ln, val); - return errno = _impure_ptr->_errno = val; + return errno = __errno_r(_impure_ptr) = val; } #define set_errno(val) __set_errno (__PRETTY_FUNCTION__, __LINE__, (val)) @@ -56,7 +56,7 @@ save_errno (int what) {saved = get_errno (); set_errno (what); } void set (int what) {set_errno (what); saved = what;} void reset () {saved = get_errno ();} - ~save_errno () {errno = _impure_ptr->_errno = saved;} + ~save_errno () {errno = __errno_r(_impure_ptr) = saved;} }; extern const char *__sp_fn; diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/errno.cc libnewlib-nano-2.11.2/winsup/cygwin/errno.cc --- libnewlib-nano-2.10.0/winsup/cygwin/errno.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/errno.cc 2018-11-14 22:26:13.000000000 +0000 @@ -334,7 +334,7 @@ seterrno_from_win_error (const char *file, int line, DWORD code) { syscall_printf ("%s:%d windows error %u", file, line, code); - errno = _impure_ptr->_errno = geterrno_from_win_error (code, EACCES); + errno = __errno_r(_impure_ptr) = geterrno_from_win_error (code, EACCES); } int __reg2 @@ -352,7 +352,7 @@ SetLastError (code); syscall_printf ("%s:%d status %y -> windows error %u", file, line, status, code); - errno = _impure_ptr->_errno = geterrno_from_win_error (code, EACCES); + errno = __errno_r(_impure_ptr) = geterrno_from_win_error (code, EACCES); } static char * diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/fhandler_console.cc libnewlib-nano-2.11.2/winsup/cygwin/fhandler_console.cc --- libnewlib-nano-2.10.0/winsup/cygwin/fhandler_console.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/fhandler_console.cc 2018-11-14 22:26:13.000000000 +0000 @@ -759,7 +759,7 @@ SMALL_RECT sr1, sr2; CHAR_INFO fill; COORD dest; - fill.Char.AsciiChar = ' '; + fill.Char.UnicodeChar = L' '; fill.Attributes = current_win32_attr; fillin (h); @@ -775,7 +775,7 @@ sr1.Bottom = sr2.Bottom; dest.X = xn >= 0 ? xn : dwWinSize.X - 1; dest.Y = yn >= 0 ? yn : b.srWindow.Bottom; - ScrollConsoleScreenBuffer (h, &sr1, &sr2, dest, &fill); + ScrollConsoleScreenBufferW (h, &sr1, &sr2, dest, &fill); } inline void @@ -822,7 +822,7 @@ set_output_handle (NULL); /* Open the input handle as handle_ */ - h = CreateFile ("CONIN$", GENERIC_READ | GENERIC_WRITE, + h = CreateFileW (L"CONIN$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, &sec_none, OPEN_EXISTING, 0, 0); @@ -833,7 +833,7 @@ } set_io_handle (h); - h = CreateFile ("CONOUT$", GENERIC_READ | GENERIC_WRITE, + h = CreateFileW (L"CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, &sec_none, OPEN_EXISTING, 0, 0); @@ -1226,9 +1226,9 @@ br.Right = b.dwSize.X - 1; br.Bottom = b.dwSize.Y - 1; dest.X = dest.Y = 0; - fill.Char.AsciiChar = ' '; + fill.Char.UnicodeChar = L' '; fill.Attributes = current_win32_attr; - ScrollConsoleScreenBuffer (h, &br, NULL, dest, &fill); + ScrollConsoleScreenBufferW (h, &br, NULL, dest, &fill); /* Since we're moving the console buffer under the console window we only have to move the console window if the user scrolled the window upwards. The number of lines is the distance to the @@ -1971,15 +1971,108 @@ } } -/* This gets called when we found an invalid input character. We just - print a half filled square (UTF 0x2592). We have no chance to figure - out the "meaning" of the input char anyway. */ +#define NUM_REPLACEMENT_CHARS 3 + +static const wchar_t replacement_char[NUM_REPLACEMENT_CHARS] = +{ + 0xfffd, /* REPLACEMENT CHARACTER */ + 0x25a1, /* WHITE SQUARE */ + 0x2592 /* MEDIUM SHADE */ +}; +/* nFont member is always 0 so we have to use the facename. */ +static WCHAR cons_facename[LF_FACESIZE]; +static WCHAR rp_char; +static NO_COPY HDC cdc; + +static int CALLBACK +enum_proc (const LOGFONTW *lf, const TEXTMETRICW *tm, + DWORD FontType, LPARAM lParam) +{ + int *done = (int *) lParam; + *done = 1; + return 0; +} + +static void +check_font (HANDLE hdl) +{ + CONSOLE_FONT_INFOEX cfi; + LOGFONTW lf; + + cfi.cbSize = sizeof cfi; + if (!GetCurrentConsoleFontEx (hdl, 0, &cfi)) + return; + /* Switched font? */ + if (wcscmp (cons_facename, cfi.FaceName) == 0) + return; + if (!cdc && !(cdc = GetDC (GetConsoleWindow ()))) + return; + /* Some FaceNames like DejaVu Sans Mono are sometimes returned with stray + trailing chars. Fix it. */ + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE; + wchar_t *cp = wcpcpy (lf.lfFaceName, cfi.FaceName) - 1; + int done = 0; + do + { + EnumFontFamiliesExW (cdc, &lf, enum_proc, (LPARAM) &done, 0); + if (!done) + *cp-- = L'\0'; + } + while (!done && cp >= lf.lfFaceName); + /* What, really? No recognizable font? */ + if (!done) + { + rp_char = L'?'; + return; + } + /* Yes. Check for the best replacement char. */ + HFONT f = CreateFontW (0, 0, 0, 0, + cfi.FontWeight, FALSE, FALSE, FALSE, + DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, + FIXED_PITCH | FF_DONTCARE, lf.lfFaceName); + if (!f) + return; + + HFONT old_f = (HFONT) SelectObject(cdc, f); + if (old_f) + { + WORD glyph_idx[NUM_REPLACEMENT_CHARS]; + + if (GetGlyphIndicesW (cdc, replacement_char, + NUM_REPLACEMENT_CHARS, glyph_idx, + GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR) + { + int i; + + for (i = 0; i < NUM_REPLACEMENT_CHARS; ++i) + if (glyph_idx[i] != 0xffff) + break; + if (i == NUM_REPLACEMENT_CHARS) + i = 0; + rp_char = replacement_char[i]; + /* Note that we copy the original name returned by + GetCurrentConsoleFontEx, even if it was broken. + This allows an early return, rather than to store + the fixed name and then having to enum font families + all over again. */ + wcscpy (cons_facename, cfi.FaceName); + } + SelectObject (cdc, old_f); + } + DeleteObject (f); +} + +/* This gets called when we found an invalid input character. + Print one of the above Unicode chars as replacement char. */ inline void fhandler_console::write_replacement_char () { - static const wchar_t replacement_char = 0x2592; /* Half filled square */ + check_font (get_output_handle ()); + DWORD done; - WriteConsoleW (get_output_handle (), &replacement_char, 1, &done, 0); + WriteConsoleW (get_output_handle (), &rp_char, 1, &done, 0); } const unsigned char * diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/fhandler_fifo.cc libnewlib-nano-2.11.2/winsup/cygwin/fhandler_fifo.cc --- libnewlib-nano-2.10.0/winsup/cygwin/fhandler_fifo.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/fhandler_fifo.cc 2018-11-14 22:26:13.000000000 +0000 @@ -221,6 +221,14 @@ return res == success; } +off_t +fhandler_fifo::lseek (off_t offset, int whence) +{ + debug_printf ("(%D, %d)", offset, whence); + set_errno (ESPIPE); + return -1; +} + bool fhandler_fifo::wait (HANDLE h) { diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/fhandler.h libnewlib-nano-2.11.2/winsup/cygwin/fhandler.h --- libnewlib-nano-2.10.0/winsup/cygwin/fhandler.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/fhandler.h 2018-11-14 22:26:13.000000000 +0000 @@ -1216,6 +1216,7 @@ { x->pc.free_strings (); *reinterpret_cast (x) = *this; + reinterpret_cast (x)->atomic_write_buf = NULL; x->reset (this); } @@ -1237,6 +1238,7 @@ public: fhandler_fifo (); int open (int, mode_t); + off_t lseek (off_t offset, int whence); int close (); int dup (fhandler_base *child, int); bool isfifo () const { return true; } @@ -1255,6 +1257,7 @@ { x->pc.free_strings (); *reinterpret_cast (x) = *this; + reinterpret_cast (x)->atomic_write_buf = NULL; x->reset (this); } diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/fhandler_process.cc libnewlib-nano-2.11.2/winsup/cygwin/fhandler_process.cc --- libnewlib-nano-2.10.0/winsup/cygwin/fhandler_process.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/fhandler_process.cc 2018-11-14 22:26:13.000000000 +0000 @@ -82,10 +82,9 @@ static const int PROCESS_LINK_COUNT = (sizeof (process_tab) / sizeof (virt_tab_t)) - 1; int get_process_state (DWORD dwProcessId); -static bool get_mem_values (DWORD dwProcessId, unsigned long *vmsize, - unsigned long *vmrss, unsigned long *vmtext, - unsigned long *vmdata, unsigned long *vmlib, - unsigned long *vmshare); +static bool get_mem_values (DWORD dwProcessId, size_t &vmsize, size_t &vmrss, + size_t &vmtext, size_t &vmdata, size_t &vmlib, + size_t &vmshare); /* Returns 0 if path doesn't exist, >0 if path is a directory, -1 if path is a file, -2 if path is a symlink, -3 if path is a pipe, @@ -1174,8 +1173,7 @@ char cmd[NAME_MAX + 1]; int state = 'R'; const char *state_str = "unknown"; - unsigned long vmsize = 0UL, vmrss = 0UL, vmdata = 0UL, vmlib = 0UL, - vmtext = 0UL, vmshare = 0UL; + size_t vmsize = 0, vmrss = 0, vmdata = 0, vmlib = 0, vmtext = 0, vmshare = 0; PWCHAR last_slash = wcsrchr (p->progname, L'\\'); sys_wcstombs (cmd, NAME_MAX + 1, last_slash ? last_slash + 1 : p->progname); @@ -1213,15 +1211,13 @@ state_str = "stopped"; break; } - if (!get_mem_values (p->dwProcessId, &vmsize, &vmrss, &vmtext, &vmdata, - &vmlib, &vmshare)) + if (!get_mem_values (p->dwProcessId, vmsize, vmrss, vmtext, vmdata, + vmlib, vmshare)) return 0; - unsigned page_size = wincap.allocation_granularity (); - vmsize *= page_size; vmrss *= page_size; vmdata *= page_size; - vmtext *= page_size; vmlib *= page_size; /* The real uid value for *this* process is stored at cygheap->user.real_uid but we can't get at the real uid value for any other process, so just fake it as p->uid. Similar for p->gid. */ + size_t kb_per_page = wincap.allocation_granularity() / 1024; destbuf = (char *) crealloc_abort (destbuf, strlen (cmd) + 320); return __small_sprintf (destbuf, "Name:\t%s\n" "State:\t%c (%s)\n" @@ -1230,13 +1226,13 @@ "PPid:\t%d\n" "Uid:\t%d %d %d %d\n" "Gid:\t%d %d %d %d\n" - "VmSize:\t%8d kB\n" - "VmLck:\t%8d kB\n" - "VmRSS:\t%8d kB\n" - "VmData:\t%8d kB\n" - "VmStk:\t%8d kB\n" - "VmExe:\t%8d kB\n" - "VmLib:\t%8d kB\n" + "VmSize:\t%8lu kB\n" + "VmLck:\t%8lu kB\n" + "VmRSS:\t%8lu kB\n" + "VmData:\t%8lu kB\n" + "VmStk:\t%8lu kB\n" + "VmExe:\t%8lu kB\n" + "VmLib:\t%8lu kB\n" "SigPnd:\t%016x\n" "SigBlk:\t%016x\n" "SigIgn:\t%016x\n", @@ -1247,8 +1243,9 @@ p->ppid, p->uid, p->uid, p->uid, p->uid, p->gid, p->gid, p->gid, p->gid, - vmsize >> 10, 0, vmrss >> 10, vmdata >> 10, 0, - vmtext >> 10, vmlib >> 10, + vmsize * kb_per_page, 0UL, vmrss * kb_per_page, + vmdata * kb_per_page, 0UL, vmtext * kb_per_page, + vmlib * kb_per_page, 0, 0, _my_tls.sigmask ); } @@ -1257,18 +1254,14 @@ format_process_statm (void *data, char *&destbuf) { _pinfo *p = (_pinfo *) data; - unsigned long vmsize = 0UL, vmrss = 0UL, vmtext = 0UL, vmdata = 0UL, - vmlib = 0UL, vmshare = 0UL; - size_t page_scale; - if (!get_mem_values (p->dwProcessId, &vmsize, &vmrss, &vmtext, &vmdata, - &vmlib, &vmshare)) + size_t vmsize = 0, vmrss = 0, vmtext = 0, vmdata = 0, vmlib = 0, vmshare = 0; + if (!get_mem_values (p->dwProcessId, vmsize, vmrss, vmtext, vmdata, + vmlib, vmshare)) return 0; - page_scale = wincap.allocation_granularity() / wincap.page_size(); destbuf = (char *) crealloc_abort (destbuf, 96); - return __small_sprintf (destbuf, "%ld %ld %ld %ld %ld %ld 0\n", - vmsize / page_scale, vmrss / page_scale, vmshare / page_scale, - vmtext / page_scale, vmlib / page_scale, vmdata / page_scale); + return __small_sprintf (destbuf, "%lu %lu %lu %lu %lu %lu 0\n", + vmsize, vmrss, vmshare, vmtext, vmlib, vmdata); } extern "C" { @@ -1439,9 +1432,8 @@ } static bool -get_mem_values (DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss, - unsigned long *vmtext, unsigned long *vmdata, - unsigned long *vmlib, unsigned long *vmshare) +get_mem_values (DWORD dwProcessId, size_t &vmsize, size_t &vmrss, + size_t &vmtext, size_t &vmdata, size_t &vmlib, size_t &vmshare) { bool res = false; NTSTATUS status; @@ -1449,6 +1441,8 @@ VM_COUNTERS vmc; PMEMORY_WORKING_SET_LIST p; SIZE_T n = 0x4000, length; + const size_t page_scale = wincap.allocation_granularity() + / wincap.page_size(); /* This appears to work despite MSDN claiming that QueryWorkingSet requires PROCESS_QUERY_INFORMATION *and* PROCESS_VM_READ. Since we're trying to do @@ -1483,7 +1477,7 @@ debug_printf ("NtQueryVirtualMemory: status %y", status); if (status == STATUS_PROCESS_IS_TERMINATING) { - *vmsize = *vmrss = *vmtext = *vmdata = *vmlib = *vmshare = 0; + vmsize = vmrss = vmtext = vmdata = vmlib = vmshare = 0; res = true; } else @@ -1492,17 +1486,17 @@ } for (unsigned long i = 0; i < p->NumberOfPages; i++) { - ++*vmrss; + ++vmrss; unsigned flags = p->WorkingSetList[i] & 0x0FFF; if ((flags & (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE)) == (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE)) - ++*vmlib; + ++vmlib; else if (flags & WSLE_PAGE_SHAREABLE) - ++*vmshare; + ++vmshare; else if (flags & WSLE_PAGE_EXECUTE) - ++*vmtext; + ++vmtext; else - ++*vmdata; + ++vmdata; } status = NtQueryInformationProcess (hProcess, ProcessVmCounters, (PVOID) &vmc, sizeof vmc, NULL); @@ -1512,7 +1506,15 @@ __seterrno_from_nt_status (status); goto out; } - *vmsize = vmc.PagefileUsage / wincap.page_size (); + vmsize = vmc.PagefileUsage / wincap.page_size (); + /* Return number of Cygwin pages. Page size in Cygwin is equivalent + to Windows allocation_granularity. */ + vmsize = howmany (vmsize, page_scale); + vmrss = howmany (vmrss, page_scale); + vmshare = howmany (vmshare, page_scale); + vmtext = howmany (vmtext, page_scale); + vmlib = howmany (vmlib, page_scale); + vmdata = howmany (vmdata, page_scale); res = true; out: free (p); diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/fhandler_socket_inet.cc libnewlib-nano-2.11.2/winsup/cygwin/fhandler_socket_inet.cc --- libnewlib-nano-2.10.0/winsup/cygwin/fhandler_socket_inet.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/fhandler_socket_inet.cc 2018-11-14 22:26:13.000000000 +0000 @@ -592,6 +592,7 @@ { DWORD hdl_flags; bool lsp_fixup = false; + int file_flags = O_RDWR | O_BINARY; /* Usually sockets are inheritable IFS objects. Unfortunately some virus scanners or other network-oriented software replace normal sockets @@ -644,18 +645,21 @@ } } } + set_io_handle ((HANDLE) sock); set_addr_family (af); set_socket_type (type); - if (flags & SOCK_NONBLOCK) - set_nonblocking (true); - if (flags & SOCK_CLOEXEC) - set_close_on_exec (true); - set_io_handle ((HANDLE) sock); if (!init_events ()) return -1; + if (flags & SOCK_NONBLOCK) + file_flags |= O_NONBLOCK; + if (flags & SOCK_CLOEXEC) + { + set_close_on_exec (true); + file_flags |= O_CLOEXEC; + } + set_flags (file_flags); if (lsp_fixup) init_fixup_before (); - set_flags (O_RDWR | O_BINARY); set_unique_id (); if (get_socket_type () == SOCK_DGRAM) { @@ -898,7 +902,7 @@ } } else - fd.release (); + delete sock; } if (ret == -1) ::closesocket (res); diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/fhandler_socket_local.cc libnewlib-nano-2.11.2/winsup/cygwin/fhandler_socket_local.cc --- libnewlib-nano-2.10.0/winsup/cygwin/fhandler_socket_local.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/fhandler_socket_local.cc 2018-11-14 22:26:13.000000000 +0000 @@ -988,7 +988,6 @@ ret = sock->af_local_accept (); if (ret == -1) { - fd.release (); delete sock; set_winsock_errno (); return -1; @@ -1013,7 +1012,7 @@ } } else - fd.release (); + delete sock; } if (ret == -1) ::closesocket (res); diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/fhandler_socket_unix.cc libnewlib-nano-2.11.2/winsup/cygwin/fhandler_socket_unix.cc --- libnewlib-nano-2.10.0/winsup/cygwin/fhandler_socket_unix.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/fhandler_socket_unix.cc 2018-11-14 22:26:13.000000000 +0000 @@ -34,7 +34,7 @@ Abstract socket: An abstract socket is represented by a symlink in the native - NT namespace, within the Cygin subdir in BasedNamedObjects. + NT namespace, within the Cygwin subdir in BasedNamedObjects. So it's globally available but only exists as long as at least on descriptor on the socket is open, as desired. @@ -1639,7 +1639,6 @@ create_shmem_failed: delete sock; } - fd.release (); } } /* Ouch! We can't handle the client if we couldn't diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/include/cygwin/version.h libnewlib-nano-2.11.2/winsup/cygwin/include/cygwin/version.h --- libnewlib-nano-2.10.0/winsup/cygwin/include/cygwin/version.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/include/cygwin/version.h 2018-11-14 22:26:13.000000000 +0000 @@ -11,7 +11,7 @@ changes to the DLL and is mainly informative in nature. */ #define CYGWIN_VERSION_DLL_MAJOR 2011 -#define CYGWIN_VERSION_DLL_MINOR 0 +#define CYGWIN_VERSION_DLL_MINOR 2 /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are incompatible. */ diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/include/cygwin/wait.h libnewlib-nano-2.11.2/winsup/cygwin/include/cygwin/wait.h --- libnewlib-nano-2.10.0/winsup/cygwin/include/cygwin/wait.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/include/cygwin/wait.h 2018-11-14 22:26:13.000000000 +0000 @@ -17,9 +17,6 @@ #define WCONTINUED 8 #define __W_CONTINUED 0xffff -/* Will be redefined in sys/wait.h. */ -#define __wait_status_to_int(w) (w) - /* A status is 16 bits, and looks like: <1 byte info> <1 byte code> @@ -29,14 +26,14 @@ == 80, there was a core dump. */ -#define WIFEXITED(w) ((__wait_status_to_int(w) & 0xff) == 0) -#define WIFSIGNALED(w) ((__wait_status_to_int(w) & 0x7f) > 0 \ - && ((__wait_status_to_int(w) & 0x7f) < 0x7f)) -#define WIFSTOPPED(w) ((__wait_status_to_int(w) & 0xff) == 0x7f) -#define WIFCONTINUED(w) ((__wait_status_to_int(w) & 0xffff) == __W_CONTINUED) -#define WEXITSTATUS(w) ((__wait_status_to_int(w) >> 8) & 0xff) -#define WTERMSIG(w) (__wait_status_to_int(w) & 0x7f) -#define WSTOPSIG WEXITSTATUS -#define WCOREDUMP(w) (WIFSIGNALED(w) && (__wait_status_to_int(w) & 0x80)) +#define WIFEXITED(_w) (((_w) & 0xff) == 0) +#define WIFSIGNALED(_w) (((_w) & 0x7f) > 0 \ + && (((_w) & 0x7f) < 0x7f)) +#define WIFSTOPPED(_w) (((_w) & 0xff) == 0x7f) +#define WIFCONTINUED(_w) (((_w) & 0xffff) == __W_CONTINUED) +#define WEXITSTATUS(_w) (((_w) >> 8) & 0xff) +#define WTERMSIG(_w) ((_w) & 0x7f) +#define WSTOPSIG WEXITSTATUS +#define WCOREDUMP(_w) (WIFSIGNALED(_w) && ((_w) & 0x80)) #endif /* _CYGWIN_WAIT_H */ diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/include/nl_types.h libnewlib-nano-2.11.2/winsup/cygwin/include/nl_types.h --- libnewlib-nano-2.10.0/winsup/cygwin/include/nl_types.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/include/nl_types.h 2018-11-14 22:26:13.000000000 +0000 @@ -87,7 +87,7 @@ #ifndef _NL_ITEM_DECLARED -typedef int nl_item; +typedef __nl_item nl_item; #define _NL_ITEM_DECLARED #endif diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/include/sys/dirent.h libnewlib-nano-2.11.2/winsup/cygwin/include/sys/dirent.h --- libnewlib-nano-2.10.0/winsup/cygwin/include/sys/dirent.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/include/sys/dirent.h 2018-11-14 22:26:13.000000000 +0000 @@ -60,38 +60,6 @@ #pragma pack(pop) #endif -DIR *opendir (const char *); -DIR *fdopendir (int); -struct dirent *readdir (DIR *); -int readdir_r (DIR * __restrict, struct dirent * __restrict, - struct dirent ** __restrict); -void rewinddir (DIR *); -int closedir (DIR *); - -int dirfd (DIR *); - -#if __MISC_VISIBLE || __XSI_VISIBLE -#ifndef __INSIDE_CYGWIN__ -long telldir (DIR *); -void seekdir (DIR *, long loc); -#endif -#endif - -#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 -int scandir (const char *__dir, - struct dirent ***__namelist, - int (*select) (const struct dirent *), - int (*compar) (const struct dirent **, const struct dirent **)); -int alphasort (const struct dirent **__a, const struct dirent **__b); -#endif - -#if __GNU_VISIBLE -int scandirat (int __dirfd, const char *__dir, struct dirent ***__namelist, - int (*select) (const struct dirent *), - int (*compar) (const struct dirent **, const struct dirent **)); -int versionsort (const struct dirent **__a, const struct dirent **__b); -#endif - #if __BSD_VISIBLE #ifdef _DIRENT_HAVE_D_TYPE /* File types for `d_type'. */ diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/include/sys/wait.h libnewlib-nano-2.11.2/winsup/cygwin/include/sys/wait.h --- libnewlib-nano-2.10.0/winsup/cygwin/include/sys/wait.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/include/sys/wait.h 2018-11-14 22:26:13.000000000 +0000 @@ -17,79 +17,13 @@ extern "C" { #endif -#ifdef __INSIDE_CYGWIN__ - -typedef int *__wait_status_ptr_t; - -#elif defined(__cplusplus) - -/* Attribute __transparent_union__ is only supported for C. */ -typedef void *__wait_status_ptr_t; - -#else /* !__INSIDE_CYGWIN__ && !__cplusplus */ - -/* Allow `int' and `union wait' for the status. */ -typedef union - { - int *__int_ptr; - union wait *__union_wait_ptr; - } __wait_status_ptr_t __attribute__ ((__transparent_union__)); - -#endif /* __INSIDE_CYGWIN__ */ - -pid_t wait (__wait_status_ptr_t __status); -pid_t waitpid (pid_t __pid, __wait_status_ptr_t __status, int __options); -pid_t wait3 (__wait_status_ptr_t __status, int __options, struct rusage *__rusage); -pid_t wait4 (pid_t __pid, __wait_status_ptr_t __status, int __options, struct rusage *__rusage); - -#ifdef _COMPILING_NEWLIB -pid_t _wait (__wait_status_ptr_t __status); -#endif - -union wait - { - int w_status; - struct - { - unsigned int __w_termsig:7; /* Terminating signal. */ - unsigned int __w_coredump:1; /* Set if dumped core. */ - unsigned int __w_retcode:8; /* Return code if exited normally. */ - unsigned int:16; - } __wait_terminated; - struct - { - unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ - unsigned int __w_stopsig:8; /* Stopping signal. */ - unsigned int:16; - } __wait_stopped; - }; -#define w_termsig __wait_terminated.__w_termsig -#define w_coredump __wait_terminated.__w_coredump -#define w_retcode __wait_terminated.__w_retcode -#define w_stopsig __wait_stopped.__w_stopsig -#define w_stopval __wait_stopped.__w_stopval +pid_t wait (int *__status); +pid_t waitpid (pid_t __pid, int *__status, int __options); +pid_t wait3 (int *__status, int __options, struct rusage *__rusage); +pid_t wait4 (pid_t __pid, int *__status, int __options, struct rusage *__rusage); #ifdef __cplusplus } #endif -/* Used in cygwin/wait.h, redefine to accept `int' and `union wait'. */ -#undef __wait_status_to_int - -#ifdef __cplusplus - -extern "C++" { -inline int __wait_status_to_int (int __status) - { return __status; } -inline int __wait_status_to_int (const union wait & __status) - { return __status.w_status; } -} - -#else /* !__cplusplus */ - -#define __wait_status_to_int(__status) (__extension__ \ - (((union { __typeof(__status) __sin; int __sout; }) { .__sin = (__status) }).__sout)) - -#endif /* __cplusplus */ - #endif /* _SYS_WAIT_H */ diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/Makefile.in libnewlib-nano-2.11.2/winsup/cygwin/Makefile.in --- libnewlib-nano-2.10.0/winsup/cygwin/Makefile.in 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/Makefile.in 2018-11-14 22:26:13.000000000 +0000 @@ -218,7 +218,6 @@ lrintl.o \ lroundl.o \ modfl.o \ - nanl.o \ nearbyint.o \ nearbyintf.o \ nearbyintl.o \ diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/math/nanl.c libnewlib-nano-2.11.2/winsup/cygwin/math/nanl.c --- libnewlib-nano-2.10.0/winsup/cygwin/math/nanl.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/math/nanl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -long double -nanl (const char *tagp) -{ - return __builtin_nanl (""); -} diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/net.cc libnewlib-nano-2.11.2/winsup/cygwin/net.cc --- libnewlib-nano-2.10.0/winsup/cygwin/net.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/net.cc 2018-11-14 22:26:13.000000000 +0000 @@ -536,10 +536,7 @@ res = fd; } else - { - delete fh; - fd.release (); - } + delete fh; } done: @@ -2314,10 +2311,7 @@ cygheap_fdnew fd_out (fd_in, false); if (fd_out < 0) - { - fd_in.release (); - goto done; - } + goto done; fh_in = reinterpret_cast (build_fh_dev (*dev)); fh_out = reinterpret_cast (build_fh_dev (*dev)); @@ -2343,8 +2337,6 @@ { delete fh_in; delete fh_out; - fd_in.release (); - fd_out.release (); } } diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/path.cc libnewlib-nano-2.11.2/winsup/cygwin/path.cc --- libnewlib-nano-2.10.0/winsup/cygwin/path.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/path.cc 2018-11-14 22:26:13.000000000 +0000 @@ -1394,14 +1394,27 @@ } else if (*src != '/') { + /* Make sure dst points to the rightmost backslash which must not + be backtracked over during ".." evaluation. This is either + the backslash after the network path prefix (i.e. "\\") or + the backslash after a drive letter (i.e. C:\"). */ if (beg_src_slash) - dst = (tail += cygheap->cwd.get_drive (dst)); + { + tail += cygheap->cwd.get_drive (dst); + /* network path, drive == '\\\\'? Decrement tail to avoid + triple backslash in output. */ + if (dst[0] == '\\') + --tail; + dst = tail; + } else if (cygheap->cwd.get (dst, 0)) { tail = strchr (tail, '\0'); if (tail[-1] != '\\') *tail++ = '\\'; - dst = tail - 1; + ++dst; + if (dst[1] == '\\') + ++dst; } else return get_errno (); @@ -1428,9 +1441,7 @@ } /* Backup if "..". */ - else if (src[0] == '.' && src[1] == '.' - /* dst must be greater than dst_start */ - && tail[-1] == '\\') + else if (src[0] == '.' && src[1] == '.' && tail[-1] == '\\') { if (!isdirsep (src[2]) && src[2] != '\0') *tail++ = *src++; diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/pwdgrp.h libnewlib-nano-2.11.2/winsup/cygwin/pwdgrp.h --- libnewlib-nano-2.10.0/winsup/cygwin/pwdgrp.h 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/pwdgrp.h 2018-11-14 22:26:13.000000000 +0000 @@ -101,6 +101,7 @@ void *add_account_from_cygserver (cygpsid &sid); void *add_account_from_cygserver (const char *name); void *add_account_from_cygserver (uint32_t id); + bool construct_sid_from_name (cygsid &sid, wchar_t *name, wchar_t *sep); char *fetch_account_from_line (fetch_user_arg_t &arg, const char *line); char *fetch_account_from_file (fetch_user_arg_t &arg); char *fetch_account_from_windows (fetch_user_arg_t &arg, diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/release/2.11.0 libnewlib-nano-2.11.2/winsup/cygwin/release/2.11.0 --- libnewlib-nano-2.10.0/winsup/cygwin/release/2.11.0 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/release/2.11.0 2018-11-14 22:26:13.000000000 +0000 @@ -18,6 +18,14 @@ - Drop denormal-operand exception from FE_ALL_EXCEPT, as on Linux. +- Rename the --file option of setfacl(1) to --set-file, as on Linux. + +- Support Unicode 10. + +- Following glibc, `union wait' has now been removed. Applications + using union wait and these macros will have to migrate to the + POSIX-specified int status type. + Bug Fixes --------- @@ -60,3 +68,16 @@ - Fix fegetenv behaviour. Addresses: https://cygwin.com/ml/cygwin/2018-08/msg00000.html + +- Fix NaN handling in strtof/strtod/strtold. + Addresses: https://cygwin.com/ml/cygwin/2018-08/msg00150.html + +- Fix memory allocation values in /proc//status and /proc//statm. + Addresses: https://cygwin.com/ml/cygwin/2018-08/msg00223.html + +- Fix handling of unknown accounts in file ACLs. Add name->SID + conversion for (most) self-constructed account names. + Addresses: https://cygwin.com/ml/cygwin/2018-08/msg00295.html + +- Correctly handle Logon Session accounts on Windows 10. + Addresses: Found during debugging diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/release/2.11.1 libnewlib-nano-2.11.2/winsup/cygwin/release/2.11.1 --- libnewlib-nano-2.10.0/winsup/cygwin/release/2.11.1 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/release/2.11.1 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,13 @@ +What's new: +----------- + + +What changed: +------------- + + +Bug Fixes +--------- + +- Fix ".." handling in Win32 path normalization, introduced in 2.11.0. + Addresses: https://cygwin.com/ml/cygwin/2018-09/msg00000.html diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/release/2.11.2 libnewlib-nano-2.11.2/winsup/cygwin/release/2.11.2 --- libnewlib-nano-2.10.0/winsup/cygwin/release/2.11.2 1970-01-01 00:00:00.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/release/2.11.2 2018-11-14 22:26:13.000000000 +0000 @@ -0,0 +1,24 @@ +What's new: +----------- + + +What changed: +------------- + + +Bug Fixes +--------- + +- Return ESPIPE rather than EINVAL from lseek on a fifo. + Addresses: https://cygwin.com/ml/cygwin/2018-10/msg00019.html + +- Fix a memory corruption when using pipes or FIFOs + Addresses: https://cygwin.com/ml/cygwin-patches/2018-q4/msg00000.html + +- Fix potential memory corruption and SEGV if socket(2), socketpair(2), + accept(2), or accept4(2) fail. + Addresses: https://cygwin.com/ml/cygwin/2018-10/msg00229.html + +- Fix socket(2) and socketpair(2) calls mishandling SOCK_NONBLOCK and + SOCK_CLOEXEC flags. + Addresses: https://cygwin.com/ml/cygwin/2018-11/msg00017.html diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/sec_helper.cc libnewlib-nano-2.11.2/winsup/cygwin/sec_helper.cc --- libnewlib-nano-2.10.0/winsup/cygwin/sec_helper.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/sec_helper.cc 2018-11-14 22:26:13.000000000 +0000 @@ -169,10 +169,16 @@ } else if ((pw = internal_getpwsid (*this, pldap))) id = pw->pw_uid; - if (id != ILLEGAL_UID && type) - *type = USER; + if (id != ILLEGAL_UID) + { + if (type) + *type = USER; + return id; + } } - return id; + if (type) + *type = 0; /* undefined type */ + return ILLEGAL_UID; } PWCHAR diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/strfuncs.cc libnewlib-nano-2.11.2/winsup/cygwin/strfuncs.cc --- libnewlib-nano-2.10.0/winsup/cygwin/strfuncs.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/strfuncs.cc 2018-11-14 22:26:13.000000000 +0000 @@ -144,7 +144,7 @@ if (ret > 0 && !def_used) return ret; - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } @@ -194,7 +194,7 @@ return ret; } - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } @@ -255,7 +255,7 @@ here is to check if the first byte returns a valid value... */ else if (MultiByteToWideChar (cp, MB_ERR_INVALID_CHARS, s, 1, pwc, 1)) return 1; - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } state->__value.__wchb[state->__count] = *s; @@ -263,7 +263,7 @@ (const char *) state->__value.__wchb, 2, pwc, 1); if (!ret) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } state->__count = 0; @@ -324,7 +324,7 @@ } else if (MultiByteToWideChar (20932, MB_ERR_INVALID_CHARS, s, 1, pwc, 1)) return 1; - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } state->__value.__wchb[state->__count++] = *s; @@ -347,7 +347,7 @@ if (!MultiByteToWideChar (20932, MB_ERR_INVALID_CHARS, (const char *) state->__value.__wchb, 2, pwc, 1)) { - r->_errno = EILSEQ; + __errno_r(r) = EILSEQ; return -1; } state->__count = 0; diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/syscalls.cc libnewlib-nano-2.11.2/winsup/cygwin/syscalls.cc --- libnewlib-nano-2.10.0/winsup/cygwin/syscalls.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/syscalls.cc 2018-11-14 22:26:13.000000000 +0000 @@ -1799,7 +1799,7 @@ int ret; if ((ret = fstat64 (fd, buf)) == -1) - ptr->_errno = get_errno (); + __errno_r(ptr) = get_errno (); return ret; } @@ -1820,7 +1820,7 @@ int ret; if ((ret = fstat (fd, buf)) == -1) - ptr->_errno = get_errno (); + __errno_r(ptr) = get_errno (); return ret; } #else @@ -1956,7 +1956,7 @@ int ret; if ((ret = stat64 (name, buf)) == -1) - ptr->_errno = get_errno (); + __errno_r(ptr) = get_errno (); return ret; } @@ -1978,7 +1978,7 @@ int ret; if ((ret = stat (name, buf)) == -1) - ptr->_errno = get_errno (); + __errno_r(ptr) = get_errno (); return ret; } #else diff -Nru libnewlib-nano-2.10.0/winsup/cygwin/uinfo.cc libnewlib-nano-2.11.2/winsup/cygwin/uinfo.cc --- libnewlib-nano-2.10.0/winsup/cygwin/uinfo.cc 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/cygwin/uinfo.cc 2018-11-14 22:26:13.000000000 +0000 @@ -1793,18 +1793,126 @@ return td->PosixOffset; } -/* CV 2014-05-08: USER_INFO_24 is not yet defined in Mingw64, but will be in - the next release. For the time being, define the structure here with - another name which won't collide with the upcoming correct definition - in lmaccess.h. */ -struct cyg_USER_INFO_24 +/* If LookupAccountName fails, we check the name for a known constructed name + with this function. Return true if we could create a valid SID from name + in sid. sep is either a pointer to thr backslash in name, or NULL if name + is not a qualified DOMAIN\\name string. */ +bool +pwdgrp::construct_sid_from_name (cygsid &sid, wchar_t *name, wchar_t *sep) { - BOOL usri24_internet_identity; - DWORD usri24_flags; - LPWSTR usri24_internet_provider_name; - LPWSTR usri24_internet_principal_name; - PSID usri24_user_sid; -}; + unsigned long rid; + wchar_t *endptr; + + if (sep && wcscmp (name, L"no\\body") == 0) + { + /* Special case "nobody" for reproducible construction of a + nobody SID for WinFsp and similar services. We use the + value 65534 which is -2 with 16 bit uid/gids. */ + sid.create (0, 1, 0xfffe); + return true; + } + if (sep && wcscmp (name, L"AzureAD\\Group") == 0) + { + get_azure_grp_sid (); + if (PSID (logon_sid) != NO_SID) + { + sid = azure_grp_sid; + return true; + } + return false; + } + if (!sep && wcscmp (name, L"CurrentSession") == 0) + { + get_logon_sid (); + if (PSID (logon_sid) == NO_SID) + return false; + sid = logon_sid; + return true; + } + if (!sep && wcscmp (name, L"Authentication authority asserted identity") == 0) + { + sid.create (18, 1, 1); + return true; + } + if (!sep && wcscmp (name, L"Service asserted identity") == 0) + { + sid.create (18, 1, 2); + return true; + } + if (sep && wcsncmp (name, L"Unix_", 5) == 0) + { + int type; + + if (wcsncmp (name + 5, L"User\\", 5) == 0) + type = 1; + else if (wcsncmp (name + 5, L"Group\\", 6) == 0) + type = 2; + else + return false; + + rid = wcstoul (sep + 1, &endptr, 10); + if (*endptr == L'\0') + { + sid.create (22, 2, type, rid); + return true; + } + return false; + } + /* At this point we have to check if the domain name is one of the + known domains, and if the account name is one of "User(DWORD)" + or "Group(DWORD)". */ + if (sep) + { + wchar_t *numstr = NULL; + bool have_domain = false; + + if (wcsncmp (sep + 1, L"User(", 5) == 0) + numstr = sep + 1 + 5; + else if (wcsncmp (sep + 1, L"Group(", 6) == 0) + numstr = sep + 1 + 6; + if (!numstr) + return false; + rid = wcstoul (numstr, &endptr, 10); + if (wcscmp (endptr, L")") != 0) + return false; + + if (wcsncasecmp (name, cygheap->dom.account_flat_name (), sep - name) + == 0) + { + sid = cygheap->dom.account_sid (); + have_domain = true; + } + else if (wcsncasecmp (name, cygheap->dom.primary_flat_name (), sep - name) + == 0) + { + sid = cygheap->dom.primary_sid (); + have_domain = true; + } + else + { + PDS_DOMAIN_TRUSTSW td = NULL; + + for (ULONG idx = 0; (td = cygheap->dom.trusted_domain (idx)); ++idx) + { + if (wcsncasecmp (name, td->NetbiosDomainName, sep - name) == 0) + { + sid = td->DomainSid; + have_domain = true; + break; + } + } + } + if (have_domain) + { + sid.append (rid); + return true; + } + } + return false; +} + +/* CV 2018-08-28: SidTypeLogonSession is not yet defined in Mingw64. */ +#define SidTypeLogonSession 11 char * pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap) @@ -1927,14 +2035,10 @@ } if (!ret) { - if (!strcmp (arg.name, "no+body")) - { - /* Special case "nobody" for reproducible construction of a - nobody SID for WinFsp and similar services. We use the - value 65534 which is -2 with 16 bit uid/gids. */ - csid.create (0, 1, 0xfffe); - break; - } + /* For accounts which can't be resolved by Windows, try if + it's one of the special names we use for special accounts. */ + if (construct_sid_from_name (csid, name, p)) + break; debug_printf ("LookupAccountNameW (%W), %E", name); return NULL; } @@ -2174,7 +2278,7 @@ if (acc_type == SidTypeUser && (sid_sub_auth_count (sid) <= 3 || sid_id_auth (sid) == 11)) acc_type = SidTypeWellKnownGroup; - switch (acc_type) + switch ((int) acc_type) { case SidTypeUser: if (is_group ()) @@ -2192,7 +2296,7 @@ its_ok = true; else if (wincap.has_microsoft_accounts ()) { - struct cyg_USER_INFO_24 *ui24; + USER_INFO_24 *ui24; if (NetUserGetInfo (NULL, name, 24, (PBYTE *) &ui24) == NERR_Success) { @@ -2267,7 +2371,7 @@ /* This shouldn't happen, in theory, but it does. There are cases where the user's logon domain does not show up in the list of trusted domains. We're desperately - trying to workaround that here bu adding an entry for + trying to workaround that here by adding an entry for this domain to the trusted domains and ask the DC for a posix_offset. There's a good chance this doesn't work either, but at least we tried, and the user can @@ -2504,6 +2608,26 @@ if (uid == 0x10000 || uid == 0x10100) return NULL; break; + case SidTypeLogonSession: + /* Starting with Windows 10, LookupAccountSid/Name return valid + info for the login session with new SID_NAME_USE value + SidTypeLogonSession. To return the same info as on + pre-Windows 10, we have to handle this type explicitely here + now and convert the name to "CurrentSession". */ + get_logon_sid (); + if (PSID (logon_sid) == NO_SID) + return NULL; + if (RtlEqualSid (sid, logon_sid)) + { + uid = 0xfff; + wcpcpy (name = namebuf, L"CurrentSession"); + } + else + { + uid = 0xffe; + wcpcpy (name = namebuf, L"OtherSession"); + } + break; case SidTypeLabel: uid = 0x60000 + sid_sub_auth_rid (sid); fully_qualified_name = cygheap->pg.nss_prefix_always (); diff -Nru libnewlib-nano-2.10.0/winsup/doc/new-features.xml libnewlib-nano-2.11.2/winsup/doc/new-features.xml --- libnewlib-nano-2.10.0/winsup/doc/new-features.xml 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/doc/new-features.xml 2018-11-14 22:26:13.000000000 +0000 @@ -30,6 +30,20 @@ Drop denormal-operand exception from FE_ALL_EXCEPT, as on Linux. + +Rename the --file option of setfacl(1) to --set-file, as on Linux. + + + +Support Unicode 10. + + + +Following glibc, `union wait' has now been removed. Applications +using union wait and these macros will have to migrate to the +POSIX-specified int status type. + + diff -Nru libnewlib-nano-2.10.0/winsup/doc/utils.xml libnewlib-nano-2.11.2/winsup/doc/utils.xml --- libnewlib-nano-2.10.0/winsup/doc/utils.xml 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/doc/utils.xml 2018-11-14 22:26:13.000000000 +0000 @@ -1968,7 +1968,7 @@ -b, --remove-all remove all extended ACL entries\n" -x, --delete delete one or more specified ACL entries\n" - -f, --file set ACL entries for FILE to ACL entries read\n" + -f, --set-file set ACL entries for FILE to ACL entries read\n" from ACL_FILE\n" -k, --remove-default remove all default ACL entries\n" -m, --modify modify one or more specified ACL entries\n" @@ -2035,7 +2035,7 @@ d[efault]:o[ther][:] - -f,--file Take the Acl_entries + -f,--set-file Take the Acl_entries from ACL_FILE one per line. Whitespace characters are ignored, and the character "#" may be used to start a comment. The special filename "-" indicates reading from stdin. Note that you can use this with diff -Nru libnewlib-nano-2.10.0/winsup/utils/setfacl.c libnewlib-nano-2.11.2/winsup/utils/setfacl.c --- libnewlib-nano-2.10.0/winsup/utils/setfacl.c 2018-08-16 03:39:09.000000000 +0000 +++ libnewlib-nano-2.11.2/winsup/utils/setfacl.c 2018-11-14 22:26:13.000000000 +0000 @@ -536,7 +536,7 @@ "\n" " -b, --remove-all remove all extended ACL entries\n" " -x, --delete delete one or more specified ACL entries\n" -" -f, --file set ACL entries for FILE to ACL entries read\n" +" -f, --set-file set ACL entries for FILE to ACL entries read\n" " from ACL_FILE\n" " -k, --remove-default remove all default ACL entries\n" " -m, --modify modify one or more specified ACL entries\n" @@ -595,7 +595,7 @@ " d[efault]:m[ask][:]\n" " d[efault]:o[ther][:]\n" "\n" -"-f, --file\n" +"-f, --set-file\n" " Take the Acl_entries from ACL_FILE one per line. Whitespace characters are\n" " ignored, and the character \"#\" may be used to start a comment. The special\n" " filename \"-\" indicates reading from stdin.\n" @@ -652,6 +652,7 @@ struct option longopts[] = { {"remove-all", no_argument, NULL, 'b'}, {"delete", required_argument, NULL, 'x'}, + {"set-file", required_argument, NULL, 'f'}, {"file", required_argument, NULL, 'f'}, {"remove-default", no_argument, NULL, 'k'}, {"modify", required_argument, NULL, 'm'},