libgloss:
* arm/Makefile.in: Add newlib/libc/machine/arm to the include path if
newlib is present.
* arm/arm.h: Include acle-compat.h.
(THUMB_V7_V6M): Rename to ...
(PREFER_THUMB): This. Use ACLE macros __ARM_ARCH_ISA_ARM instead of
__ARM_ARCH_6M__ to decide whether to define it.
(THUMB1_ONLY): Define for Thumb-1 only targets.
(THUMB_V7M_V6M): Rename to ...
(THUMB_VXM): This. Defined based on __ARM_ARCH_ISA_ARM, excluding
ARMv7.
* arm/crt0.S: Use THUMB1_ONLY rather than __ARM_ARCH_6M__,
!__ARM_ARCH_ISA_ARM rather than THUMB_V7M_V6M for fp enabling, and
PREFER_THUMB rather than THUMB_V7_V6M. Rename other occurences of
THUMB_V7M_V6M to THUMB_VXM.
* arm/linux-crt0.c: Likewise.
* arm/redboot-crt0.S: Likewise.
* arm/swi.h: Likewise.
* arm/trap.S: Likewise.
newlib:
* libc/machine/arm/memcpy-stub.c: Use ACLE macros __ARM_ARCH_ISA_THUMB
and __ARM_ARCH_ISA_ARM to check for Thumb-2 only targets rather than
__ARM_ARCH and __ARM_ARCH_PROFILE.
* libc/machine/arm/memcpy.S: Likewise.
* libc/machine/arm/setjmp.S: Likewise for Thumb-1 only target and
include acle-compat.h.
* libc/machine/arm/strcmp.S: Likewise for Thumb-1 and Thumb-2 only
target and include acle-compat.h.
* libc/sys/arm/arm.h: Include acle-compat.h.
(THUMB_V7_V6M): Rename to ...
(PREFER_THUMB): This. Use ACLE macro __ARM_ARCH_ISA_ARM instead of
__ARM_ARCH_6M__ to decide whether to define it.
(THUMB1_ONLY): Define for Thumb-1 only targets.
(THUMB_V7M_V6M): Rename to ...
(THUMB_VXM): This. Defined based on __ARM_ARCH_ISA_ARM, excluding
ARMv7.
* libc/sys/arm/crt0.S: Use PREFER_THUMB rather than THUMB_V7_V6M and
rename THUMB_V7M_V6M into THUMB_VXM.
* libc/sys/arm/swi.h: Likewise.
- Move types and defines to
<machine/_threads.h> so that it can be customized per target.
* libc/include/threads.h: New.
* libc/sys/rtems/include/machine/_threads.h: Likewise.
On 31/07/15 10:34, Richard Earnshaw wrote:
> On 31/07/15 10:28, Andre Vieira wrote:
>> newlib/ChangeLog:
>> 2015-07-28 Andre Vieira <andre.simoesdiasvieira@arm.com>
>>
>> * libc/sys/arm/sys/param.h: Include machine/param.h
>> (HZ, NOFILE, PATHSIZE): Define.
>>
>> param_refactor_1.patch
>>
>>
>> From abc2d5f3398721f6ca891b9581feaba58730b19c Mon Sep 17 00:00:00 2001
>> From: Andre Simoes Dias Vieira <andsim01@arm.com>
>> Date: Tue, 28 Jul 2015 12:10:59 +0100
>> Subject: [PATCH 1/2] Moved param configuration to machine/param.h
>>
>> ---
>> newlib/libc/sys/arm/sys/param.h | 12 ++++++++++--
>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/newlib/libc/sys/arm/sys/param.h b/newlib/libc/sys/arm/sys/param.h
>> index adc066e9a8756e07edaaa8cadc79b5f05c996ac9..622c371972ab3c9dbb93ea5c51323a593e2a171a 100644
>> --- a/newlib/libc/sys/arm/sys/param.h
>> +++ b/newlib/libc/sys/arm/sys/param.h
>> @@ -3,9 +3,17 @@
>> #ifndef _SYS_PARAM_H
>> # define _SYS_PARAM_H
>>
>> -# define HZ (100)
>> -# define NOFILE (60)
>> +#include <machine/param.h>
>> +
>> +#ifndef HZ
>> +# define HZ (60)
>
> Why have you changed the value for HZ? It seems that, by convention,
> ARM boards have always used 100.
>
> R.
>
>> +#endif
>> +#ifndef NOFILE
>> +# define NOFILE>(60)
>> +#endif
>> +#ifndef PATHSIZE
>> # define PATHSIZE (1024)
>> +#endif
>>
>> #define BIG_ENDIAN 4321
>> #define LITTLE_ENDIAN 1234
>>
>
Hi Richard,
ARM's machine/param.h that is included in "#include <machine/param.h>",
before the 'ifndef' already defines HZ to be 100. This file was already
there, it was just not being used. I understand that this 'ifndef' might
be confusing, though I decided to add it to mimic the behavior of the
default sys/param.h.
There is however an unrelated issue with this patch, a typo in the
"#define NOFILE" that crept in there due to some copy pasting when
splitting the patch.
Here is a fixed version.
BR,
Andre
newlib/ChangeLog:
2015-07-28 Andre Vieira <andre.simoesdiasvieira@arm.com>
* libc/sys/arm/sys/param.h: Include machine/param.h
(HZ, NOFILE, PATHSIZE): Define.
From abc2d5f3398721f6ca891b9581feaba58730b19c Mon Sep 17 00:00:00 2001
From: Andre Simoes Dias Vieira <andsim01@arm.com>
Date: Tue, 28 Jul 2015 12:10:59 +0100
Subject: [PATCH 1/2] Moved param configuration to machine/param.h
Only on first call to the recursive malloc lock the restore value of
exception enable fields is stored.
* libc/sys/or1k/mlock.c: Fix exception enable saving
Sorry, there was a typo in <sys/lock.h> which leads to memory corruption
since not enough space is reserved for the lock object.
newlib/ChangeLog
2015-07-30 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/sys/rtems/include/sys/lock.h (__LOCK_INIT_RECURSIVE): Use
proper type.
During libgcc build the first include search path for <...> is
"../newlib/libc/sys/rtems/include". Move all RTEMS specific header
files to "libc/sys/rtems/include" so that they can be found. Later
during libc build the header files in the previous location were somehow
present, but for libgcc build they were invisible. This change is
necessary to use <pthread.h> for the GCC thread model implementation.
newlib/ChangeLog
2015-07-27 Sebastian Huber <sebastian.huber@embedded-brains.de>
libc/sys/rtems/machine/_types.h: Move to ...
libc/sys/rtems/include/machine/_types.h: ... here.
libc/sys/rtems/machine/limits.h: Move to ...
libc/sys/rtems/include/machine/limits.h: ... here.
libc/sys/rtems/machine/param.h: Move to ...
libc/sys/rtems/include/machine/param.h: ... here.
libc/sys/rtems/sys/cpuset.h: Move to ...
libc/sys/rtems/include/sys/cpuset.h: ... here.
libc/sys/rtems/sys/dirent.h: Move to ...
libc/sys/rtems/include/sys/dirent.h: ... here.
libc/sys/rtems/sys/param.h: Move to ...
libc/sys/rtems/include/sys/param.h: ... here.
libc/sys/rtems/sys/syslimits.h: Move to ...
libc/sys/rtems/include/sys/syslimits.h: ... here.
libc/sys/rtems/sys/utime.h: Move to ...
libc/sys/rtems/include/sys/utime.h: ... here.
* libc/include/sys/config.h: Dynamic reentrancy for or1k sys targets
* libc/sys/or1k/: New system for or1k baremetal
* libc/sys/or1k/Makefile.am: New file
* libc/sys/or1k/Makefile.in: New file
* libc/sys/or1k/aclocal.m4: New file
* libc/sys/or1k/configure.in: New file
* libc/sys/or1k/configure: New file
* libc/sys/or1k/getreent.S: New file
* libc/sys/or1k/mlock.S: New file
* libc/sys/or1k/or1k-asm.S: New file
Found by:
find -name '*.h' |xargs grep -i 'attribute.*(([a-z]'
For an example of the type of bugs this causes, try compiling this valid
C11 program (it's valid because 'noreturn' is reserved for use in the
user namespace unless you include <stdnoreturn.h>):
$ cat foo.c
#define noreturn __attribute__((noreturn))
#include <stdlib.h>
$ gcc -c -o foo.o -Wall foo.c
In file included from /usr/include/stdlib.h:11:0,
from foo.c:2:
foo.c:1:18: error: expected ')' before '__attribute__'
#define noreturn __attribute__((noreturn))
^
/usr/include/stdlib.h:66:28: error: expected ',' or ';' before ')' token
_VOID _EXFUN(abort,(_VOID) _ATTRIBUTE ((noreturn)));
^
* libc/machine/spu/spu_timer_internal.h: Decorate attribute names
with __, for namespace safety.
* libc/machine/xscale/machine/profile.h: Likewise.
* libc/include/stdlib.h: Likewise.
* libc/include/_ansi.h: Likewise.
* libc/include/sys/unistd.h: Likewise.
* libc/sys/linux/linuxthreads/libc-symbols.h: Likewise.
* libc/sys/linux/linuxthreads/internals.h: Likewise.
* libc/sys/linux/machine/i386/weakalias.h: Likewise.
* libc/sys/linux/machine/i386/dl-procinfo.h: Likewise.
* libc/sys/linux/machine/i386/dl-machine.h: Likewise.
* libc/sys/linux/libc-symbols.h: Likewise.
* libc/sys/linux/iconv/gconv_charset.h: Likewise.
* libc/sys/linux/include/resolv.h: Likewise.
* libc/sys/linux/sys/unistd.h: Likewise.
* libc/sys/linux/dl/atomicity.h: Likewise.
* libc/sys/linux/dl/dynamic-link.h: Likewise.
* libc/sys/linux/dl/ldsodefs.h: Likewise.
* configure.host (sys_dir, newlib_cflags): Set sys_dir to tirtos and use
-D__DYNAMIC_REENT__ and -DMALLOC_PROVIDED compiler options for TIRTOS
target.
* libc/stdio/local.h (_STDIO_CLOSE_PER_REENT_STD_STREAMS): Change #ifdef
to not define this macro when __tirtos__ is defined.
* libc/sys/tirtos : Add support for TIRTOS.
* libc/sys/tirtos/Makefile.am, libc/sys/tirtos/lock.c: New files.
* libc/sys/tirtos/configure.in, libc/sys/tirtos/include/sys/lock.h: Ditto.
header includes. Include <sys/features.h> for
__GNUC_PREREQ__().
(__u?int.*_t): Define via GCC provided __U?INT.*_TYPE__ if
available.
(__intptr_t): Define.
(__uintptr_t): Likewise.
* libc/include/stdint.h: Include <machine/_default_types.h>
instead of <_ansi.h>.
(u?int.*_t): Define via __u?int.*_t provided by
<machine/_default_types.h>.
(u?int_fast.*_t): Define via GCC provided
__U?INT_FAST.*_TYPE__ if available.
(U?INT.*(MIN|MAX)): Define via GCC provided __U?INT.*(MIN|MAX)__
if available.
(U?INT.*_C): Define via GCC provided __U?INT.*_C if available.
* libc/include/sys/cdefs.h: Use <machine/_default_types.h>
instead of <stdint.h>.
* libc/sys/rtems/sys/cpuset.h: Likewise.
* libc/sys/rtems/machine/_types.h: Include <stdint.h> for
FreeBSD compatibility.