ARCompact processors (ARC 600 and ARC 700) require three "nop"s after the
"flag 1" instruction. Later ARC processors do not have this requirement, so
it is possible to reduce size of "_exit_halt" for them.
libgloss/
2016-05-24 Anton Kolesov <Anton.Kolesov@synopsys.com>
* arc/crt0.S (_exit_halt): Insert nops only for ARCompact.
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.
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>
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>
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>
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>
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>
* 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.
* 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.
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>
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.
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-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.
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>
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>
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>
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>
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>
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.
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.
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>
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>
* 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>
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>
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>