]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
6 years agoRTEMS: Add set/get name <sys/lock.h> functions
Sebastian Huber [Tue, 28 Nov 2017 06:57:51 +0000 (07:57 +0100)]
RTEMS: Add set/get name <sys/lock.h> functions

Add inline functions to set/get the name.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agocygwin: create libssp compatibility import library
Yaakov Selkowitz [Tue, 28 Nov 2017 05:56:30 +0000 (23:56 -0600)]
cygwin: create libssp compatibility import library

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agocygwin: export SSP functions
Yaakov Selkowitz [Tue, 28 Nov 2017 05:55:11 +0000 (23:55 -0600)]
cygwin: export SSP functions

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agossp: add build infrastructure
Yaakov Selkowitz [Tue, 28 Nov 2017 05:54:09 +0000 (23:54 -0600)]
ssp: add build infrastructure

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agossp: add documentation
Yaakov Selkowitz [Wed, 29 Nov 2017 00:11:59 +0000 (18:11 -0600)]
ssp: add documentation

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agossp: add Object Size Checking for unistd.h, part 1
Yaakov Selkowitz [Tue, 28 Nov 2017 05:49:18 +0000 (23:49 -0600)]
ssp: add Object Size Checking for unistd.h, part 1

The implementation is from NetBSD, with the addition of feature test macros
for readlink.  glibc also wraps the following functions:
confstr, getdomainname, getgroups, gethostname, getlogin_r, getwd, pread,
readlinkat, ttyname_r.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agossp: add Object Size Checking for stdio.h, part 1
Yaakov Selkowitz [Tue, 28 Nov 2017 05:24:16 +0000 (23:24 -0600)]
ssp: add Object Size Checking for stdio.h, part 1

The implementation is mostly from NetBSD, except for switching fgets to
pure inline, and the addition of fgets_unlocked, fread, and fread_unlocked
for parity with glibc.  The following functions are also guarded in glibc:
asprintf, dprintf, fprintf, printf, vasprintf, vdprintf, vfprintf, vprintf.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agossp: add Object Size Checking for strings.h
Yaakov Selkowitz [Tue, 28 Nov 2017 05:21:35 +0000 (23:21 -0600)]
ssp: add Object Size Checking for strings.h

The implementation is from NetBSD, with the addition of explicit_bzero
for parity with glibc.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agossp: add Object Size Checking for string.h
Yaakov Selkowitz [Tue, 28 Nov 2017 05:14:15 +0000 (23:14 -0600)]
ssp: add Object Size Checking for string.h

The implementation is from NetBSD, with the addition of mempcpy (a GNU
extension) for parity with glibc and libssp.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agossp: add Object Size Checking common code
Yaakov Selkowitz [Tue, 28 Nov 2017 05:07:10 +0000 (23:07 -0600)]
ssp: add Object Size Checking common code

The Object Size Checking (-D_FORTIFY_SOURCE=*) functionality provides
wrappers around functions suspectible to buffer overflows.  While
independent from Stack Smashing Protection (-fstack-protector*), they
are often used and implemented together.

While GCC also provides an implementation in libssp, it is completely
broken (CVE-2016-4973, RHBZ#1324759) and seemingly unfixable, as there
is no reliable way for a preprocessor macro to trigger a link flag.
Therefore, adding this here is necessary to make it work.

Note that this does require building gcc with --disable-libssp and
gcc_cv_libc_provides_ssp=yes.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agossp: add APIs for Stack Smashing Protection
Yaakov Selkowitz [Tue, 28 Nov 2017 05:04:09 +0000 (23:04 -0600)]
ssp: add APIs for Stack Smashing Protection

Compiling with any of the -fstack-protector* flags requires the
__stack_chk_guard data import (which needs to be initialized) and the
__stack_chk_fail{,_local} functions.  While GCC's own libssp can provide
these, it is better that we provide these ourselves.  The implementation
is custom due to being OS-specific.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agonewlib: [w]scanf: Fix behaviour on matching failure
Corinna Vinschen [Wed, 29 Nov 2017 14:01:30 +0000 (15:01 +0100)]
newlib: [w]scanf: Fix behaviour on matching failure

The special handling of %\0 in [w]scanf is flawed.  It's just a
matching failure and should be handled as such.  scanf also
fakes an int input value on %X with X being an invalid conversion
char.  This is also just a matching failure and should be handled
the same way as %\0.

There's no indication of the reason for this "disgusting
backwards compatibility hacks" in the logs, given this
code made it into newlib before setting up the CVS repo.

Just handle these cases identically as matching failures.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygserver: remove all asserts on "this"
Corinna Vinschen [Tue, 28 Nov 2017 18:08:04 +0000 (19:08 +0100)]
cygserver: remove all asserts on "this"

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: fix getconf after commit 032aa2dba5a5bf90c198d930c8d309b5de57cb47
Yaakov Selkowitz [Tue, 28 Nov 2017 17:35:13 +0000 (11:35 -0600)]
cygwin: fix getconf after commit 032aa2dba5a5bf90c198d930c8d309b5de57cb47

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agoMake __nonnull macro compatible with glibc
Yaakov Selkowitz [Tue, 28 Nov 2017 10:21:16 +0000 (04:21 -0600)]
Make __nonnull macro compatible with glibc

This form allows for multiple arguments, e.g. __nonnull((1,2)).

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agocygwin: define _POSIX_TIMEOUTS
Yaakov Selkowitz [Tue, 28 Nov 2017 10:03:29 +0000 (04:03 -0600)]
cygwin: define _POSIX_TIMEOUTS

Since commit 8128f5482f2b1889e2336488e9d45a33c9972d11, we have all the
non-tracing functions listed in posixoptions(7).  The tracing functions
are gated by their own option, and are obsolecent anyway.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agocygwin: don't allow empty strings in __ASMNAME tags
Corinna Vinschen [Tue, 28 Nov 2017 12:31:20 +0000 (13:31 +0100)]
cygwin: don't allow empty strings in __ASMNAME tags

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: improve _EXFUN tags generation
Corinna Vinschen [Tue, 28 Nov 2017 12:26:37 +0000 (13:26 +0100)]
cygwin: improve _EXFUN tags generation

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: remove accidentally committed debug statments
Corinna Vinschen [Tue, 28 Nov 2017 12:12:07 +0000 (13:12 +0100)]
cygwin: remove accidentally committed debug statments

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: further improve tags generation
Corinna Vinschen [Tue, 28 Nov 2017 12:10:34 +0000 (13:10 +0100)]
cygwin: further improve tags generation

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoFeature test macros overhaul: Cygwin limits.h, part 2
Yaakov Selkowitz [Tue, 28 Nov 2017 04:07:13 +0000 (22:07 -0600)]
Feature test macros overhaul: Cygwin limits.h, part 2

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
https://sourceware.org/ml/newlib/2017/msg01133.html

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agocygwin: convert most #ifndef __x86_64__ to #ifdef __i386__
Corinna Vinschen [Mon, 27 Nov 2017 13:36:06 +0000 (14:36 +0100)]
cygwin: convert most #ifndef __x86_64__ to #ifdef __i386__

Address the real offender

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: improve tags generation
Corinna Vinschen [Mon, 27 Nov 2017 12:38:43 +0000 (13:38 +0100)]
cygwin: improve tags generation

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: cleanup fhandler_socket::release_events
Corinna Vinschen [Mon, 27 Nov 2017 12:38:21 +0000 (13:38 +0100)]
cygwin: cleanup fhandler_socket::release_events

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoAdd the Aarch64 SVE specific HWCAP_SVE define
Jeff Johnston [Wed, 22 Nov 2017 19:08:08 +0000 (14:08 -0500)]
Add the Aarch64 SVE specific HWCAP_SVE define

Checking in change from Alan Hayward <Alan.Hayward@arm.com>

Signed-off-by: Jeff Johnston <jjohnstn@redhat.com>
6 years agoRTEMS: Add missing __getreent() to crt0
Sebastian Huber [Mon, 20 Nov 2017 09:10:40 +0000 (10:10 +0100)]
RTEMS: Add missing __getreent() to crt0

Default implementation was removed for RTEMS by
b1a388799dc98e6d1451fb73aa71097cbf9f37d9.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoRTEMS: Add missing functions to crt0
Sebastian Huber [Mon, 20 Nov 2017 07:52:09 +0000 (08:52 +0100)]
RTEMS: Add missing functions to crt0

This helps to get some more features from libstdc++.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoCygwin: pipe_data_available: cleanup code
Corinna Vinschen [Wed, 15 Nov 2017 19:11:05 +0000 (20:11 +0100)]
Cygwin: pipe_data_available: cleanup code

* Don't use a bool var to store three states (-1, 0, 1).
* Correctly check for NT_SUCCESS of a function returning NTSTATUS.
* Straighten out code for better readability.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: Add FAQ How do I fix find_fast_cwd warnings?
Brian Inglis [Wed, 15 Nov 2017 06:01:42 +0000 (23:01 -0700)]
Cygwin: Add FAQ How do I fix find_fast_cwd warnings?

6 years agoCygwin: open: Remove unused code to handle HIDDEN and SYSTEM files
Corinna Vinschen [Tue, 14 Nov 2017 20:50:32 +0000 (21:50 +0100)]
Cygwin: open: Remove unused code to handle HIDDEN and SYSTEM files

Commit 603ef545bdbdbf7495e1a0bbabffb8741fc2a5bb broke this snippet and
commit 5b312b4747cc4acda39c187369c02fcea456513b didn't help at all since
FILE_CREATE is exactly *not* the situation the test was originally
supposed to handle.

In fact, none of the open flags used by fhandler_base::open actually
hits this problem anymore, so just drop the code.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: link: Simplify an expression
Corinna Vinschen [Tue, 14 Nov 2017 20:29:08 +0000 (21:29 +0100)]
Cygwin: link: Simplify an expression

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: Bump DLL version to 2.10.0, bump API minor to 319
Corinna Vinschen [Tue, 14 Nov 2017 20:36:38 +0000 (21:36 +0100)]
Cygwin: Bump DLL version to 2.10.0, bump API minor to 319

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fcntl.h: Use test macros to guard non-standard open flags
Corinna Vinschen [Tue, 14 Nov 2017 20:31:31 +0000 (21:31 +0100)]
Cygwin: fcntl.h: Use test macros to guard non-standard open flags

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fcntl.h: Define O_NOATIME
Corinna Vinschen [Tue, 14 Nov 2017 20:29:37 +0000 (21:29 +0100)]
Cygwin: fcntl.h: Define O_NOATIME

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fcntl.h: Define O_TMPFILE and implement it
Corinna Vinschen [Tue, 14 Nov 2017 20:28:45 +0000 (21:28 +0100)]
Cygwin: fcntl.h: Define O_TMPFILE and implement it

Difference to Linux: We can't create files which don't show up
in the filesystem due to OS restrictions.  As a kludge, make a
(half-hearted) attempt to hide the file in the filesystem.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: open: cleanup code in preparation of O_TMPFILE
Corinna Vinschen [Tue, 14 Nov 2017 15:28:44 +0000 (16:28 +0100)]
Cygwin: open: cleanup code in preparation of O_TMPFILE

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agonewlib/libc/stdlib/realloc.c: fix variable name
Florian Schmidt [Tue, 14 Nov 2017 08:01:14 +0000 (09:01 +0100)]
newlib/libc/stdlib/realloc.c: fix variable name

The variable doesn't follow the convention of having the same name as
the function it's bundled with. Furthermore, it clashes with the
variable of the same name in newlib/libc/stdlib/calloc.c.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
6 years agonewlib/.../getreent.c: Allow to be provided by host and do so for RTEMS
Joel Sherrill [Wed, 11 Oct 2017 12:57:44 +0000 (07:57 -0500)]
newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS

RTEMS provides the option to have a global or per-thread reentrancy
as part of application configuration. As part of this, RTEMS provides
the implementation of __getreent() as appropriate. Allow the target
to determine if this method is present in libc.a.

6 years agocygwin: pread: Remove incorrect comment
Corinna Vinschen [Wed, 8 Nov 2017 12:36:34 +0000 (13:36 +0100)]
cygwin: pread: Remove incorrect comment

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: fhandler_disk_file::pread: always print debug info on return
Corinna Vinschen [Wed, 8 Nov 2017 12:30:42 +0000 (13:30 +0100)]
cygwin: fhandler_disk_file::pread: always print debug info on return

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: pread() returns non-zero if read beyond EOF
Xiaofeng Liu [Wed, 8 Nov 2017 12:21:30 +0000 (13:21 +0100)]
cygwin: pread() returns non-zero if read beyond EOF

NtReadFile returns EOF status but doesn't set information to 0.
Set return value explicitly on EOF.

6 years agocygwin: fix stray semicolon
Corinna Vinschen [Tue, 7 Nov 2017 15:34:17 +0000 (16:34 +0100)]
cygwin: fix stray semicolon

introduced by patch 1c50e0d1abd5cc790e72572af6fd6b03f7d1c594

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: add socket bugfix to release notes
Corinna Vinschen [Tue, 7 Nov 2017 15:11:08 +0000 (16:11 +0100)]
cygwin: add socket bugfix to release notes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoFix two bugs in the limit of large numbers of sockets:
Erik M. Bray [Tue, 7 Nov 2017 13:44:49 +0000 (14:44 +0100)]
Fix two bugs in the limit of large numbers of sockets:

* Fix the maximum number of sockets allowed in the session to 2048,
  instead of making it relative to sizeof(wsa_event).

  The original choice of 2048 was in order to fit the wsa_events array
  in the .cygwin_dll_common shared section, but there is still enough
  room to grow there to have 2048 sockets on 64-bit as well.

* Return an error and set errno=ENOBUF if a socket can't be created
  due to this limit being reached.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoMake ffsl() and ffsll() BSD-visible
Sebastian Huber [Fri, 29 Sep 2017 05:29:03 +0000 (07:29 +0200)]
Make ffsl() and ffsll() BSD-visible

Since glibc 2.27, they are visible via _DEFAULT_SOURCE (__USE_MISC):

https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man3/ffs.3?id=247bbcf00c9a425ab0ad6e303ec8718e4ba844a6

In FreeBSD, they are guarded by __BSD_VISIBLE.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agocygwin: ftruncate64: add missing braces
Corinna Vinschen [Thu, 2 Nov 2017 18:13:09 +0000 (19:13 +0100)]
cygwin: ftruncate64: add missing braces

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: add 2.9.1 release messages file
Corinna Vinschen [Thu, 2 Nov 2017 17:09:39 +0000 (18:09 +0100)]
cygwin: add 2.9.1 release messages file

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoposix_fallocate() *returns* error codes but does not set errno
Erik M. Bray [Thu, 2 Nov 2017 15:45:35 +0000 (16:45 +0100)]
posix_fallocate() *returns* error codes but does not set errno

Also updates the fhandler_*::ftruncate implementations to adhere to the same
semantics.  The error handling semantics of those syscalls that use
fhandler_*::ftruncate are moved to the implementations of those syscalls (
in particular ftruncate() and friends still set errno and return -1 on error
but that logic is handled in the syscall implementation).

6 years agoposix_fadvise() *returns* error codes but does not set errno
Erik M. Bray [Thu, 2 Nov 2017 15:45:34 +0000 (16:45 +0100)]
posix_fadvise() *returns* error codes but does not set errno

Also updates the fhandler_*::fadvise implementations to adhere to the same
semantics.

6 years agonewlib/configure.host: Remove obsolete definition of _I386MACH_ALLOW_HW_INTERRUPTS
Joel Sherrill [Fri, 27 Oct 2017 21:32:39 +0000 (16:32 -0500)]
newlib/configure.host: Remove obsolete definition of _I386MACH_ALLOW_HW_INTERRUPTS

The *-*-rtems* targets defined this even though the conditional
was no longer present in i386/setjmp.S.

6 years agoRTEMS: Remove internal timecounter API
Sebastian Huber [Tue, 24 Oct 2017 09:16:22 +0000 (11:16 +0200)]
RTEMS: Remove internal timecounter API

Change copyright.  Original BSD content moved to
<machine/_kernel_time.h>.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agowinsup/utils/dump_setup.cc: Remove the function 'base'
Ken Brown [Tue, 24 Oct 2017 22:21:53 +0000 (18:21 -0400)]
winsup/utils/dump_setup.cc: Remove the function 'base'

This was called only on filenames in /etc/setup/installed.db, which
are all basenames anyway.  Moreover, base wasn't correctly handling
filenames containing colons.

6 years agoFixed semihosting for AArch64 when heapinfo parameters are not provided by debugger
Alexander Fedotov [Wed, 11 Oct 2017 11:52:20 +0000 (14:52 +0300)]
Fixed semihosting for AArch64 when heapinfo parameters are not provided by debugger

6 years agofix internal __ieee754_expf and __ieee754_logf calls
Szabolcs Nagy [Tue, 17 Oct 2017 11:41:20 +0000 (12:41 +0100)]
fix internal __ieee754_expf and __ieee754_logf calls

The recently added new math code inlines error handling instead of using
error handling wrappers around __ieee754* internal symbols, and thus the
__ieee754* symbols are no longer provided.

However __ieee754_expf and __ieee754_logf are used in the implementation
of a number of other math functions.  These symbols are safe to redirect
to the external expf and logf symbols, because those names are always
reserved when single precision math functions are reserved and the
additional error handling code is either not reached or there will be
an error in the final result that will override an internal spurious
errno setting.

For consistency all of __ieee754_expf, __ieee754_logf and __ieee754_powf
are redirected using a macro.

6 years agocygwin: belatedly bump DLL minor version
Corinna Vinschen [Wed, 18 Oct 2017 14:40:56 +0000 (16:40 +0200)]
cygwin: belatedly bump DLL minor version

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: unlink: workaround NFS non-ability to move file in certain cases
Corinna Vinschen [Wed, 18 Oct 2017 14:27:17 +0000 (16:27 +0200)]
cygwin: unlink: workaround NFS non-ability to move file in certain cases

Under some not quite clear conditions, NFS fails to use its
unlink workaround to rename a file to ".nfsXYZ".  The problem has been
reproduced with the GAWK testext.awk testcase.  To workaround this in
Cygwin, we now call try_to_bin on NFS, too.  For some reason NFS doesn't
fail to rename the .cygXYZ file to .nfsXYZ after this Cygwin rename.
Fix comment in unlink_nt accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: unlink: don't try "final trick" in try_to_bin on NFS
Corinna Vinschen [Wed, 18 Oct 2017 14:22:14 +0000 (16:22 +0200)]
cygwin: unlink: don't try "final trick" in try_to_bin on NFS

Doesn't work.  Just another STATUS_SHARING_VIOLATION.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: unlink: fix "final trick" overwrite method on remote drives
Corinna Vinschen [Wed, 18 Oct 2017 14:21:12 +0000 (16:21 +0200)]
cygwin: unlink: fix "final trick" overwrite method on remote drives

The "final trick" code in try_to_bin accidentally never worked on
remote drives because it relies on rootdir.  Which isn't set for
remote unlinks.  The code now creates a full path for remote files.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: unlink: improve debug messages in try_to_bin
Corinna Vinschen [Wed, 18 Oct 2017 14:18:12 +0000 (16:18 +0200)]
cygwin: unlink: improve debug messages in try_to_bin

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: unlink: simplify rootdir handling
Corinna Vinschen [Wed, 18 Oct 2017 14:15:08 +0000 (16:15 +0200)]
cygwin: unlink: simplify rootdir handling

In try_to_bin, rootdir is NULL for remote drives anyway.  No extra
check required.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: unlink: drop redundant check for netapp FS
Corinna Vinschen [Wed, 18 Oct 2017 14:13:48 +0000 (16:13 +0200)]
cygwin: unlink: drop redundant check for netapp FS

The try_to_bin function isn't called for netapp FSes anyway, so testing
for this FS type in the function is moot.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: unlink: Fix typos in comments
Corinna Vinschen [Wed, 18 Oct 2017 14:12:42 +0000 (16:12 +0200)]
cygwin: unlink: Fix typos in comments

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoNew expf, exp2f, logf, log2f and powf implementations
Szabolcs Nagy [Thu, 25 May 2017 15:41:38 +0000 (16:41 +0100)]
New expf, exp2f, logf, log2f and powf implementations

Based on code from https://github.com/ARM-software/optimized-routines/

This patch adds a highly optimized generic implementation of expf,
exp2f, logf, log2f and powf.  The new functions are not only
faster (6x for powf!), but are also smaller and more accurate.
In order to achieve this, the algorithm uses double precision
arithmetic for accuracy, avoids divisions and uses small table
lookups to minimize the polynomials.  Special cases are handled
inline to avoid the unnecessary overhead of wrapper functions and
set errno to POSIX requirements.

The new functions are added under newlib/libm/common, but the old
implementations are kept (in newlib/libm/math) for non-IEEE or
pre-C99 systems.  Targets can enable the new math code by defining
__OBSOLETE_MATH_DEFAULT to 0 in newlib/libc/include/machine/ieeefp.h,
users can override the default by defining __OBSOLETE_MATH.
Currently the new code is enabled for AArch64 and AArch32 with VFP.
Targets with a single precision FPU may still prefer the old
implementation.

libm.a size changes:
arm: -1692
arm/thumb/v7-a/nofp: -878
arm/thumb/v7-a+fp/hard: -864
arm/thumb/v7-a+fp/softfp: -908
aarch64: -1476

6 years agoRTEMS: Fix _PTHREAD_MUTEX_INITIALIZER
Sebastian Huber [Fri, 13 Oct 2017 06:06:19 +0000 (08:06 +0200)]
RTEMS: Fix _PTHREAD_MUTEX_INITIALIZER

Add missing braces around initializer.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agocygwin: fix gethostbyaddr argument types
Yaakov Selkowitz [Wed, 27 Sep 2017 01:36:35 +0000 (20:36 -0500)]
cygwin: fix gethostbyaddr argument types

The first argument of gethostbyaddr needs to accept a generic pointer
to be compatible with e.g. struct in_addr *.  This caused an issue
compiling krb5-1.15.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agoFeature test macros overhaul: Cygwin netdb.h
Yaakov Selkowitz [Wed, 27 Sep 2017 01:36:34 +0000 (20:36 -0500)]
Feature test macros overhaul: Cygwin netdb.h

herror etc. are MISC, rcmd etc. are BSD, addrinfo functions are
POSIX.1-2001, except for IDN functionality which is GNU.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agocygwin: fix potential buffer overflow in fork
Michael Haubenwallner [Mon, 9 Oct 2017 16:58:24 +0000 (18:58 +0200)]
cygwin: fix potential buffer overflow in fork

When fork fails, we can use "%s" now with system_sprintf for the errmsg
rather than a (potentially too small) buffer for the format string.

* fork.cc (fork): Use "%s" with system_printf now.

6 years agocygwin: fix potential buffer overflow in small_sprintf
Michael Haubenwallner [Mon, 9 Oct 2017 16:57:58 +0000 (18:57 +0200)]
cygwin: fix potential buffer overflow in small_sprintf

With "%C" format string, argument may convert in up to MB_LEN_MAX bytes.
Relying on sys_wcstombs to add a trailing zero here requires us to
provide a large enough buffer.

* smallprint.c (__small_vsprintf): Use MB_LEN_MAX+1 bufsize for "%C".

6 years agoFix multido compilation on ARM
Tamar Christina [Tue, 26 Sep 2017 13:47:04 +0000 (14:47 +0100)]
Fix multido compilation on ARM

The previous multi-build implementation was copying the config.status from the parent
multilib directory when building the different semihosting variants. It did so because
the configuration doesn't change. However when you use a relative path to configure it
turns out that the paths inside the config.status are also relative.

To fix this, the srcdir is adjusted from the initial configuration instead of copying it.

Tested on aarch64-none-elf and arm-none-eabi.

Signed-off-by: Tamar Christina <tamar.christina@arm.com>
6 years agocygwin: initialize variable for stack unwinding
Michael Haubenwallner [Mon, 9 Oct 2017 15:37:40 +0000 (17:37 +0200)]
cygwin: initialize variable for stack unwinding

The third argument of RtlLookupFunctionEntry actually is documented as
_Inout_opt_ for both x64 and ARM, although generic doc says _Out_ only.

* exceptions.cc (__unwind_single_frame): Initialize hist variable.

6 years agocygwin: disable -Wframe-address warning only on GCC 6 or later
Corinna Vinschen [Mon, 9 Oct 2017 16:08:10 +0000 (18:08 +0200)]
cygwin: disable -Wframe-address warning only on GCC 6 or later

This is required as long as we don't have a GCC 6.x cross compiler
on Linux.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoFix typo with newlib-long-time_t default value.
Michael Haubenwallner [Tue, 26 Sep 2017 08:38:12 +0000 (10:38 +0200)]
Fix typo with newlib-long-time_t default value.

Fix typo for newlib-long-time_t to leave newlib-nano-malloc alone.

6 years agoadjust libnosys config for aarch64 to avoid linker error when switching from rdimon...
Alexander Fedotov [Fri, 29 Sep 2017 19:10:47 +0000 (22:10 +0300)]
adjust libnosys config for aarch64 to avoid linker error when switching from rdimon.specs to nosys.specs

6 years agocygwin: Remove workaround for GCC 6 null pointer check warnings
Ken Brown [Sun, 17 Sep 2017 02:04:20 +0000 (22:04 -0400)]
cygwin: Remove workaround for GCC 6 null pointer check warnings

6 years agocygwin: Remove comparison of 'this' to NULL in _pinfo::exists
Ken Brown [Sun, 17 Sep 2017 02:04:19 +0000 (22:04 -0400)]
cygwin: Remove comparison of 'this' to NULL in _pinfo::exists

Fix all callers.

6 years agocygwin: Remove comparison of 'this' to 'NULL' in _pinfo::kill
Ken Brown [Sun, 17 Sep 2017 02:04:18 +0000 (22:04 -0400)]
cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::kill

Fix all callers.

6 years agocygwin: Remove comparison of 'this' to 'NULL' in _pinfo::environ
Ken Brown [Sun, 17 Sep 2017 02:04:17 +0000 (22:04 -0400)]
cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::environ

Fix all callers.

6 years agocygwin: Remove comparison of 'this' to 'NULL' in _pinfo::fd
Ken Brown [Sun, 17 Sep 2017 02:04:16 +0000 (22:04 -0400)]
cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::fd

Fix all callers.

6 years agocygwin: Remove comparison of 'this' to 'NULL' in _pinfo::pipe_fhandler
Ken Brown [Sun, 17 Sep 2017 02:04:15 +0000 (22:04 -0400)]
cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::pipe_fhandler

Fix all callers.

6 years agocygwin: Remove comparison of 'this' to 'NULL' in _pinfo::commune_request
Ken Brown [Sun, 17 Sep 2017 02:04:14 +0000 (22:04 -0400)]
cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::commune_request

Fix all callers.

6 years agocygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cmdline
Ken Brown [Sun, 17 Sep 2017 02:04:13 +0000 (22:04 -0400)]
cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cmdline

Fix all callers.

6 years agocygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cwd
Ken Brown [Sun, 17 Sep 2017 02:04:12 +0000 (22:04 -0400)]
cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cwd

Fix all callers.

6 years agocygwin: Remove comparison of 'this' to 'NULL' in _pinfo::root
Ken Brown [Sun, 17 Sep 2017 02:04:11 +0000 (22:04 -0400)]
cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::root

Fix all callers.

6 years agocygwin: Remove comparison of 'this' to 'NULL' in _pinfo::fds
Ken Brown [Sun, 17 Sep 2017 02:04:10 +0000 (22:04 -0400)]
cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::fds

Fix all callers.

6 years agocygwin: Remove comparisons of 'this' to 'NULL' in fhandler_dsp.cc
Ken Brown [Sun, 17 Sep 2017 02:04:09 +0000 (22:04 -0400)]
cygwin: Remove comparisons of 'this' to 'NULL' in fhandler_dsp.cc

Fix all callers.

6 years agoRTEMS: Make pthread_mutex_t self-contained
Sebastian Huber [Wed, 27 Sep 2017 12:20:14 +0000 (14:20 +0200)]
RTEMS: Make pthread_mutex_t self-contained

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoRTEMS: Make pthread_cond_t self-contained
Sebastian Huber [Tue, 26 Sep 2017 05:36:25 +0000 (07:36 +0200)]
RTEMS: Make pthread_cond_t self-contained

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoRTEMS: Make pthread_rwlock_t self-contained
Sebastian Huber [Thu, 21 Sep 2017 13:41:30 +0000 (15:41 +0200)]
RTEMS: Make pthread_rwlock_t self-contained

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoRTEMS: Make pthread_barrier_t self-contained
Sebastian Huber [Thu, 21 Sep 2017 13:21:13 +0000 (15:21 +0200)]
RTEMS: Make pthread_barrier_t self-contained

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoRTEMS: Make sem_t self-contained
Sebastian Huber [Wed, 13 Sep 2017 11:07:31 +0000 (13:07 +0200)]
RTEMS: Make sem_t self-contained

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoRTEMS: Optimize pthread_once_t
Sebastian Huber [Tue, 19 Sep 2017 13:08:35 +0000 (15:08 +0200)]
RTEMS: Optimize pthread_once_t

Reduce size of pthread_once_t and make it zero-initialized.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agonewlib/libm/complex/cargl.c change imag() real() to cimagl() creall() newlib-snapshot-20170922
Brian Inglis [Wed, 13 Sep 2017 06:26:48 +0000 (00:26 -0600)]
newlib/libm/complex/cargl.c change imag() real() to cimagl() creall()

6 years agoFix warnings and documentation in strnstr.c
Sebastian Huber [Wed, 13 Sep 2017 12:31:01 +0000 (14:31 +0200)]
Fix warnings and documentation in strnstr.c

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agocygwin: workaround GCC 6 changes
Yaakov Selkowitz [Tue, 12 Sep 2017 19:30:34 +0000 (14:30 -0500)]
cygwin: workaround GCC 6 changes

GCC 6 includes a number of new warnings which cause Cygwin to either not
compile, or not work properly even if said warnings are ignored:

https://cygwin.com/ml/cygwin-developers/2017-09/msg00000.html
https://gcc.gnu.org/gcc-6/porting_to.html

For now, we use the flags necessary to revert to GCC 5 behaviour until we
can fix the code properly.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agoRevert "cygwin: only expose /dev/con{in,out,sole} when started from a Windows console"
Yaakov Selkowitz [Mon, 11 Sep 2017 18:21:46 +0000 (13:21 -0500)]
Revert "cygwin: only expose /dev/con{in,out,sole} when started from a Windows console"

This caused serious regressions when running from a cmd window:

https://cygwin.com/ml/cygwin/2017-09/msg00114.html

This reverts commit b706c6b479422d31f0124b92c21b4cb536bbddff.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
6 years agoChange time_t to 64-bit by default
Sebastian Huber [Thu, 7 Sep 2017 06:24:22 +0000 (08:24 +0200)]
Change time_t to 64-bit by default

In order to avoid the year 2038 problem, define time_t to a signed
integer with at least 64-bits.  The type for time_t can be forced to
long with the --enable-newlib-long-time_t configure option or with the
_USE_LONG_TIME_T system configuration define.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoRemove harmful casts in gmtime_r()
Sebastian Huber [Thu, 7 Sep 2017 13:01:47 +0000 (15:01 +0200)]
Remove harmful casts in gmtime_r()

In case time_t is long, then the cast to long is a nop.  In case time_t
is __int_least64_t, then the cast to long may truncate the value before
the division.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoLet RTEMS provide clock()
Sebastian Huber [Wed, 6 Sep 2017 06:43:26 +0000 (08:43 +0200)]
Let RTEMS provide clock()

Newlib uses _times_r() in clock().  The problem is that the _times_r()
clock frequency is defined by sysconf(_SC_CLK_TCK).  The clock frequency
of clock() is the constant CLOCKS_PER_SEC.

FreeBSD uses getrusage() for clock().  Since RTEMS has only one process,
the implementation can be simplified.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agostdio.h: Don't define unlocked macros using static inline on C++ cygwin-2_9_0-release
Corinna Vinschen [Mon, 4 Sep 2017 08:52:33 +0000 (10:52 +0200)]
stdio.h: Don't define unlocked macros using static inline on C++

In C++, the usage of static inline functions for getchar_unlocked and
putchar_unlocked may result in error messages like

  error: ‘_putchar_unlocked’ was not declared in this scope

Fix this by not using the _getchar_unlocked and _putchar_unlocked
macros in C++.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agocygwin: Document crypt_r
Yaakov Selkowitz [Fri, 1 Sep 2017 22:26:40 +0000 (17:26 -0500)]
cygwin: Document crypt_r

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
This page took 0.114333 seconds and 5 git commands to generate.