Sebastian Huber | 18 Apr 10:10 2016

What is the purpose of __need_inttypes?


what is the purpose of __need_inttypes? It is only defined by 

This commit messages

     2002-08-19  Jeff Johnston  <jjohnstn <at>>

             * libc/include/sys/types.h: Support __need_inttypes macro
             that only sets the __intxx and __uintxx types.
             * libc/machine/powerpc/ Add stdlib to include 
             to get mprec.h.
             * libc/machine/powerpc/ Regenerated.
             * libc/machine/powerpc/vfprintf.c: Fix state variable type.
             * libc/machine/powerpc/vfscanf.c: Fix state variable type.  
             redundant fixed-point conversion prototypes.
             * libc/machine/powerpc/machine/stdlib.h[__SPE__]: Include 
             after setting __need_inttypes.

suggests that we should be able to get rid of __need_inttypes and simply 
include <machine/_default_types.h>? However, no __intxx and __uintxx 
types are used in this file.


Sebastian Huber, embedded brains GmbH

(Continue reading)

Sebastian Huber | 18 Apr 08:47 2016

[PATCH] Fix definition of __size_t

Fix definition of __size_t in case __SIZE_TYPE__ is not defined.

Signed-off-by: Sebastian Huber <sebastian.huber <at>>
 newlib/libc/include/sys/_types.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h
index 06ddd83..297b1ea 100644
--- a/newlib/libc/include/sys/_types.h
+++ b/newlib/libc/include/sys/_types.h
 <at>  <at>  -127,9 +127,9  <at>  <at>  typedef _off64_t _fpos64_t;
 typedef __SIZE_TYPE__ __size_t;
 #if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
-typedef int __size_t;
+typedef unsigned int __size_t;
-typedef long __size_t;
+typedef unsigned long __size_t;


Joel Sherrill | 16 Apr 18:20 2016

bare metal x86_64 crt0


I was curious if anyone had a crt0 for x86_64 that was
under a newlib bare metal acceptable license.

RTEMS is looking into an x86_64 port and getting
a jump on the crt0 and EFI booting would be great.



Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill <at>        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35806
Support Available                (256) 722-9985

Sebastian Huber | 15 Apr 09:06 2016

Re: [PATCH 001/114] Add initial port for Phoenix-RTOS.

Hello Jakub,

On 15/04/16 08:46, Jakub Sejdak wrote:
> Hi again,
> Just to be sure that I understood you correctly - should I send any
> new patches or will you handle this alone?
> I can see that you already have a lot of work, but can you
> approximately estimate when will those patcches be applied?

I am not a Newlib maintainer and added just my two cents to this topic.

> Thank,
> Jakub Sejdak
> 2016-04-12 12:39 GMT+02:00 Jakub Sejdak <jakub.sejdak <at>>:
>> Hi Sebastian,
>> Ad 1) I actually copied this license header from some other existing
>> file and changed first line to include our URL.
>> Feel free to edit it so it could fit newlib licensing. But it still
>> would be nice to have this URL somewhere.

For Newlib a 2-clause or 3-clause BSD license would be fine.

>> Ad 2) The idea behind copying some of the standard headers was to
>> avoid duplicating some definitions in newlib and in our kernel.
>> So for example struct tm is defined directly in kernel header and
(Continue reading)

Joel Sherrill | 14 Apr 23:20 2016

[PATCH] libc/sys/rtems/crt0.c: Add <sys/lock.h> symbols required to link autoconf probes

The dummy crt0.c provided by the RTEMS target provides stubs of
symbols which would normally be provided by RTEMS. This patch adds
stubs for posix_memalign() as well as the synchronization methods
prototyped in <sys/lock.h>.
 newlib/libc/sys/rtems/crt0.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c
index a6f48f2..8d87fd4 100644
--- a/newlib/libc/sys/rtems/crt0.c
+++ b/newlib/libc/sys/rtems/crt0.c
 <at>  <at>  -15,6 +15,7  <at>  <at> 
 #include <signal.h> /* sigset_t */
 #include <time.h> /* struct timespec */
 #include <unistd.h> /* isatty */
+#include <sys/lock.h> /* _Mutex_recursive_Control */

 void rtems_provides_crt0( void ) {}  /* dummy symbol so file always has one */

 <at>  <at>  -27,7 +28,37  <at>  <at>  RTEMS_STUB(void *,malloc(size_t s), { return 0; })
 RTEMS_STUB(void *,realloc(void* p, size_t s), { return 0; })
 RTEMS_STUB(void, free(void* ptr), { })
 RTEMS_STUB(_PTR, calloc(size_t s1, size_t s2), { return 0; })
+RTEMS_STUB(int, posix_memalign(void **p, size_t si, size_t s2), { return -1; })
+/* Stubs for routines from RTEMS <sys/lock.h> */
+RTEMS_STUB(void, _Mutex_Acquire(struct _Mutex_Control *p), { })
+RTEMS_STUB(int,  _Mutex_Acquire_timed(struct _Mutex_Control *p1, const struct timespec *p2), {
(Continue reading)

Jens Wiklander | 14 Apr 09:04 2016

License terms for a newlib source file


I'm working on an open source project with BSD license (OP-TEE where we have imported some parts
of newlib. To make it clear for end users we're including the exact
license and copyright of each file in our project at the beginning of
each file.

Can you help me with license and copyright for libc/machine/arm/setjmp.S?


Yaakov Selkowitz | 14 Apr 06:55 2016

[PATCH] Feature test macros overhaul: string.h and strings.h overlaps

strings.h is the header mandated for these functions in POSIX.1 prior to
2008 (when most of these were removed).  The declarations in string.h are
only for BSD compatibility.  But when both headers are included, avoid
duplicate declarations.

Also, mark stpcpy and stpncpy as POSIX.1-2008.

Signed-off-by: Yaakov Selkowitz <yselkowi <at>>
 newlib/libc/include/string.h  | 14 +++++++-------
 newlib/libc/include/strings.h |  5 +++++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index 68ee412..56c7fc2 100644
--- a/newlib/libc/include/string.h
+++ b/newlib/libc/include/string.h
 <at>  <at>  -46,7 +46,7  <at>  <at>  size_t	 _EXFUN(strxfrm,(char *__restrict, const char *__restrict, size_t));
 char 	*_EXFUN(strtok_r,(char *__restrict, const char *__restrict, char **__restrict));
+#if __BSD_VISIBLE /* POSIX declaration is in <strings.h> */
 int	 _EXFUN(bcmp,(const void *, const void *, size_t));
 void	 _EXFUN(bcopy,(const void *, void *, size_t));
 void	 _EXFUN(bzero,(void *, size_t));
 <at>  <at>  -56,10 +56,8  <at>  <at>  void	 _EXFUN(explicit_bzero,(void *, size_t));
 int	 _EXFUN(timingsafe_bcmp,(const void *, const void *, size_t));
 int	 _EXFUN(timingsafe_memcmp,(const void *, const void *, size_t));
(Continue reading)

Sebastian Huber | 13 Apr 10:44 2016

Inconsistent guards for internal and user types


Newlib defines defaults for internal types via <sys/_types.h> and uses 
<machine/_types.h> to let systems define their own type if necessary. 
For example

#ifndef __dev_t_defined
typedef short __dev_t;

However, the __*_t_defined pattern conflicts with the glibc type guard 
pattern for user types, e.g. dev_t in this this example. I suggest to 
introduce a __machine_*_t_pattern for internal types (defined by 
<machine/_types.h>, used by <sys/_types.h>). For example

#ifndef __machine_dev_t_defined
typedef short __dev_t;


Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber <at>
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

(Continue reading)

Sebastian Huber | 13 Apr 08:18 2016

Cygwin off_t, dev_t, uid_t and gid_t definitions


we have currently an exception for Cygwin in the <sys/types.h> header:

#ifndef __CYGWIN__    /* which defines these types in it's own types.h. */
typedef _off_t    off_t;
typedef __dev_t dev_t;
typedef __uid_t uid_t;
typedef __gid_t gid_t;

Cygwin defines these types in "winsup/cygwin/include/cygwin/types.h":

#ifndef __off_t_defined
#define __off_t_defined
/* Based on the newlib definitions. */
#if __WORDSIZE == 64
typedef _off_t off_t;
typedef _off64_t off_t;
#endif /*__off_t_defined*/

#ifndef __dev_t_defined
#define __dev_t_defined
typedef __int16_t __dev16_t;
typedef __uint32_t dev_t;
#endif /*__dev_t_defined*/

#ifndef __uid_t_defined
(Continue reading)

Sebastian Huber | 13 Apr 08:07 2016

__loff_t definition


the default (non-Linux) __loff_t definition is currently

#ifdef __GNUC__
__extension__ typedef long long int __loff_t;
typedef long int __loff_t;

this is probably a bug, since structure layouts should be independent of 
the actual compiler especially for a C library.

For example _off64_t is defined like this:

#ifndef __off64_t_defined
__extension__ typedef long long _off64_t;

In glibc __loff_t is defined via __quad_t.


Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber <at>
PGP     : Public key available on request.

(Continue reading)

Jon Turney | 12 Apr 13:32 2016

[RFC][PATCH] Make manpages (v2)

This is an update of my previous patch at [1]

Currently, newlib has no manpages.  Attached is a patch which generates 
manpages for newlib functions which have makedoc markup.

texinfo (by design) does not lend itself well to generating manpages, so 
instead DocBook XML is used as an intermediate format.

This patch adds a makedocbook tool, which, similarly to the makedoc 
tool, processes source files to extract markup, but rather than 
.texinfo, it generates DocBook XML, which can then be processed into 

Similarly to the info documentation, the man pages are not built by 
'make all', but by 'make doc', and can be installed with 'make install-man'.

This just adds a mechanism for generating manpages.  The current 
mechanisms for generating documentation in .info and other formats are 
unchanged and there is no suggestion to change that.

For ease of reviewing, this patch doesn't contain changes.

I would appreciate any comments you have on the approach and the 

There are at least the following issues with this patch:

* I haven't tested that documentation is correctly included/excluded 
depending on the newlib configuration.
(Continue reading)