Commit Graph

17142 Commits

Author SHA1 Message Date
Anton Kolesov dd00a8e719 arc: Rework default exception handlers for ARC EM and HS
Initially crt0.S used a special function, declared as weak as a default
exception handler in interrupt vector table. To let user override individual
handlers, this function had multiple names - one for each IVT entry, which,
however, was terribly confusing for the debugger and user - because it
wasn't clear which symbol will be used as a function name in debugger.
Defining multiple separate functions - one for each handler, would resolve
the mess, but would increase code size of crt0.o.

To clean this up, this patch defines exception handlers as weak symbols as
well, but those are defined as just symbols, not functions, hence there
would be less confusion over what is what. At the same time, users still can
redefine exception handlers symbol by creating functions with respective
names.

libgloss/
2016-05-24  Anton Kolesov  <Anton.Kolesov@synopsys.com>

	* arc/crt0.S: Convert memory_error and friends to non-function
	  symbols.
2016-05-25 12:15:51 +02:00
Corinna Vinschen 030d86d04d TZ: Replace unreliable isupper calls on wchars
In case the TZ variable is empty, Cygwin fetches timezone info from
Windows.  Extracting the timezone short name uses isupper on wide chars.
Replace with explicit check for A <= character <= Z to be independent
of undefined behaviour.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-25 12:13:03 +02:00
Adam Dinwoodie 3b66731698 Git is Git, not GIT
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-24 12:09:10 +02:00
Corinna Vinschen 8d7b9a199c Fix typo and wrong URL in winsup/README
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-24 10:25:18 +02:00
Yaakov Selkowitz 95644157c1 Feature test macros: ctermid, cuserid
The proper location for these functions has always been <stdio.h>, however
XPG4 and SUSv2 did mandate a duplicate declaration in <unistd.h>.  cuserid
was dropped in SUSv3 (it was marked legacy since XPG4) and the ctermid
declaration in <unistd.h> was made optional and obsolete in SUSv4.

Fixes: https://cygwin.com/ml/cygwin/2016-05/msg00002.html
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-05-23 11:20:29 -05:00
Corinna Vinschen 4e434bf223 Add release message for previous mmap fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-20 21:50:41 +02:00
Corinna Vinschen 0aa738220b mmap: Fix size restriction of maps due to using 32 bit size type
Throughout mmap, size-related variables and parameters are still using
DWORD as type, which disallows mapping ranges > 4Gigs.  Fix this by
using SIZE_T throughout for those vars and parameters.
Also, drop unused off parameter from 1st variant of mmap_record::map_pages.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-20 21:48:10 +02:00
Corinna Vinschen 2e62d68ba5 Add release message for scheduler fixes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-20 18:01:11 +02:00
Corinna Vinschen 4b51e4c142 Fix thread priority handling
So far pthread::postcreate() only sets the thread priority at all, only
if the inherit-scheduler attribute is PTHREAD_EXPLICIT_SCHED.  This
completely ignores the PTHREAD_INHERIT_SCHED case, since in contrast
to POSIX, a thread does not inherit its priority from the creating
thread, but always starts with THREAD_PRIORITY_NORMAL.

pthread_getschedparam() only returns what's stored in the thread attributes,
not the actual thread priority.

This patch fixes both problems.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-20 17:45:24 +02:00
Corinna Vinschen 450f557fee Rewrite scheduler functions getting and setting process and thread priority
So far the scheduler priority handling is not POSIX compatible.
The priorities use a range of -14 up to +15, which means it's not clear
if the POSIX-required return value of -1 in case of an error is *really*
an error or just the valid priority value -1.  Even more confusing, -14
is the *max* value and 15 is the *min* value.  Last but not least this
range doesn't match the POSIX requirement of at least 32 priority values.

This patch cleans up scheduler priority handling and moves the valid
priority range to 1 (min) - 32 (max).  It also adds a function
sched_get_thread_priority() which will help to make thread priority
more POSIX-like.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-20 17:38:22 +02:00
Yaakov Selkowitz 6ac6e7c2bd libgloss/ft32: fix whitespace in Makefile
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-05-20 10:10:08 -05:00
John Hood 6dd601af66 Miscellaneous style cleanup, whitespace only. 2016-05-20 12:11:18 +02:00
John Hood e5665d8c93 Improve and simplify select().
* select.h: Eliminate redundant select_stuff::select_loop state.
* select.cc (select): Eliminate redundant
  select_stuff::select_loop state.  Eliminate redundant code for
  zero timeout.  Do not return early on early timer return.
  (select_stuff::wait): Eliminate redundant
  select_stuff::select_loop state.
2016-05-20 12:00:58 +02:00
John Hood a23e6a35d8 Use high-resolution timebases for select().
* select.h: Change prototype for select_stuff::wait() for larger
  microsecond timeouts.
* select.cc (pselect): Convert from old cygwin_select().
  Implement microsecond timeouts.
  (cygwin_select): Rewrite as a wrapper on pselect().
  (select): Implement microsecond timeouts.
  (select_stuff::wait): Implement microsecond timeouts with a timer
  object.
2016-05-20 12:00:38 +02:00
Anton Kolesov d5632bcfd4 Sync toplevel configure with upstream GCC.
This fixes a problem, where libgloss wouldn't be built for ARC processors,
even though it is actually supported. The original patch that introduced
support for ARC in libgloss hasn't been submitted to GCC maillist, hence
when top-level configure has been synced with GCC - this libgloss patch has
been effectively reverted.

Libgloss support for ARC has been accepted in GCC:
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg01148.html

ChangeLog

2016-05-17  Anton Kolesov  <Anton.Kolesov@synopsys.com>

	* configure.ac: Sync with upstream GCC.
	* configure: Regenerate.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
2016-05-20 10:58:27 +02:00
Wilco Dijkstra e7b1ee2ea6 Add rawmemchr
Marcus Shawcroft wrote:
> This patch appears to have been munged by the mail system, can you
> repost as an attachment please.

Sure, I've attached the patch.

Wilco

Add a simple rawmemchr implementation. Use strlen for rawmemchr(s, '\0') as it is the
fastest way to search for '\0', and use memchr with an infinite size for other cases.
This is 3x faster for large sizes.

ChangeLog:
2016-04-22  Wilco Dijkstra  <wdijkstr@arm.com>

        * newlib/libc/machine/aarch64/Makefile.in: Add rawmemchr.S and
        rawmemchr-stub.c.
        * newlib/libc/machine/aarch64/Makefile.am: Likewise.
        * newlib/libc/machine/aarch64/rawmemchr.S (rawmemchr): Add rawmemchr.
        * newlib/libc/machine/aarch64/rawmemchr-stub.c (rawmemchr): Likewise.
2016-05-20 10:47:02 +02:00
Corinna Vinschen f6d9d8a182 Bump Cygwin DLL version to 2.5.2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-18 21:27:57 +02:00
Corinna Vinschen 72ded59447 Make sure to have full configuration info in sys/_types.h.
The following testcase:

  $ cat > test.c <<EOF
  #include <sys/select.h>
  #include <sys/time.h>
  EOF
  $ gcc -c test.c

emits the following error:

  /usr/include/sys/reent.h:276:3: error: expected specifier-qualifier-list befor
e ‘_fpos64_t’
     _fpos64_t _EXFNPTR(_seek64, (struct _reent *, _PTR, _fpos64_t, int));
     ^

The reason is that the load order from sys/select.h includes sys/_types.h
before sys/config.h has been included from anywhere else.  sys/_types.h
defines _fpos64_t only if __LARGE64_FILES is defined, but it never is in
this scenario.  So sys/_types.h has to make sure to get the configuration
info by itself.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-05-18 21:05:31 +02:00
Jeff Johnston 5c02bcc086 Fix strlen using Thumb-2 with -Os -marm
2016-04-18  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * libc/machine/arm/strlen-stub.c: Check capabilities of architecture
        to decide which Thumb implementation to use and fall back to C
        implementation for architecture not supporting Thumb mode.
        * libc/machine/arm/strlen.S: Likewise.
2016-05-11 17:18:48 -04:00
Jeff Johnston d1d1378d13 Fix libgloss arc nsim specs file. 2016-05-11 12:45:55 -04:00
Jeff Johnston 93f5d7c739 Add port for Phoenix-RTOS in common configure files. 2016-05-09 15:23:58 -04:00
Jeff Johnston 36e32df9f8 Allow autoconf link-time tests to detect arc4random for RTEMS. 2016-05-09 12:37:27 -04:00
Jeff Johnston ba72ae0f93 Add Phoenix-RTOS port for ARM.
Port contributed by Jakub Sejdak <jakub.sejdak@phoesys.com>
2016-05-06 17:04:58 -04:00
Jeff Johnston 3312579f44 Fix libgloss/arc/nano.specs file. 2016-05-06 15:56:46 -04:00
Jeff Johnston 5c968d849a Fix white-space in libgloss/arc/Makefile.in. 2016-05-05 12:02:29 -04:00
Jeff Johnston de2a5d6cd3 Add _Thread_queue_Queue::_owner for RTEMS
Add _Thread_queue_Queue::_owner which will be used for the upcomming
priority inheritance implementation and an O(m) independence-preserving
protocol (OMIP) implementation.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-05-03 14:21:17 -04:00
Jeff Johnston 4f81837d78 Move _Thread_queue_Queue::_Lock for RTEMS
Move _Thread_queue_Queue::_Lock to begin of the structure.  On RTEMS,
the presence of a lock component in the thread queue structures actually
depends on the build-time RTEMS_SMP configuration option.  A move of
this part to the begin of the structure allows an implementation re-use
for the other parts.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-05-03 14:18:54 -04:00
Jeff Johnston f310e8d951 Always assign return value to passed pointer in time function.
If the passed t pointer is not a null pointer, always assign the return
value to the object it points to, regardless of whether the return value
is an error.

This is what the GNU C Library does, and this is also the expected
behavior according to the latest draft of the C programming language
standard (C11 ISO/IEC 9899:201x WG14 N1570, dated 2011-04-12):

Signed-off-by: Benoît Thébaudeau <benoit@wsystem.com>
2016-05-02 16:11:26 -04:00
Jeff Johnston 58dd08ee50 Don't run UTF-8.exp test if newlib is not built with multibyte support.
Submitted on behalf of Yuriy Kolerov.

newlib/ChangeLog

2016-04-29  Yuriy Kolerov <yuriy.kolerov@synopsys.com>

        testsuite/newlib.locale/UTF-8.exp: Don't run if multibyte support is
        disabled.

Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
Signed-off-by: Anton Kolesov <anton.kolesov@synopsys.com>
2016-05-02 16:03:27 -04:00
Jeff Johnston 11afe8f6b6 Fix support ARC processors without barrel-shifter
crt0.S for ARC used to use instruction "asr.f lp_count, r3, 2" for all cores
except ARC601. However instructions which shift more than 1 bit are
optional, so this crt0.S didn't worked for all ARC cores.

Luckily this is a shift just by 2 bits on all occassions, so fix is trivial
- use two single-bit shifts.

libgloss/ChangeLog

2016-04-29  Anton Kolesov  <anton.kolesov@synopsys.com>

        * arc/crt0.S: Fix support for processors without barrel-shifter.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
2016-05-02 12:04:40 -04:00
Jeff Johnston cd494f7038 Update crt0.S for ARC.
This is similar to commit 06537f05d4 to the
newlib for ARC.

GCC for ARC has been updated to provide consistent naming of preprocessor
definitions for different optional architecture features:

    * __ARC_BARREL_SHIFTER__ instead of __Xbarrel_shifter for
      -mbarrel-shifter
    * __ARCEM__ instead of __EM__ for ARC EM cores
    * __ARCHS__ instead of __HS__ for ARC HS cores
    * etc (not used in libgloss)

This patch updates crt0.S for ARC to use new definitions instead of a
deprecated ones. To ensure compatibility with older compiler new definitions
are also defined in crt0.S if needed, based on presence of deprecated
preprocessor definitions.

libgloss/ChangeLog

2016-04-29  Anton Kolesov  <Anton.Kolesov@synopsys.com>

        * arc/crt0.S: Use new GCC defines to detect processor features.
2016-05-02 11:58:47 -04:00
Jeff Johnston e90da68265 Add necessary infrastructure to support "nano" build of newlib.
ARC aproach to this feature is similiar to ARM's one here.

2016-04-29  Anton Kolesov  <anton.kolesov@synopsys.com>

        * arc/nano.specs: New file.
        * arc/Makefile.in: Support nano.specs.
        * arc/nsim.specs: Likewise.
2016-04-29 15:17:11 -04:00
Sebastian Huber 82768d9bab Provide FreeBSD types for <sys/types.h> on RTEMS
Provide the following types via <sys/types.h> on RTEMS for FreeBSD
compatibility if __BSD_VISIBLE

 * accmode_t,
 * cap_rights_t,
 * c_caddr_t,
 * cpulevel_t,
 * fixpt_t,
 * lwpid_t,
 * uintfptr_t,
 * vm_offset_t,
 * vm_ooffset_t,
 * vm_paddr_t,
 * vm_pindex_t, and
 * vm_size_t.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-21 10:29:04 +02:00
Sebastian Huber 51062c856b Always provide register_t via <sys/types.h>
Always provide register_t via <sys/types.h> for glibc and BSD
compatibility.  Define __BIT_TYPES_DEFINED__ to 1 like glibc for legacy
header files.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-21 10:28:13 +02:00
Corinna Vinschen 878e65d354 Simplify guard against defining pthread types on Cygwin
* libc/include/sys/types.h: Fix a comment about Cygwin.  Simplify
	guarding pthread types against inclusion on Cygwin.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-04-21 10:27:29 +02:00
Corinna Vinschen 8cb99e8ba4 Remove cygwin/types.h 2016-04-21 10:12:02 +02:00
Sebastian Huber 9bb91b6c6b Resurrect <machine/types.h> for <sys/types.h>
Resurrect <machine/_user_types.h> for use in <sys/types.h>.  Newlib
targets may provide an own version of <machine/types.h> in their machine
directory to add custom user types for <sys/types.h>.  Check the
_SYS_TYPES_H header guard to prevent a direct include of
<machine/types.h>, since the <machine/types.h> file is a Newlib
speciality.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-21 10:08:19 +02:00
David Hoover 5c9403eaf4 Fixed semihosting for ARM when heapinfo not provided by debugger. 2016-04-21 09:51:08 +02:00
Sebastian Huber 60f867812c Remove duplicate int*_t definitions
Types are already available via <sys/_stdint.h> included some lines
above.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-20 15:58:00 +02:00
Sebastian Huber 2b569add11 Remove duplicate u_int*_t definitions
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-20 15:56:54 +02:00
Corinna Vinschen 1f02aa08d1 Add release message for commit 9409c53 2016-04-20 12:34:07 +02:00
Corinna Vinschen 9409c5335b Don't test pthread objects for being already initialized at init time
For all pthread init functions, POSIX says

  Results are undefined if pthread_FOO_init() is called specifying an
  already initialized pthread_FOO object.

So far our pthread init functions tested the incoming object if it's
already an initialized object and, if so, returned EBUSY.  That's ok
*iff* the object was already initialized.  However, as the example in
https://cygwin.com/ml/cygwin/2016-04/msg00473.html shows, an uninitialized
pthread object could also accidentally look like an initialized object
and then returning EBUSY is not ok.

Consequentially, all those tests are dangerous.  Per POSIX, an application
has to know what its doing when calling any of the pthread init functions
anyway, and re-initializing the object is just as well as undefined
behaviour as is returning EBUSY on already initialized objects.

	* thread.cc (pthread_attr_init): Drop check for already initialized
	object.
	(pthread_condattr_init): Ditto.
	(pthread_rwlockattr_init): Ditto.
	(pthread_mutexattr_init): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-04-20 12:31:45 +02:00
Sebastian Huber 6ee81f44e0 Add RTEMS support for GCC libatomic
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-20 11:01:51 +02:00
Sebastian Huber c54ee3653b Add __ssize_t to <sys/_types.h>
Add __ssize_t to <sys/_types.h> for BSD compatibility.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-19 23:45:36 +02:00
Sebastian Huber 8b6fc83330 Add RTEMS-specific types for BSD compatibility
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-19 23:42:35 +02:00
Sebastian Huber 7d22dc338d Provide in_port_t via <sys/types.h>
Provide in_port_t via <sys/types.h> if __BSD_VISIBLE for BSD
compatibility.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-19 23:40:53 +02:00
Sebastian Huber 3ce1e7901e Provide in_addr_t via <sys/types.h>
Provide in_addr_t via <sys/types.h> if __BSD_VISIBLE for BSD
compatibility.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-19 17:21:38 +02:00
Sebastian Huber e03a7056a6 Introduce __sa_family_t for BSD compatibiliy
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-19 17:06:49 +02:00
Sebastian Huber cb376b255d Introduce __socklen_t for BSD compatibility
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-19 16:51:00 +02:00
Sebastian Huber 76a2110b47 BSD compatibility for <machine/endian.h>
Introduce <machine/_endian.h> to let target based customization of
<machine/endian.h> via

 * _LITTLE_ENDIAN,
 * _BIG_ENDIAN,
 * _PDP_ENDIAN, and
 * _BYTE_ORDER.

defines.  Add definitions expected by FreeBSD to
<machine/endian.h> like

 * _QUAD_HIGHWORD,
 * _QUAD_LOWWORD,
 * __bswap16(),
 * __bswap32(),
 * __bswap64(),
 * __htonl(),
 * __htons(),
 * __ntohl(), and
 * __ntohs().

Also, if __BSD_VISIBLE

 * LITTLE_ENDIAN,
 * BIG_ENDIAN,
 * PDP_ENDIAN, and
 * BYTE_ORDER.

Targets that define __machine_host_to_from_network_defined in
<machine/_endian.h> must provide their own implementation of

 * __htonl(),
 * __htons(),
 * __ntohl(), and
 * __ntohs(),

otherwise a default implementation is provided by <machine/endian.h>.
In case of GCC defines to builtins are used.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-19 16:36:51 +02:00