Jakub Sejdak | 5 May 10:13 2016

[PATCH 1/2] Add port for Phoenix-RTOS in common configure files.

From: Kuba Sejdak <jakub.sejdak <at> phoesys.com>

---
 COPYING.NEWLIB               | 26 ++++++++++++++++++++++++++
 config.sub                   |  3 +++
 configure                    |  6 ++++++
 newlib/configure.host        | 10 ++++++++++
 newlib/libc/sys/configure    |  3 +++
 newlib/libc/sys/configure.in |  1 +
 6 files changed, 49 insertions(+)

diff --git a/COPYING.NEWLIB b/COPYING.NEWLIB
index 24e7c73..e7e1f8a 100644
--- a/COPYING.NEWLIB
+++ b/COPYING.NEWLIB
 <at>  <at>  -1023,3 +1023,29  <at>  <at>  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.

+(45) Phoenix Systems - Phoenix-RTOS targets
+
+Copyright (c) 2016 Phoenix Systems
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
(Continue reading)

Christian Mauderer | 4 May 11:45 2016
Picon

[PATCH] rtems crt0: Add stubs for arc4random.

From: Christian Mauderer <Christian.Mauderer <at> embedded-brains.de>

---
 newlib/libc/sys/rtems/crt0.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c
index 3bf7083..1a0a055 100644
--- a/newlib/libc/sys/rtems/crt0.c
+++ b/newlib/libc/sys/rtems/crt0.c
 <at>  <at>  -16,6 +16,7  <at>  <at> 
 #include <time.h> /* struct timespec */
 #include <unistd.h> /* isatty */
 #include <sys/lock.h> /* _Mutex_recursive_Control */
+#include <machine/_arc4random.h>
 #include <machine/_libatomic.h>

 void rtems_provides_crt0( void ) {}  /* dummy symbol so file always has one */
 <at>  <at>  -66,6 +67,10  <at>  <at>  RTEMS_STUB(void, _Libatomic_Protect_end(void *ptr, __uint32_t isr_level), { });
 RTEMS_STUB(void, _Libatomic_Lock_n(void *ptr, __size_t n), { });
 RTEMS_STUB(void, _Libatomic_Unlock_n(void *ptr, __size_t n), { });

+/* Stubs for routines for arc4random (from <unistd.h> and <machine/_arc4random.h> */
+RTEMS_STUB(int,  getentropy(void *ptr, __size_t n), { });
+RTEMS_STUB(void, _arc4random_getentropy_fail(void), { });
+
 #if defined(__GNUC__)
 /*
  * stubs for libstdc++ rtems-threads support functions from gcc/gthr-rtems.h
--

-- 
(Continue reading)

Jeff Johnston | 2 May 22:13 2016
Picon

Re: [PATCH] time: Always set the passed variable if any

Patch applied.

-- Jeff J.

----- Original Message -----
> 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):
> 
>     Synopsis
>         #include <time.h>
>         time_t time(time_t *timer);
> 
>     Description
>     The time function determines the current calendar time. The encoding
>     of the value is unspecified.
> 
>     Returns
>     The time function returns the implementation’s best approximation to
>     the current calendar time. The value (time_t)(-1) is returned if the
>     calendar time is not available. If timer is not a null pointer, the
>     return value is also assigned to the object it points to.
> 
> Signed-off-by: Benoît Thébaudeau <benoit <at> wsystem.com>
> ---
>  newlib/libc/time/time.c | 13 ++++++-------
(Continue reading)

Jeff Johnston | 2 May 22:04 2016
Picon

Re: [PATCH] Fix UTF-8.exp for non-multibyte targets

Patch applied.

-- Jeff J.

----- Original Message -----
> From: Yuriy Kolerov <yuriy.kolerov <at> synopsys.com>
> 
> 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 <at> synopsys.com>
> 
> 	testsuite/newlib.locale/UTF-8.exp: Don't run if multibyte support is
> 	disabled.
> 
> Signed-off-by: Yuriy Kolerov <yuriy.kolerov <at> synopsys.com>
> Signed-off-by: Anton Kolesov <anton.kolesov <at> synopsys.com>
> ---
>  newlib/testsuite/newlib.locale/UTF-8.exp | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/newlib/testsuite/newlib.locale/UTF-8.exp
> b/newlib/testsuite/newlib.locale/UTF-8.exp
> index e823a4f..94fcb5f 100644
> --- a/newlib/testsuite/newlib.locale/UTF-8.exp
> +++ b/newlib/testsuite/newlib.locale/UTF-8.exp
>  <at>  <at>  -6,6 +6,18  <at>  <at> 
(Continue reading)

Jeff Johnston | 2 May 18:06 2016
Picon

Re: [PATCH 3/3] arc: Fix crt0.S for cores without barrel shifter

Patch committed.

-- Jeff J.

----- Original Message -----
> 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 <at> synopsys.com>
> 
> 	* arc/crt0.S: Fix support for processors without barrel-shifter.
> 
> Signed-off-by: Anton Kolesov <Anton.Kolesov <at> synopsys.com>
> ---
>  libgloss/arc/crt0.S | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libgloss/arc/crt0.S b/libgloss/arc/crt0.S
> index fdcdefa..3b80184 100644
> --- a/libgloss/arc/crt0.S
> +++ b/libgloss/arc/crt0.S
>  <at>  <at>  -136,7 +136,12  <at>  <at>  __start:
>  	mov_s	r2,  <at> __sbss_start	; r2 = start of the bss section
>  	sub	r3,  <at> _end, r2		; r3 = size of the bss section in bytes
(Continue reading)

Jeff Johnston | 2 May 18:00 2016
Picon

Re: [PATCH 2/3] arc: Use new definitions for optional ARC CPU features in libgloss

Patch committed.

-- Jeff J.

----- Original Message -----
> This is similar to commit 06537f05d4b6a0d2db01c6afda1d2a0ea2588126 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 <at> synopsys.com>
> 
> 	* arc/crt0.S: Use new GCC defines to detect processor features.
> 
> Signed-off-by: Anton Kolesov <Anton.Kolesov <at> synopsys.com>
> ---
(Continue reading)

Jeff Johnston | 29 Apr 21:18 2016
Picon

Re: [PATCH 1/3] arc: Support "nano" build of newlib

Patch applied.

-- Jeff J.

----- Original Message -----
> Add necessary infrastructure to support "nano" build of newlib - optimized
> for code size. ARC aproach to this feature is similiar to ARM's one here.
> 
> libgloss/Changelog:
> 
> 2016-04-29  Anton Kolesov  <anton.kolesov <at> synopsys.com>
> 
> 	* arc/nano.specs: New file.
> 	* arc/Makefile.in: Support nano.specs.
> 	* arc/nsim.specs: Likewise.
> 
> Signed-off-by: Anton Kolesov <Anton.Kolesov <at> synopsys.com>
> ---
>  libgloss/arc/Makefile.in | 10 +++++++++-
>  libgloss/arc/nano.specs  | 18 ++++++++++++++++++
>  libgloss/arc/nsim.specs  | 10 ++++++++--
>  3 files changed, 35 insertions(+), 3 deletions(-)
>  create mode 100644 libgloss/arc/nano.specs
> 
> diff --git a/libgloss/arc/Makefile.in b/libgloss/arc/Makefile.in
> index ab8ad6d..58f0c57 100644
> --- a/libgloss/arc/Makefile.in
> +++ b/libgloss/arc/Makefile.in
>  <at>  <at>  -58,6 +58,9  <at>  <at>  NSIM_OBJS = \
>  NSIM_INSTALL = install-nsim
(Continue reading)

Thomas Preudhomme | 28 Apr 18:06 2016

[PATCH, newlib] Fix strlen using Thumb-2 with -Os -marm

Hi,

Currently, the selection of which strlen routine to use for ARM processors is 
as follows (see newlib/libc/machine/arm/strlen.S or 
newlib/libc/machine/arm/strlen-stub.c):

#if optimize for size
#if defined __thumb__ && !defined __thumb2__
Thumb-1 routine
#else
Thumb-2 routine
#endif
#else
something
#endif

When compiling for ARM ISA, __thumb__ would be 0 and thus the Thumb-2 routine 
would be chosen, no matter the architecture selected. This patch changes the 
logic to only look for capabilities of the processor. It also fallback to the 
C implementation for targets with only ARM execution state (armv4 and armv5).

ChangeLog entry is as follows:

*** newlib/ChangeLog ***

2016-04-18  Thomas Preud'homme  <thomas.preudhomme <at> 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.
(Continue reading)

Mihail Feraru | 28 Apr 17:20 2016
Picon

timeval.h bug

I was trying to compile Newlib for my OS and I got following error:

In file included from
/home/littlewho/Desktop/sourcecode/photon/devel/src/newlib/newlib/libc/include/sys/time.h:42:0,
                 from ../../../../../newlib/newlib/libc/time/time.c:38:
/home/littlewho/Desktop/sourcecode/photon/devel/src/newlib/newlib/libc/include/sys/_timeval.h:51:1:
error: expected '=', ',', ';', 'asm' or '__attribute__' before
'struct'
 struct timeval {
 ^

I added ; before struct timeval and now works fine, but I am sure that
; should be in another place. I also got some warnings that are not
related to timeval.h error:

../../../../../newlib/newlib/libc/stdlib/aligned_alloc.c: In function
'aligned_alloc':
../../../../../newlib/newlib/libc/stdlib/aligned_alloc.c:35:10:
warning: implicit declaration of function 'posix_memalign'
[-Wimplicit-function-declaration]
  error = posix_memalign(&p, alignment, size);
          ^
../../../../../newlib/newlib/libc/stdlib/quick_exit.c: In function 'quick_exit':
../../../../../newlib/newlib/libc/stdlib/quick_exit.c:80:2: warning:
implicit declaration of function '_exit'
[-Wimplicit-function-declaration]
  _exit(status);
  ^
../../../../../newlib/newlib/libc/stdlib/quick_exit.c:81:1: warning:
'noreturn' function does return
(Continue reading)

Wilco Dijkstra | 22 Apr 14:29 2016

[PATCH][AArch64] Add rawmemchr

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 <at> 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.

---
 newlib/libc/machine/aarch64/Makefile.am      |  2 +
 newlib/libc/machine/aarch64/Makefile.in      | 19 +++++++-
 newlib/libc/machine/aarch64/rawmemchr-stub.c | 31 +++++++++++++
 newlib/libc/machine/aarch64/rawmemchr.S      | 68 ++++++++++++++++++++++++++++
 4 files changed, 118 insertions(+), 2 deletions(-)
 create mode 100644 newlib/libc/machine/aarch64/rawmemchr-stub.c
 create mode 100644 newlib/libc/machine/aarch64/rawmemchr.S

diff --git a/newlib/libc/machine/aarch64/Makefile.am b/newlib/libc/machine/aarch64/Makefile.am
index e2a577c..e8b8197 100644
--- a/newlib/libc/machine/aarch64/Makefile.am
+++ b/newlib/libc/machine/aarch64/Makefile.am
 <at>  <at>  -19,6 +19,8  <at>  <at>  lib_a_SOURCES += memmove-stub.c
 lib_a_SOURCES += memmove.S
 lib_a_SOURCES += memset-stub.c
 lib_a_SOURCES += memset.S
(Continue reading)

David Hoover | 19 Apr 15:54 2016
Picon

Semihosting fix

Hello,

Code was introduced in commit 8d98f956cc398d086794e19051c3380d599022da
that breaks semihosting for ARM Cortex targets running in many
environments.

To implement semihosting, ARM bkpt or svc instructions are used to
provide system calls implementing more-or-less standard functions. One
of these system calls (HeapInfo) can be used to provide dynamic heap
and stack information to the user application.

More often than not, dynamic stack and heap information is not
available, and the system call generally provides null values in this
case. Segger GDBServer and OpenOCD 0.9.9 are examples of this.

The standard C library behavior when heap information is not available
is to permit the heap to grow (each time sbrk is called) until the
heap runs into the stack pointer. This is how sbrk worked before
commit 8d98f956cc398d086794e19051c3380d599022da. The current behavior,
when heap information is missing, is that crt0.S code writes the null
value into the __heap_limit variable, causing sbrk to believe that
the heap is full, causing most newlib calls to fail (like printf).

Here is a two-instruction fix that checks that the heap limit provided
by HeapInfo is not zero before writing it to __heap_limit. No sane
implementation would use 0 as the upper value of the heap, so this
fix, which has been tested, should not break anything. Commit
8d98f956cc398d086794e19051c3380d599022da, however, breaks all Cortex M
semihosting running on the two debuggers mentioned above, and probably
more.
(Continue reading)


Gmane