]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
7 years agocygwin TEST: Add nagging debug output to pinfo
Corinna Vinschen [Mon, 24 Apr 2017 15:35:06 +0000 (17:35 +0200)]
cygwin TEST: Add nagging debug output to pinfo

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygwin: pinfo: do not wait for setting ppid on a transitional procinfo
Corinna Vinschen [Mon, 24 Apr 2017 15:34:31 +0000 (17:34 +0200)]
cygwin: pinfo: do not wait for setting ppid on a transitional procinfo

This leads to excessive lag when stracing processes if the inferior
process checks the process table.  The reason is that ppid isn't set
in the procinfo memory of the dynamically loading strace itself.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygwin: try unprivileged symlink creation on W10 1703 and later
Corinna Vinschen [Mon, 24 Apr 2017 15:17:29 +0000 (17:17 +0200)]
cygwin: try unprivileged symlink creation on W10 1703 and later

Add new SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE flag to
CreateSymbolicLinkW call when running on W10 1703 or later.
Don't do that on older versions to avoid ERROR_INVALID_PARAMETER.

Preliminary, needs testing.  There's an off-chance that the
flag results in the same ERROR_INVALID_PARAMETER on 1703 if the
developer settings are not enabled.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygwin: wincap: handle W10 1703
Corinna Vinschen [Mon, 24 Apr 2017 15:14:03 +0000 (17:14 +0200)]
cygwin: wincap: handle W10 1703

Add has_unprivileged_createsymlink flag and set to true on 1703 and
later.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygwin: wincap: fix evaluation of build number
Corinna Vinschen [Mon, 24 Apr 2017 15:12:16 +0000 (17:12 +0200)]
cygwin: wincap: fix evaluation of build number

RtlGetNtVersionNumbers returns the build number with some upper bits
set for no apparent reason.  The fact that RtlGetNtVersionNumbers is
undocumented doesn't exactly help.

Just filter out the upper WORD for now.  If build numbers are in
danger to become 6 digit numbers, re-evaluate.

7 years agocygwin: remov unused winpids constructor
Corinna Vinschen [Mon, 24 Apr 2017 12:22:02 +0000 (14:22 +0200)]
cygwin: remov unused winpids constructor

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoFix stat.st_blocks for files compressed with CompactOS method
Christian Franke [Sat, 22 Apr 2017 12:50:58 +0000 (14:50 +0200)]
Fix stat.st_blocks for files compressed with CompactOS method

Always retrieve FileCompressionInformation for non-empty
files if FileStandardInformation returns 0 allocated blocks.
This fixes stat.st_blocks for files compressed with CompactOS method.

Signed-off-by: Christian Franke <franke@computer.org>
7 years agocygwin doc: Add postinstall/preremove scripts to install Start Menu entries
Brian Inglis [Fri, 21 Apr 2017 11:26:10 +0000 (13:26 +0200)]
cygwin doc: Add postinstall/preremove scripts to install Start Menu entries

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygwin CONTRIBUTORS: Add Brian Inglis
Corinna Vinschen [Sat, 22 Apr 2017 11:54:03 +0000 (13:54 +0200)]
cygwin CONTRIBUTORS: Add Brian Inglis

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygwin doc: install-html: Fix docbook.css and index.html symlink installation
Corinna Vinschen [Sat, 22 Apr 2017 11:49:27 +0000 (13:49 +0200)]
cygwin doc: install-html: Fix docbook.css and index.html symlink installation

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoUpdate URLs for Cygwin packaging information newlib-snapshot-20170421
Jon Turney [Mon, 10 Apr 2017 18:32:47 +0000 (19:32 +0100)]
Update URLs for Cygwin packaging information

Also:
Remove obsolete reference to g-b-s
Remove mention of ancient pre-invisiconsole behaviour of setup scripts

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
7 years agostrace: Fix "over-optimization" flaw in strace.
Daniel Santos [Wed, 19 Apr 2017 16:06:02 +0000 (11:06 -0500)]
strace: Fix "over-optimization" flaw in strace.

Recent versions of gcc are optimizing away the TLS buffer allocated in
main, so we need to tell gcc that it's really used.  RtlSecureZeroMemory
accomplishes this while also inlining the memset.

Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
7 years agoFix relocation type for _bsssize being R_MSP430X_ABS16 when large memory model is...
Jozef Lawrynowicz [Wed, 19 Apr 2017 11:47:13 +0000 (11:47 +0000)]
Fix relocation type for _bsssize being R_MSP430X_ABS16 when large memory model is used

7 years agocygwin doc: install-html: install docbook.css
Corinna Vinschen [Wed, 19 Apr 2017 08:09:16 +0000 (10:09 +0200)]
cygwin doc: install-html: install docbook.css

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygwin doc: install-html: link index.html instead of copying
Corinna Vinschen [Wed, 19 Apr 2017 08:08:28 +0000 (10:08 +0200)]
cygwin doc: install-html: link index.html instead of copying

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoAdd __packed to struct ldieee
Kito Cheng [Sat, 8 Apr 2017 16:06:06 +0000 (00:06 +0800)]
Add __packed to struct ldieee

 - We don't want any padding in struct ldieee, otherwise the offset
   might wrong in most compiler.

7 years agolibgloss/arm: fix discovery of "eabihf" toolchains
Carlos Santos [Thu, 13 Apr 2017 23:17:37 +0000 (20:17 -0300)]
libgloss/arm: fix discovery of "eabihf" toolchains

ARM EABI toolchains can optionally use the "hf" suffix to identify
hardware floating point support. Use the "*-*-eabi*" pattern to match
these toolchains.

Original patch by Bryan Hundven for the Crosstool-NG project. Improved
by Alexey Neyman.

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
CC: Bryan Hundven <bryanhundven@gmail.com
CC: Alexey Neyman <stilor@att.net>
7 years agonewlib: remove __infinity{f,ld} constants
Corinna Vinschen [Tue, 18 Apr 2017 10:17:26 +0000 (12:17 +0200)]
newlib: remove __infinity{f,ld} constants

previous commit 4c90db7bc89e7fa1077025fefdd58269dc71a6ac introduced
a compile time error because libm/common/s_infconst.c used the remove
__fmath, __dmath, and __ldmath union types.

Since this is very old, and unused for a very long time, just drop the
file and thus the __infinity constants entirely.

Exception: Cygwin exports __infinity from the beginning.  There's a very,
VERY low probability that any existing executable or lib still uses this
constant, but we just keep it in for backward compat, nevertheless.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoRemove legacy unions which are no longer used
Jeff Johnston [Mon, 17 Apr 2017 23:21:07 +0000 (19:21 -0400)]
Remove legacy unions which are no longer used

- remove __fmath, __dmath, and __ldmath unions

7 years agoAvoid decimal point localization in /proc/loadavg
Jon Turney [Sat, 8 Apr 2017 12:39:44 +0000 (13:39 +0100)]
Avoid decimal point localization in /proc/loadavg

Explicitly format the contents of /proc/loadavg to avoid the decimal point
getting localized according to LC_NUMERIC. Using anything other than '.' is
wrong and breaks top.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
7 years agoOptimise memchr for NEON-enabled processors
Prakhar Bahuguna [Thu, 26 Jan 2017 10:06:10 +0000 (10:06 +0000)]
Optimise memchr for NEON-enabled processors

7 years agomkvers.sh: Remove "function" to avoid dash objecting to bash-ism.
Mark Geisert [Thu, 6 Apr 2017 05:20:09 +0000 (22:20 -0700)]
mkvers.sh: Remove "function" to avoid dash objecting to bash-ism.

7 years agoMake ldd stop after any non-continuable exception
Jon Turney [Tue, 4 Apr 2017 17:47:44 +0000 (18:47 +0100)]
Make ldd stop after any non-continuable exception

Ensure that ldd always stops when the exception is flagged as
non-continuable.

Also arrange for ldd to exit with a non-zero exit code if something went
wrong which prevented us from listing all dynamic dependencies.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
7 years agoCygwin: Export reallocarray
Corinna Vinschen [Tue, 4 Apr 2017 10:23:18 +0000 (12:23 +0200)]
Cygwin: Export reallocarray

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoBump Cygwin to 2.8.1
Corinna Vinschen [Tue, 4 Apr 2017 10:23:09 +0000 (12:23 +0200)]
Bump Cygwin to 2.8.1

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoAdd BSD-specific reallocarray()
Sebastian Huber [Tue, 4 Apr 2017 10:06:57 +0000 (12:06 +0200)]
Add BSD-specific reallocarray()

It is available in FreeBSD, NetBSD and OpenBSD, but not in glibc.  It is
used for example by OpenSSH.

7 years agoRenumber copyright clause 4
imp [Tue, 4 Apr 2017 10:00:31 +0000 (12:00 +0200)]
Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96

7 years agoqueue.3: Document existing QMD_* macros
cem [Tue, 4 Apr 2017 10:00:30 +0000 (12:00 +0200)]
queue.3: Document existing QMD_* macros

Feedback from: bapt, bdrewery, emaste
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D3983

7 years agoqueue(3): Enhance queue debugging macros
cem [Tue, 4 Apr 2017 10:00:29 +0000 (12:00 +0200)]
queue(3): Enhance queue debugging macros

Split the QUEUE_MACRO_DEBUG into QUEUE_MACRO_DEBUG_TRACE and
QUEUE_MACRO_DEBUG_TRASH.

Add the debug macrso QMD_IS_TRASHED() and QMD_SLIST_CHECK_PREVPTR().

Document these in queue.3.

Reviewed by: emaste
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D3984

7 years agoAdd two new macros, SLIST_CONCAT and LIST_CONCAT
mckusick [Tue, 4 Apr 2017 10:00:28 +0000 (12:00 +0200)]
Add two new macros, SLIST_CONCAT and LIST_CONCAT

Add two new macros, SLIST_CONCAT and LIST_CONCAT. Note in both the
queue.h header file and in the queue.3 manual page that they are O(n) so
should be used only in low-usage paths with short lists (otherwise an
STAILQ or TAILQ should be used).

Reviewed by: kib

7 years agoMake the <sys/queue.h> fully usable within C++
hselasky [Tue, 4 Apr 2017 10:00:27 +0000 (12:00 +0200)]
Make the <sys/queue.h> fully usable within C++

Make the system queue header file fully usable within C++ programs by
adding macros to define class lists.

This change is backwards compatible for all use within C and C++
programs. Only C++ programs will have added support to use the queue
macros within classes. Previously the queue macros could only be used
within structures.

The queue.3 manual page has been updated to describe the new
functionality and some alphabetic sorting has been done while
at it.

Differential Revision: https://reviews.freebsd.org/D2745
PR: 200827 (exp-run)
MFC after: 2 weeks

7 years agoPass macro arguments properly.
hselasky [Tue, 4 Apr 2017 10:00:26 +0000 (12:00 +0200)]
Pass macro arguments properly.

MFC after: 1 week

7 years agoFix order of arguments in the TRACEBUF_INITIALIZER
hselasky [Tue, 4 Apr 2017 10:00:25 +0000 (12:00 +0200)]
Fix order of arguments in the TRACEBUF_INITIALIZER

Fix order of arguments in the TRACEBUF_INITIALIZER macro so that we can
define QUEUE_MACRO_DEBUG to debug list problems.

MFC after: 1 week

7 years agoAdd new FOREACH_FROM variants for queue(3)
lstewart [Tue, 4 Apr 2017 10:00:24 +0000 (12:00 +0200)]
Add new FOREACH_FROM variants for queue(3)

Add new FOREACH_FROM variants of the queue(3) FOREACH macros which can
optionally start the traversal from a previously found element by
passing the element in as "var". Passing a NULL "var" retains the same
semantics as the regular FOREACH macros.

Kudos to phk for suggesting the "FROM" suffix instead of my original
proposal.

Reviewed by: jhb (previous version), rpaulo
MFC after: 1 week

7 years agoRenumber copyright clause 4
imp [Tue, 4 Apr 2017 07:04:59 +0000 (09:04 +0200)]
Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96

7 years agodon't use C99 static array indices with older GCC versions
avg [Tue, 4 Apr 2017 07:04:58 +0000 (09:04 +0200)]
don't use C99 static array indices with older GCC versions

For example, the FreeBSD GCC (4.2.1) has a spotty support for that
feature.  If the static keyword is used with an unnamed array parameter
in a function declaration, then the compilation fails with:
error: static or type qualifiers in abstract declarator

The feature does work if the parameter is named.
So, the restriction introduced in this commit can be removed when all
affected function prototypes have the workaround.

MFC after: 1 week
Sponsored by: Panzura

7 years agoAddition of clang nullability qualifiers.
pfg [Tue, 4 Apr 2017 07:04:57 +0000 (09:04 +0200)]
Addition of clang nullability qualifiers.

For consistency with the qualifiers added in r310977, define a new
qualifier _Null_unspecified which is also defined in clang 3.7+.

Add two new macros:
__NULLABILITY_PRAGMA_PUSH
__NULLABILITY_PRAGMA_POP

These are for use in headers when we want avoid noisy warnings if
some pointers are left without nullability annotations.

These are added with way ahead of their first use to teach the GCC
ports headers of their existance before their first use.

7 years agoRemove unused __gnu_inline() attribute.
pfg [Tue, 4 Apr 2017 07:04:56 +0000 (09:04 +0200)]
Remove unused __gnu_inline() attribute.

This was meant to be used by a future FORTIFY_SOURCE implementation.
Probably for good, FORTIFY_SOURCE and this particular GCCism were never
well supported by clang or other compilers. Furthermore, the technology
has long since been replaced by either static checkers, sanitizers, or
even just the strong stack protector that was enabled by default.

Drop __gnu_inline to avoid cluttering the headers.

MFC after: 5 days

7 years agoAddition of clang nullability qualifiers.
pfg [Tue, 4 Apr 2017 07:04:55 +0000 (09:04 +0200)]
Addition of clang nullability qualifiers.

Add two new qualifiers for use by the static checkers:

_Nonnull
The _Nonnull nullability qualifier indicates that null is not a meaningful
value for a value of the _Nonnull pointer type.

_Nullable
The _Nullable nullability qualifier indicates that a value of the
_Nullable pointer type can be null.

These were introduced in Clang 3.7. For more information, see:
http://clang.llvm.org/docs/AttributeReference.html#nonnull

We add these now without using them so that the GCC ports have time to
pick up the header change.

Hinted by: Android Bionic libc [1]
Also seen in: Apple's Libc-1158.20.4

[1]
https://github.com/android/platform_bionic/commit/baa2a973bd776a51bb05a8590ab05d86eea7b321

7 years agoFix C++ includability of crypto headers with static array sizes
asomers [Tue, 4 Apr 2017 07:04:54 +0000 (09:04 +0200)]
Fix C++ includability of crypto headers with static array sizes

C99 allows array function parameters to use the static keyword for their
sizes. This tells the compiler that the parameter will have at least the
specified size, and calling code will fail to compile if that guarantee is
not met. However, this syntax is not legal in C++.

This commit reverts r300824, which worked around the problem for
sys/md5.h only, and introduces a new macro: min_size(). min_size(x) can
be used in headers as a static array size, but will still compile in C++
mode.

Reviewed by: cem, ed
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D8277

fix a typo in __STDC_VERSION__ in __min_size requirements

MFC after: 1 week
Sponsored by: Panzura

7 years agoStop exposing the C11 _Atomic() macro in <sys/cdefs.h>, when compiling for C++.
dim [Tue, 4 Apr 2017 07:04:53 +0000 (09:04 +0200)]
Stop exposing the C11 _Atomic() macro in <sys/cdefs.h>, when compiling for C++.

It clashes with the one in libc++'s <atomic> header.

(Previously, the _Atomic() macro was defined in <stdatomic.h>, which is
only for use with C11, but for various reasons it was moved to its
current location in r251804.)

Discussed with: bdrewery, ed
MFC after: 2 weeks

7 years agoRename __sentinel to __null_sentinel
pfg [Tue, 4 Apr 2017 07:04:52 +0000 (09:04 +0200)]
Rename __sentinel to __null_sentinel

GCC 5 uses a conflicting __sentinel definition in include/c++/bits/stl_algo.h

Reported by: matteo

7 years agoUse enum __packed in favour of -fshort-enums
Sebastian Huber [Fri, 31 Mar 2017 09:00:42 +0000 (11:00 +0200)]
Use enum __packed in favour of -fshort-enums

Some architectures like ARM encode the short enum option state in the
object file and the linker checks that this option is consistent for all
objects of an executable.  In case applications use -fno-short-enums,
then this leads to linker warnings.  Use the enum __packed attribute for
the relevent enums to avoid the -fshort-enums compiler option.  This
attribute is at least available on GCC, LLVM/clang and the Intel
compiler.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
7 years agoUse .syntax unified instead of .syntax divided. cygwin-2_8_0-release
Catherine Moore [Thu, 30 Mar 2017 14:26:23 +0000 (07:26 -0700)]
Use .syntax unified instead of .syntax divided.

7 years agoAdd latest changes to Cygwin release information
Corinna Vinschen [Tue, 28 Mar 2017 11:42:11 +0000 (13:42 +0200)]
Add latest changes to Cygwin release information

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoChange CURR_SHARED_MAGIC to account for getloadavg patch
Corinna Vinschen [Tue, 28 Mar 2017 11:41:31 +0000 (13:41 +0200)]
Change CURR_SHARED_MAGIC to account for getloadavg patch

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoImplement getloadavg()
Jon Turney [Tue, 21 Mar 2017 19:17:42 +0000 (19:17 +0000)]
Implement getloadavg()

v2:
autoload PerfDataHelper functions
Keep loadavg in shared memory
Guard loadavg access by a mutex
Initialize loadavg to the current load

v3:
Shared memory version bump isn't needed if we are only extending it
Remove unused autoload
Mark inititalized flags as NO_COPY for correct behaviour in fork child

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
7 years agodeclaration of ppoll() by poll.h should be guarded by _GNU_SOURCE
Jon Turney [Mon, 27 Mar 2017 14:19:36 +0000 (15:19 +0100)]
declaration of ppoll() by poll.h should be guarded by _GNU_SOURCE

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
7 years agoRecognize Netapp mode supporting reparse points
Corinna Vinschen [Mon, 27 Mar 2017 18:28:03 +0000 (20:28 +0200)]
Recognize Netapp mode supporting reparse points

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygwin: Do not generate surrogate chars on netapp
Corinna Vinschen [Fri, 24 Mar 2017 19:52:16 +0000 (20:52 +0100)]
cygwin: Do not generate surrogate chars on netapp

Just like Samba, Netapp FSes seem to dislike invalid surrogate usage in
filenames.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoDocument cygserver changes
Corinna Vinschen [Fri, 24 Mar 2017 17:13:08 +0000 (18:13 +0100)]
Document cygserver changes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygserver: Speed up non-debug scenario
Corinna Vinschen [Fri, 24 Mar 2017 16:26:37 +0000 (17:26 +0100)]
cygserver: Speed up non-debug scenario

_log/_vlog were always called so we always had a function call hit even
if we're not debugging.  Expand on the debugging macros so the decision
to call _log/_vlog is done in the caller already.  Also, make a log level
difference between syscall_printf and system_printf.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygserver: Small code cleanup
Corinna Vinschen [Fri, 24 Mar 2017 15:46:17 +0000 (16:46 +0100)]
cygserver: Small code cleanup

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygserver: Revamp thread sleep handling
Corinna Vinschen [Fri, 24 Mar 2017 15:45:32 +0000 (16:45 +0100)]
cygserver: Revamp thread sleep handling

The current implementation is a very simple approach to implement
a statically sized sleep queue.  The problem is that this code requires
a certain amount of synchronization because the slots in the queue are
used dynamically.  To top it off, the Event objects used for sync'ing
are created and destroyed on demand.  This is complicated, slow, and
error prone.

There's also a blatant bug here: The number of slots in the queue was
wrongly computed in size.  It was too small if XSI IPC was used a lot.

Make the code more robust.  Let the queue have the right size.  Every
slot is now used for a specific IPC object.  All sync objects (switched
to Semaphores) are only created when first required, but never destroyed.
This reduces the usage of a critical section to the creation of a new
sync object.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygserver: raise number of worker threads on demand
Corinna Vinschen [Fri, 24 Mar 2017 15:18:26 +0000 (16:18 +0100)]
cygserver: raise number of worker threads on demand

The number of threads in the worker pool is fixed so far.  This is a
problem in XSI IPC scenarions with an unknown number of consumers.
It doesn't make sense to make the pool very big for a start, but when
the need arises, we need to make sure we can serve the request even if
all other worker threads are in a wait state.

This patch changes threaded_queue to just add another worker thread
if all current workers are busy.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygserver: Only print basename of source in debug output to raise readability
Corinna Vinschen [Fri, 24 Mar 2017 15:12:52 +0000 (16:12 +0100)]
cygserver: Only print basename of source in debug output to raise readability

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocygserver: Seralize debug output to stdout to raise readability
Corinna Vinschen [Fri, 24 Mar 2017 15:12:00 +0000 (16:12 +0100)]
cygserver: Seralize debug output to stdout to raise readability

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agodlfcn: Remove stray debug output newlib-snapshot-20170323
Corinna Vinschen [Wed, 22 Mar 2017 10:10:15 +0000 (11:10 +0100)]
dlfcn: Remove stray debug output

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoRename <sys/_locale.h> to <xlocale.h>
Yaakov Selkowitz [Tue, 21 Mar 2017 20:21:30 +0000 (15:21 -0500)]
Rename <sys/_locale.h> to <xlocale.h>

The locale_t type is provided by <xlocale.h> on Linux, FreeBSD, and Darwin.
While, like on some of those systems, it is automatically included by
<locale.h> with the proper feature test macros, its presence under this
particular name is still presumed in real-world software.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
7 years agoARM: Fix IEEE-754 sqrt implementation
Sebastian Huber [Tue, 21 Mar 2017 14:47:34 +0000 (15:47 +0100)]
ARM: Fix IEEE-754 sqrt implementation

Older GCC (e.g. 4.9.3) seem to define __ARM_FP even in case soft-float
is used.

7 years agoARM: Optimize IEEE-754 sqrt implementation
Sebastian Huber [Tue, 21 Mar 2017 07:49:00 +0000 (08:49 +0100)]
ARM: Optimize IEEE-754 sqrt implementation

Use the vsqrt.f64 and vsqrt.f32 instructions if available.

7 years agoCygwin: dlfcn: Fix reference counting
Corinna Vinschen [Tue, 21 Mar 2017 13:30:24 +0000 (14:30 +0100)]
Cygwin: dlfcn: Fix reference counting

The original dll_init code was living under the wrong assumption that
dll_dllcrt0_1 and in turn dll_list::alloc will be called for each
LoadLibrary call.  The same wrong assumption was made for
cygwin_detach_dll/dll_list::detach called via FreeLibrary.

In reality, dll_dllcrt0_1 gets only called once at first LoadLibrary
and cygwin_detach_dll once at last FreeLibrary.

In effect, reference counting for DLLs was completely broken after fork:

  parent:
    l1 = dlopen ("lib1");  // LoadLibrary, LoadCount = 1
    l2 = dlopen ("lib1");  // LoadLibrary, LoadCount = 2

    fork ();               // LoadLibrary in the child, LoadCount = 1!
      child:
        dlclose (l1);      // FreeLibrary actually frees the lib
        x = dlsym (l2);    // SEGV

* Move reference counting to dlopen/dlclose since only those functions
  have to keep track of loading/unloading DLLs in the application context.

* Remove broken accounting code from dll_list::alloc and dll_list::detach.

* Fix error handling in dlclose.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agolibc/string/strsignal.c: Use of || not && lead to dead code.
Joel Sherrill [Wed, 15 Mar 2017 17:04:22 +0000 (12:04 -0500)]
libc/string/strsignal.c: Use of || not && lead to dead code.

Coverity Id: 175333

7 years agortems/crt0.c: getentropy() stub did not return a value.
Joel Sherrill [Wed, 15 Mar 2017 14:37:22 +0000 (09:37 -0500)]
rtems/crt0.c: getentropy() stub did not return a value.

Coverity Scan ID: 175342

7 years agoAdd release message for commit 973f766f6
Corinna Vinschen [Tue, 14 Mar 2017 15:54:57 +0000 (16:54 +0100)]
Add release message for commit 973f766f6

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoRevert "Add release message for commit 973f766f6"
Corinna Vinschen [Tue, 14 Mar 2017 15:52:20 +0000 (16:52 +0100)]
Revert "Add release message for commit 973f766f6"

This reverts commit 125852d77b65fe2155d0d5fa97e53fc9e2b29984.

Accidentally commited too much.

7 years agoAdd release message for commit 973f766f6
Corinna Vinschen [Tue, 14 Mar 2017 08:24:48 +0000 (09:24 +0100)]
Add release message for commit 973f766f6

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoFix duplocale (libc/locale/duplocale.c) which fails to properly call __loadlocale
Koichi Murase [Sat, 11 Mar 2017 16:27:26 +0000 (01:27 +0900)]
Fix duplocale (libc/locale/duplocale.c) which fails to properly call __loadlocale

Problem:

  After  passing  locales  created  by  'duplocale'   to   'uselocale',
  referencing   'MB_CUR_MAX',   which   is   actually   expanded    to
  '__locale_mb_cur_max()' by preprocessors, causes segmentation faults.
  Direct use of locales from 'newlocale' does not  cause  the  problem.
  This is the problem of 'duplocale'.

  $ echo $LANG
  ja_JP.UTF-8
  $ cat test.c
  #include <stdlib.h>
  #include <locale.h>

  volatile int var;

  int main(void) {
    locale_t const loc = newlocale(LC_ALL_MASK, "", NULL);
    locale_t const dup = duplocale(loc);
    locale_t const old = uselocale(dup);
    var = MB_CUR_MAX; /* <-- crashes here */
    uselocale(old);
    freelocale(dup);
    freelocale(loc);
    return 0;
  }
  $ gcc test.c
  $ ./a
  Segmentation fault (core dumped)

  # Note: "core dumped" in the above message was  actually written  in
  # Japanese, but I translated the part to post a mail in English.

Bug:

  In the beginning of '__loadlocale' (newlib/libc/locale/locale.c:501),
  there is a code which checks if the operations can be skipped:

  > /* Avoid doing everything twice if nothing has changed. */
  > if (!strcmp (new_locale, loc->categories[category]))
  >   return loc->categories[category];

  While,   in   the   function   '_duplocale_r'    (newlib/libc/locale/
  duplocale.c), '__loadlocale'  is  called  as  in  the  quoted  codes:

  > /* If the object is not a "C" locale category, copy it.  Just call
  >    __loadlocale.  It knows what to do to replicate the category. */
  > tmp_locale.lc_cat[i].ptr = NULL;
  > tmp_locale.lc_cat[i].buf = NULL;
  > if (!__loadlocale (&tmp_locale, i, tmp_locale.categories[i]))
  >   goto error;

  This call of '__loadlocale' results in the skip check being

    !strcmp(tmp_locale.categories[i], tmp_locale.categories[i]),

  which is always true. This  means  that  the  actual  operations  of
  '__loadLocale' will never be performed for 'duplocale'.

Fix:

  The call of '__loadlocale' in '_duplocale_r' is modified.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoExtend 2.8.0 release text
Corinna Vinschen [Sun, 12 Mar 2017 11:21:40 +0000 (12:21 +0100)]
Extend 2.8.0 release text

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoImplement fhandler_dev_null::write to workaround a problem with NUL
Corinna Vinschen [Sun, 12 Mar 2017 11:17:43 +0000 (12:17 +0100)]
Implement fhandler_dev_null::write to workaround a problem with NUL

Windows NUL device returns only the lower 32 bit of the number of
bytes written.  Implement a fake write function to ignore the underlying
NUL device.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoReturn value from write is ssize_t, not int
Corinna Vinschen [Sun, 12 Mar 2017 11:16:23 +0000 (12:16 +0100)]
Return value from write is ssize_t, not int

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agogetrandom: it's MIN, not MAX
Yaakov Selkowitz [Sat, 11 Mar 2017 09:01:47 +0000 (10:01 +0100)]
getrandom: it's MIN, not MAX

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoBelatedly bump Cygwin DLL version to 2.8.0
Corinna Vinschen [Fri, 10 Mar 2017 19:50:35 +0000 (20:50 +0100)]
Belatedly bump Cygwin DLL version to 2.8.0

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoDrop now unused child_info_fork::from_main
Corinna Vinschen [Fri, 10 Mar 2017 19:45:19 +0000 (20:45 +0100)]
Drop now unused child_info_fork::from_main

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agofork: Don't copy _main_tls->local_clib from *_impure_ptr
Corinna Vinschen [Fri, 10 Mar 2017 19:44:53 +0000 (20:44 +0100)]
fork: Don't copy _main_tls->local_clib from *_impure_ptr

So far we copy *_impure_ptr into _main_tls->local_clib if the child
process has been forked from a pthread.  But that's not required.
The local_clib area of the new thread is on the stack and the stack
gets copied from the parent anyway (in frok::parent).  So we only
have to make sure _main_tls is pointing to the right address and
do the simple post-fork thread init.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years ago_dll_crt0: Drop incorrect check for being started from parent main thread
Corinna Vinschen [Fri, 10 Mar 2017 19:28:09 +0000 (20:28 +0100)]
_dll_crt0: Drop incorrect check for being started from parent main thread

This test was broken from the start.  It leads to creating a completely
new stack for the main thread of the child process when started from
the main thread of the parent.  However, the main thread of a process
can easily running on a completely different stack, if the parent's main
thread was created by calling fork() from a pthread.  For an example,
see https://cygwin.com/ml/cygwin/2017-03/msg00113.html

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoerrno: Stop using _impure_ptr->_errno completely
Corinna Vinschen [Fri, 10 Mar 2017 19:21:09 +0000 (20:21 +0100)]
errno: Stop using _impure_ptr->_errno completely

We use errno AKA _REENT->_errno since the last century and only set
_impure_ptr->_errno for backward compat.  Stop that.  Also, remove
the last check for _impure_ptr->_errno in Cygwin code.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoDrop redundant brackets in call to _reclaim_reent
Corinna Vinschen [Fri, 10 Mar 2017 19:16:48 +0000 (20:16 +0100)]
Drop redundant brackets in call to _reclaim_reent

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoImplement dladdr() (partially)
Jon Turney [Mon, 6 Mar 2017 18:30:45 +0000 (18:30 +0000)]
Implement dladdr() (partially)

Note that this always returns with dli_sname and dli_saddr set to NULL,
indicating no symbol matching addr could be found.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
7 years agoyield: Don't lower thread priority, it leads to starvation
Corinna Vinschen [Wed, 8 Mar 2017 16:44:15 +0000 (17:44 +0100)]
yield: Don't lower thread priority, it leads to starvation

...and it's not required anymore to have the same effect as the original
code post-XP.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoCygwin: Emit correct errno EAGAIN if we can't create another thread
Corinna Vinschen [Wed, 8 Mar 2017 16:43:23 +0000 (17:43 +0100)]
Cygwin: Emit correct errno EAGAIN if we can't create another thread

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoExport timingsafe_bcmp and timingsafe_memcmp
Jon Turney [Mon, 6 Mar 2017 17:54:42 +0000 (17:54 +0000)]
Export timingsafe_bcmp and timingsafe_memcmp

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
7 years agoDocument pthread_cond_wait change in release notes
Corinna Vinschen [Tue, 7 Mar 2017 14:18:03 +0000 (15:18 +0100)]
Document pthread_cond_wait change in release notes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoCygwin: pthread_cond_wait: Do as Linux and BSD do.
Corinna Vinschen [Tue, 7 Mar 2017 14:15:47 +0000 (15:15 +0100)]
Cygwin: pthread_cond_wait: Do as Linux and BSD do.

POSIX states as follows about pthread_cond_wait:
If a signal is delivered to a thread waiting for a condition variable,
upon return from the signal handler the thread resumes waiting for the
condition variable as if it was not interrupted, or it returns zero
due to spurious wakeup.

Cygwin so far employs the latter behaviour, while Linux and BSD employ
the former one.

Align Cygwin behaviour to Linux and BSD.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agocwdstuff: Don't leave from setting the CWD prematurely on init
Corinna Vinschen [Fri, 3 Mar 2017 12:55:55 +0000 (13:55 +0100)]
cwdstuff: Don't leave from setting the CWD prematurely on init

There are certain, very obscure scenarios, which render the Windows
CWD handle inaccessible for reopening.  An easy one is, the handle can
be NULL if the permissions of the CWD changed under the parent processes
feet.

Originally we just set errno and returned, but in case of init at
process startup that left the "posix" member NULL and subsequent
calls to getcwd failed with EFAULT.

We now check for a NULL handle and change the reopen approach
accordingly.  If that doesn't work, try to duplicate the handle instead.
If duplicating fails, too, we set the dir handle to NULL and carry on.
This will at least set posix to some valid path and subsequent getcwd
calls won't fail.  A NULL dir handle is ok, because we already do this
for virtual paths.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoPreserve order of dlopen'd modules in dll_list::topsort newlib-snapshot-20170228
David Allsopp [Mon, 27 Feb 2017 17:06:34 +0000 (17:06 +0000)]
Preserve order of dlopen'd modules in dll_list::topsort

This patch alters the behaviour of dll_list::topsort to preserve the
order of dlopen'd units.

The load order of unrelated DLLs is reversed every time fork is called,
since dll_list::topsort finds the tail of the list and then unwinds to
reinsert items. My change takes advantage of what should be undefined
behaviour in dll_list::populate_deps (ndeps non-zero and ndeps and deps
not initialised) to allow the deps field to be initialised prior to the
call and appended to, rather than overwritten.

All DLLs which have been dlopen'd have their deps list initialised with
the list of all previously dlopen'd units. These extra dependencies mean
that the unwind preserves the order of dlopen'd units.

The motivation for this is the FlexDLL linker used in OCaml. The FlexDLL
linker allows a dlopen'd unit to refer to symbols in previously dlopen'd
units and it resolves these symbols in DllMain before anything else has
initialised (including the Cygwin DLL). This means that dependencies may
exist between dlopen'd units (which the OCaml runtime system
understands) but which Windows is unaware of. During fork, the
process-level table which FlexDLL uses to get the symbol table of each
DLL is copied over but because the load order of dlopen'd DLLs is
reversed, it is possible for FlexDLL to attempt to access memory in the
DLL before it has been loaded and hence it fails with an access
violation. Because the list is reversed on each call to fork, it means
that a subsequent call to fork puts the DLLs back into the correct
order, hence "even" invocations of fork work!

An interesting side-effect is that this only occurs if the DLLs load at
their preferred base address - if they have to be rebased, then FlexDLL
works because at the time that the dependent unit is loaded out of
order, there is still in memory the "dummy" DONT_RESOLVE_DLL_REFERENCES
version of the dependency which, as it happens, will contain the correct
symbol table in the data section. For my tests, this initially appeared
to be an x86-only problem, but that was only because the two DLLs on x64
should have been rebased.

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
7 years agoAdd 2.7.1 release file
Corinna Vinschen [Fri, 24 Feb 2017 19:57:02 +0000 (20:57 +0100)]
Add 2.7.1 release file

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoGenerate output with Unix line endings even from Mingw64 utils
Corinna Vinschen [Fri, 24 Feb 2017 19:55:14 +0000 (20:55 +0100)]
Generate output with Unix line endings even from Mingw64 utils

This affects cygcheck and strace.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoBump Cygwin version to 2.7.1
Corinna Vinschen [Fri, 24 Feb 2017 19:51:50 +0000 (20:51 +0100)]
Bump Cygwin version to 2.7.1

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agofix parallel build for version.cc and winver.o
Michael Haubenwallner [Thu, 16 Feb 2017 15:57:40 +0000 (16:57 +0100)]
fix parallel build for version.cc and winver.o

Creating both version.cc and winver.o at once really should run once only.

7 years agoUpdate makedocbook for bd547490
Jon Turney [Tue, 14 Feb 2017 20:01:48 +0000 (20:01 +0000)]
Update makedocbook for bd547490

Teach makedocbook how to handle some new things seen in the makedoc markup
since bd547490:

- struct lines appearing in the synopsis
- use of @strong{} texinfo markup

7 years agoFix elf-nano.specs to work without -save-temps
Thomas Preud'homme [Wed, 15 Feb 2017 10:51:54 +0000 (10:51 +0000)]
Fix elf-nano.specs to work without -save-temps

The changes in af272aca591fe1dc0f1be64ae5bda147ea98a047 only works when
using gcc/g++ with -E or -save-temps, otherwise newlib's newlib.h gets
used even if -specs=nano.specs is specified. This is because the driver
only use cpp_options spec for the external cpp tool, not for the
integrated one.

This patch uses instead cpp_unique_options which is used in all cases:
it is used directly when the integrated preprocessor is used, and
indirectly by expansion of cpp_options otherwise.

7 years agoImprove wording on special characters
Kenneth Nellis [Tue, 14 Feb 2017 08:46:56 +0000 (09:46 +0100)]
Improve wording on special characters

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
7 years agoAllow locking routine to be retargeted
Thomas Preud'homme [Tue, 25 Oct 2016 16:38:19 +0000 (17:38 +0100)]
Allow locking routine to be retargeted

At the moment when targeting bare-metal targets or systems without
definition for the locking primitives newlib, uses dummy empty macros.
This has the advantage of reduced size and faster implementation but
does not allow the application to retarget the locking routines.
Retargeting is useful for a single toolchain to support multiple systems
since then it's only at link time that you know which system you are
targeting.

This patch adds a new configure option
--enable-newlib-retargetable-locking to use dummy empty functions
instead of dummy empty macros. The default is to keep the current
behavior to not have any size or speed impact on targets not interested
in this feature. To allow for any size of lock, the _LOCK_T type is
changed into pointer to struct _lock and the _init function are tasked
with allocating the locks. The platform being targeted must provide the
static locks. A dummy implementation of the locking routines and static
lock is provided for single-threaded applications to link successfully
out of the box.

To ensure that the behavior is consistent (either no locking whatsoever
or working locking), the dummy implementation is strongly defined such
that a partial retargeting will cause a doubly defined link error.
Indeed, the linker will only pull in the file providing the dummy
implementation if it cannot find an implementation for one of the
routine or lock.

7 years agoOnly define static locks in multithreaded mode
Thomas Preud'homme [Mon, 30 Jan 2017 11:23:00 +0000 (11:23 +0000)]
Only define static locks in multithreaded mode

Newlib build system defines __SINGLE_THREAD__ to allow concurrency code
to be only compiled when newlib is configured for multithread. One such
example are locks which become useless in single thread mode. Although
most static locks are indeed guarded by !defined(__SINGLE_THREAD__),
some are not.

This commit adds these missing guards to __dd_hash_mutex,
__atexit_recursive_mutex, __at_quick_exit_mutex and __arc4random_mutex.
It also makes sure locking macros in lock.h are noop in single thread
mode.

7 years agoFix cpp invocation for C++ in nano spec
Thomas Preudhomme [Tue, 7 Feb 2017 16:58:27 +0000 (16:58 +0000)]
Fix cpp invocation for C++ in nano spec

Hi,

The changes in c028685518a261f6d0dab0d7ed15f9570ab9b3d0 to use
newlib-nano's include directory work for cc1 but not cc1plus. cc1plus
comes with its own cpp spec which does not have a name attached to it.

This patch uses the renaming trick on cpp_options instead of cpp, as
cpp_options is used both by cc1 and cc1plus.

7 years agolibgloss: Remove duplicate definition of environ
Stafford Horne [Mon, 6 Feb 2017 14:38:40 +0000 (23:38 +0900)]
libgloss: Remove duplicate definition of environ

Environ is defined in libgloss and libc:
 - libgloss/or1k/syscalls.c
 - libc/stdlib/environ.c

When linking we sometimes get errors:
or1k-elf-g++ test.o -mnewlib -mboard=or1ksim -lm -o  test
/opt/shorne/software/or1k/lib/gcc/or1k-elf/5.3.0/../../../../or1k-elf/lib/libor1k.a(syscalls.o):(.data+0x0):
multiple definition of `environ'
/opt/shorne/software/or1k/lib/gcc/or1k-elf/5.3.0/../../../../or1k-elf/lib/libc.a(lib_a-environ.o):(.data+0x0):
first defined here
collect2: error: ld returned 1 exit status

This doesnt happen after the fix. Basic things build fine too.

7 years agolibgloss: or1k: If available call the init for init_array
Stafford Horne [Mon, 6 Feb 2017 14:38:39 +0000 (23:38 +0900)]
libgloss: or1k: If available call the init for init_array

There was an issue revealed in gdb testing where C++ virtual tables
were not getting properly initialized.  This seems to be due to the
c++ global constructors moving from ctors to init_array.

This fix makes sure we call the proper method for initializing the
constructors in all places.

7 years agoor1k: Make open reentrant
Olof Kindgren [Mon, 6 Feb 2017 14:38:38 +0000 (23:38 +0900)]
or1k: Make open reentrant

or1k uses reentrant calls by default, but there was no open_r defined
which caused failure in C++/C code such as:

int main() { std::cout << "test\n";  return 0; }

or

int main() {open(".", 0);}

7 years agoAdd IBM Security Trusteer Rapport to BLODA list cygwin-2_7_0-release
Corinna Vinschen [Sun, 12 Feb 2017 11:15:32 +0000 (12:15 +0100)]
Add IBM Security Trusteer Rapport to BLODA list

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This page took 0.072154 seconds and 5 git commands to generate.