aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-07-20ctype: Fix bitfield types on 16-bit targetsnewlib-snapshot-20180720Sebastian Huber2-6/+8
This prevents errors like this: newlib/libc/ctype/categories.c:6:3: error: width of 'first' exceeds its type unsigned int first: 24; ^ Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-07-20Cygwin: move FP environment exports to common.dinCorinna Vinschen3-2/+5
We only have the symbols defined for i686 by accident since 2013... Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-07-20RTEMS: Unconditionally define _off_t to int64_tSebastian Huber1-4/+0
Exotic RTEMS targets can define this back to int32_t as an exception if there are good reasons. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-07-19Remove myself from MAINTAINERSDJ Delorie1-4/+1
Stepping down from target-specific maintainerships.
2018-07-19fix duration handling in sigtimedwaitMark Geisert2-0/+5
2018-07-17Print sign of NaN values to nano-vfprintf.Kumar Gala1-0/+2
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-07-13Fix to stop a fall-through in a switch statementJordi Sanfeliu1-0/+1
The following fixes a fall-through that prevented from reading the next entry in the UTMP file and terminated the program with an abort().
2018-07-13strcmp.S: Improve performance for misaligned stringsSiddhesh Poyarekar1-11/+40
Replace the simple byte-wise compare in the misaligned case with a dword compare with page boundary checks in place. For simplicity I've chosen a 4K page boundary so that we don't have to query the actual page size on the system. This results in up to 3x improvement in performance in the unaligned case on falkor and about 2.5x improvement on mustang as measured using bench-strcmp in glibc.
2018-07-13memcmp.S: optimize for medium to large sizesSiddhesh Poyarekar1-44/+100
This improved memcmp provides a fast path for compares up to 16 bytes and then compares 16 bytes at a time, thus optimizing loads from both sources. The glibc memcmp microbenchmark retains performance (with an error of ~1ns) for smaller compare sizes and reduces up to 31% of execution time for compares up to 4K on the APM Mustang. On Qualcomm Falkor this improves to almost 48%, i.e. it is almost 2x improvement for sizes of 2K and above.
2018-07-13Improve strncmp for mutually misaligned inputsSiddhesh Poyarekar1-17/+79
The mutually misaligned inputs on aarch64 are compared with a simple byte copy, which is not very efficient. Enhance the comparison similar to strcmp by loading a double-word at a time. The peak performance improvement (i.e. 4k maxlen comparisons) due to this on the strncmp microbenchmark in glibc is as follows: falkor: 3.5x (up to 72% time reduction) cortex-a73: 3.5x (up to 71% time reduction) cortex-a53: 3.5x (up to 71% time reduction) All mutually misaligned inputs from 16 bytes maxlen onwards show upwards of 15% improvement and there is no measurable effect on the performance of aligned/mutually aligned inputs.
2018-07-12Cygwin: Treat PROCESSOR_ARCHITECTURE_INTEL as running under WOW64 on ARM64Corinna Vinschen1-9/+24
Bug in current ARM64 WOW64: GetNativeSystemInfo returns PROCESSOR_ARCHITECTURE_INTEL rather than PROCESSOR_ARCHITECTURE_ARM64. Provide for this. Make code better readable. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-07-11Fix AArch32 semihosting SYS_EXIT call on semihosting v1.Tamar Christina1-0/+6
The current SYS_EXIT has a bug that when making the call it always uses the v2 calling convention. This is undefined behavior according to the semihosting specification: https://developer.arm.com/docs/100863/latest/semihosting-operations/sys_exit-0x18 This patch fixes it by making sure v1 passes the argument directly in the register instead of in a block. And for v2 it does the same if the v2 extension isn't supported. The sequence generated now is 12424: ebfffecd bl 11f60 <_has_ext_exit_extended> 12428: e3500000 cmp r0, #0 1242c: 11a0500d movne r5, sp 12430: 059d5000 ldreq r5, [sp] 12434: e1a00004 mov r0, r4 12438: e1a01005 mov r1, r5 1243c: ef00f000 svc 0x0000f000 Signed-off-by: Tamar Christina <tamar.christina@arm.com>
2018-07-11Remove float compare option from sincosfSzabolcs Nagy1-10/+1
PREFER_FLOAT_COMPARISON setting was not correct as it could raise spurious exceptions. Fixing it is easy: just use ISLESS(x, y) instead of abstop12(x) < abstop12(y) with appropriate non-signaling definition for ISLESS. However it seems this setting is not very useful (there is only minor performance difference on various architectures), so remove this option for now.
2018-07-11Fix the documentation comments for log_inline in powSzabolcs Nagy1-3/+3
There was a typo and the arguments were not explained clearly.
2018-07-10Cygwin: Don't print FAST_CWD warning in WOW64 on ARM64 systemsCorinna Vinschen1-1/+15
No way to test this, yet. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-07-10Cygwin: fix a race in the FAST_CWD fallback codeCorinna Vinschen1-22/+17
Guard the entire operation with the FastPebLock critical section used by RtlSetCurrentDirectory_U as well, thus eliminating the race between concurrent chdir/fchdir/SetCurrentDirectory calls. Streamline comment explaining the fallback method. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-07-06Update config.guess and config.subSebastian Huber2-1129/+1144
Update to the latest versions of config.sub (2018-07-03) and config.guess (2018-06-26). Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-07-06Fix a problem that connection to syslogd fails.Takashi Yano2-19/+17
* fhandler_socket_local.cc (get_inet_addr_local): Change type from 'static int' to 'int' to be callable from syslog.cc. * syslog.cc (connect_syslogd): Use get_inet_addr_local() instead of getsockname() to retrieve name information of the syslogd socket.
2018-07-06Fix namespace issues in sinf, cosf and sincosfSzabolcs Nagy5-18/+19
Use const sincos_t for clarity instead of making the typedef const. Use __inv_pi4 and __sincosf_table to avoid namespace issues with static linking.
2018-07-06Fix large ulp error in pow without fma very near 1.0Szabolcs Nagy1-2/+4
The !HAVE_FAST_FMA code path split r = z/c - 1 into r = rhi + rlo such that when z = 1-tiny and c = 1 then rlo and rhi could have much larger magnitude than r which later caused large rounding errors. So do a nearest rounding instead of truncation at the split. In newlib with default settings this was observable on some arm targets that enable the new math code but has no fma.
2018-07-06Change the return type of converttoint and document the semanticsSzabolcs Nagy1-1/+9
The roundtoint and converttoint internal functions are only called with small values, so 32 bit result is enough for converttoint and it is a signed int conversion so the natural return type is int32_t. The original idea was to help the compiler keeping the result in uint64_t, then it's clear that no sign extension is needed and there is no accidental undefined or implementation defined signed int arithmetics. But it turns out gcc does a good job with inlining so changing the type has no overhead and the semantics of the conversion is less surprising this way. Since we want to allow the asuint64 (x + 0x1.8p52) style conversion, the top bits were never usable and the existing code ensures that only the bottom 32 bits of the conversion result are used. In newlib with default settings only aarch64 is affected and there is no significant code generation change with gcc after the patch.
2018-07-06Remove unused TOINT_RINT and TOINT_SHIFT macrosSzabolcs Nagy2-10/+1
Only have separate code paths for TOINT_INTRINSICS and !TOINT_INTRINSICS.
2018-07-06Move __HAVE_FAST_FMA to math_config.hSzabolcs Nagy7-35/+21
Define it consistently with other HAVE_* macros that only affect code using math_config.h. This is also closer to the Arm Optimized Routines code.
2018-07-06Fix code style and comments of new math codeSzabolcs Nagy8-74/+134
Synchronize code style and comments with Arm Optimized Routines, there are no code changes in this patch. This ensures different projects using the same code have consistent code style so bug fix patches can be applied more easily.
2018-07-05Fix newlib functions perror()/psignal() not to use writev().Takashi Yano2-37/+39
This fix is for some platforms which do not have writev(). *perror.c: Use _write_r() instead of writev(). *psignal.c: Use write() insetad of writev(). Revise commit: d4f4e7ae1be1bcf8c021f2b0865aafc16b338aa3
2018-07-04Cygwin: Include local ntsecapi.hTakashi Yano1-1/+1
Our local ntsecapi.h wrapper corrects a bug in the definition of SystemFunction036 which otherwise leads to crashes on 32 bit when using RtlGenRandom. The fhandler_socket_local.cc file accidentally included the incorrect w32api version of that file, rather than the local wrapper. Fix it. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-07-04Fix a bug of perror()/psignal() that changes the orientation of stderr.Takashi Yano2-8/+54
* perror.c: Fix the problem that perror() changes the orientation of stderr to byte-oriented mode if stderr is not oriented yet. * psignal.c: Ditto.
2018-07-03Fix a bug of psiginfo() that changes the orientation of stderr.Takashi Yano1-6/+35
* strsig.cc (psiginfo): Fix the problem that psiginfo() changes the orientation of stderr to byte-oriented mode if stderr is not oriented yet.
2018-06-30Introduce @unless/@endunless and postbootstrap Makefile targetsAlexandre Oliva4-166/+135
This patch turns dependencies of non-bootstrap targets on bootstrap targets for bootstrap builds into dependencies on stage_last. This arrangement gets stage1-bubble to run from stage_last if we haven't started a bootstrap yet, and to use the current stage otherwise. This was already the case of target libs, just not of non-bootstrapped host modules. In order to retain preexisting dependencies in non-bootstrap builds, or in gcc-less builds, this introduces support for @unless/@endunless pairs in Makefile.in. There is a remaining possibility of problem if activating, in a tree configured for bootstrap, a parallel build of two or more modules, at least one bootstrapped and one not. In this case, make might decide to build stage_current and stage_last in parallel, the latter will start a submake to build stage1 while the initial make, having satisfied stage_current, proceeds to build the bootstrapped module in non-bootstrapped configurations. The two builds will overlap and will likely conflict. This situation does NOT arise in normal settings, however: a post-bootstrap build of all-host all-target will indeed activate such targets concurrently, but only after building all bootstrapped modules successfully, and it will have both stage_last and stage_current targets already satisfied, so the potential race between builds will not arise. Another remaining problem, that is slightly expanded with this patch, is that of an interrupted build in a tree configured for bootstrap, continued with a non-bootstrapped target. Target modules that were not bootstrapped would already fail to complete the current stage when activated explicitly in the command line for a retry; host modules, however, would attempt to build their bootstrapped dependencies, which is what led to the problem of concurrent builds addressed with this patch. An interrupted or failed build might still recover correctly, if the non-bootstrapped target is activated in both builds, because then make will remove stage_last when its build command is interrupted, so that it will attempt to recreate it with stage1-bubble in the second try. A bootstrap build, however, will not be attempting to build stage_last, so the file will remain and the retry won't go through stage1-bubble. We have lived with that for target modules, so we can probably live with that for host modules too. Another undesirable consequence of this change is that non-boostrapped host modules, in a tree configured for bootstrap, when activated as make all-<module>, will build all of stage1 instead of only the module's usual dependencies. This is intentional and necessary to fix the parallel-build problem. If it's not desirable, disabling the unnecessary bootstrap configuration will suffice to restore the original set of dependencies. for ChangeLog * configure.ac: Introduce support for @unless/@endunless. * Makefile.tpl (dep-kind): Rewrite with cond; return postbootstrap in some cases. (make-postboot-dep, postboot-targets): New. (dependencies): Do not output postbootstrap dependencies at first. Output non-target ones changed for configure to depend on stage_last @if gcc-bootstrap, and the original deps @unless gcc-bootstrap. * configure.in, Makefile.in: Rebuilt.
2018-06-30Add OBJCOPY to Makefile.tpl too, to keep it on Makefile.in rebuildAlexandre Oliva1-0/+1
for ChangeLog * Makefile.tpl (OBJCOPY): Add it. * Makefile.in: Rebuilt, unchanged.
2018-06-29Cygwin: tape: Handle non-standard "no medium" error codeCorinna Vinschen2-5/+26
Certain tape drives (known example: QUANTUM_ULTRIUM-HH6) return the non-standard ERROR_NOT_READY rather than ERROR_NO_MEDIA_IN_DRIVE if no media is present. ERROR_NOT_READY is not documented as valid return code from GetTapeStatus. Without handling this error code Cygwin's tape code can't report an offline state to user space. Fix this by converting ERROR_NOT_READY to ERROR_NO_MEDIA_IN_DRIVE where appropriate. Add a debug_printf to mtinfo_drive::get_status to allow requesting user info without having to rebuild the DLL. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-27Cygwin: define pthread_tryjoin_np/pthread_timedjoin_np _GNU_VISIBLECorinna Vinschen1-2/+2
These functions are GNU extensions. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-27Cygwin: doc: add pthread_tryjoin_np, pthread_timedjoin_npCorinna Vinschen2-1/+3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-27Cygwin: pthread_timedjoin_np: return ETIMEDOUT, not EBUSYCorinna Vinschen1-2/+2
pthread_timedjoin_np returns ETIMEDOUT if a thread is still running, not EBUSY as pthread_tryjoin_np. Also, clean up initializing timeout in pthread_tryjoin_np. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-27Cygwin: Implement pthread_tryjoin_np and pthread_timedjoin_npCorinna Vinschen7-11/+42
- Move pthread_join to thread.cc to have all `join' calls in the same file (pthread_timedjoin_np needs pthread_convert_abstime which is static inline in thread.cc) - Bump API version Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-27newlib: enable new math functions on CygwinCorinna Vinschen1-0/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-27New pow implementationSzabolcs Nagy8-5/+607
The new implementation is provided under !__OBSOLETE_MATH, it uses ISO C99 code. With default settings the worst case error in nearest rounding mode is 0.54 ULP with inlined fma and fma contraction. It uses a 4 KB lookup table in addition to the table in exp_data.c, on aarch64 .text+.rodata size of libm.a is increased by 2295 bytes. Improvements on Cortex-A72: latency: 3.3x thruput: 4.9x
2018-06-27New log2 implementationSzabolcs Nagy6-4/+399
The new implementation is provided under !__OBSOLETE_MATH, it uses ISO C99 code. With default settings the worst case error in nearest rounding mode is 0.547 ULP with inlined fma and fma contraction. It uses a 1 KB lookup table, on aarch64 .text+.rodata size of libm.a is increased by 1584 bytes. Note that the math.h header defines log2(x) to be log(x)/Ln2, this is not changed, so the new code is only used if that macro is suppressed. Improvements on Cortex-A72: latency: 2.0x thruput: 2.2x
2018-06-27New log implementationSzabolcs Nagy9-4/+744
The new implementations are provided under !__OBSOLETE_MATH, it uses ISO C99 code. With default settings the worst case error in nearest rounding mode is 0.519 ULP with inlined fma and fma contraction. It uses a 2 KB lookup table, on aarch64 .text+.rodata size of libm.a is increased by 1703 bytes. The w_log.c wrapper is disabled since error handling is inline in the new code. New __HAVE_FAST_FMA and __HAVE_FAST_FMA_DEFAULT feature macros were added to enable selecting between the code path that uses fma and the one that does not. Targets supposed to set __HAVE_FAST_FMA_DEFAULT if they have single instruction fma and the compiler can actually inline it (gcc has __FP_FAST_FMA macro but that does not guarantee inlining with -fno-builtin-fma). Improvements on Cortex-A72: latency: 1.9x thruput: 2.3x
2018-06-27New exp and exp2 implementationsSzabolcs Nagy11-5/+1138
The new implementations are provided under !__OBSOLETE_MATH, they use ISO C99 code. There are several settings, with the default one the worst case error in nearest rounding mode is 0.509 ULP for exp and 0.507 ULP for exp2 when a multiply and add is contracted into an fma. They use a shared 2 KB lookup table, on aarch64 .text+.rodata size of libm.a is increased by 1868 bytes. The w_*.c wrappers are disabled for the new code as it takes care of error handling inline. The old exp2(x) code used to be just pow(2,x) so the speedup there is more significant. The file name has no special prefix to avoid any name collision with existing files. Improvements on Cortex-A72: exp latency: 3.2x exp thruput: 4.1x exp2 latency: 7.8x exp2 thruput: 18.8x
2018-06-27Use uint32_t sign argument to math error functionsSzabolcs Nagy3-13/+13
This change is equivalent to the commit https://github.com/ARM-software/optimized-routines/commit/c65db17340782d647c49e17cbba244862dc38402 and only affects code that is from the Arm optimized-routines project. It does not affect the observable behaviour, but the code generation can be different on 64bit targets. The intention is to make the portable semantics of the code obvious by using a fixed size type.
2018-06-26Cygwin: fix bumptious GCC 7 warningsCorinna Vinschen2-3/+9
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26Cygwin: Allow to build without experimental AF_UNIX code by defaultCorinna Vinschen8-1/+36
Introduce __WITH_AF_UNIX preprocessor flag to enable the new code Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26Cygwin: add Unicode patch to release notesCorinna Vinschen1-0/+3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26Fix Unicode table.Takashi Yano2-26/+16
* (mkcategories): Fix a bug that outputs incorrect Unicode category table for code point ranges. * (categories.t): Rebuild it using the bug-fixed mkcategories. This fixes the problem reported in the following post. https://cygwin.com/ml/cygwin/2018-06/msg00248.html
2018-06-26Revert "Remove -fno-builtin to allow gcc to inline functions such as fabs, ↵Corinna Vinschen8-8/+8
floor, creal, imag." This reverts commit c077b9de99c6980a0c1631ec2938f6ff2cf0c289. Yet another accidental commit...
2018-06-26Cygwin: exceptions: fix FPE exception flagsCorinna Vinschen2-1/+10
The FPE flags for divisions by zero were not implemented Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26Cygwin: signal.h: improve exception flags definitionCorinna Vinschen1-5/+39
- add numbers for readability - add a preprocessor macro for each flag Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-25Remove -fno-builtin to allow gcc to inline functions such as fabs, floor, ↵Jon Beniston8-8/+8
creal, imag.
2018-06-22Fix the handling of out-of-band (OOB) data in a socket.Takashi Yano3-9/+120
* fhandler.h (class fhandler_socket_inet): Add variable bool oobinline. * fhandler_socket_inet.cc (fhandler_socket_inet::fhandler_socket_inet): Initialize variable oobinline. (fhandler_socket_inet::recv_internal): Make the handling of OOB data as consistent with POSIX as possible. Add simulation of inline mode for OOB data as a workaround for broken winsock behavior. (fhandler_socket_inet::setsockopt): Ditto. (fhandler_socket_inet::getsockopt): Ditto. (fhandler_socket_wsock::ioctl): Fix return value of SIOCATMARK command. The return value of SIOCATMARK of winsock is almost opposite to expectation. * fhandler_socket_local.cc (fhandler_socket_local::recv_internal): Remove the handling of OOB data from AF_LOCAL domain socket. Operation related to OOB data will result in an error like Linux does. (fhandler_socket_local::sendto): Ditto. (fhandler_socket_local::sendmsg): Ditto. This fixes the issue reported in following post. https://cygwin.com/ml/cygwin/2018-06/msg00143.html