- move the description of the alternative form produced with the # flag from a
nested table to an additional table
2015-11-12 Jon Turney <jon.turney@dronecode.org.uk>
* libc/stdio/sprintf.c: Simplify documentation markup.
* libc/stdio/swprintf.c: Ditto.
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
- use bullet points to separate width, size and type sections, rather than using
rows in an enormous table, for consistency with sprintf and swprintf.
- use code markup for size bullet point for consistency
- use a texinfo multitable for description of the size flags, rather than some
preformatted text
- tidy up some whitespace so type flags are all aligned
2015-11-12 Jon Turney <jon.turney@dronecode.org.uk>
* libc/stdio/sscanf.c: Improve documentation markup.
* libc/stdio/swscanf.c: Ditto.
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
The patch moves the inline ASM thumb1 -O2 implementation out into its
own .S file.
Tested by building newlib and comparing libc.a binaries before and
after for all permutations of:
Architectures:
armv4 armv4t armv5 armv5t armv5te armv6 armv6j armv6k
armv6z armv6kz armv6t2 armv6-m armv6s-m armv7 armv7-a
armv7ve armv7-r armv7-m armv7e-m armv8-a iwmmxt iwmmxt2
ISAs:
thumb arm
Optimization Levels:
Os O2
Excluding:
armv6s-m -mthumb
armv6-m -mthumb
armv6zk -mthumb
armv6z -mthumb
armv6k -mthumb
armv6j -mthumb
The patch adds strlen.S to contain the complementary preprocessor
logic to strlen-stub.c intended to provide #inclusion of alternative
.S implementations.
Initially we just include the existing strlen-armv7.S implementation.
We rewrite _ISA_ARMV7 in both strlen.S and strlen-stub.c to use the
underlying existing underlying defintion from arm_asm.h in order to
avoide including that file, this is in effect the first step towards a
move to ACLE predefines only.
Tested by building newlib and comparing libc.a binaries before and
after for all permutations of:
Architectures:
armv4 armv4t armv5 armv5t armv5te armv6 armv6j armv6k
armv6z armv6kz armv6t2 armv6-m armv6s-m armv7 armv7-a
armv7ve armv7-r armv7-m armv7e-m armv8-a iwmmxt iwmmxt2
ISAs:
thumb arm
Optimization Levels:
Os O2
Excluding:
armv6s-m -mthumb
armv6-m -mthumb
armv6zk -mthumb
armv6z -mthumb
armv6k -mthumb
armv6j -mthumb
In order to maintain consistency both within machine/arm and between
machine/arm and machine/aarch64, rename the 'c' stub to -stub.c.
Tested by building newlib and comparing libc.a binaries before and
after for all permutations of:
Architectures:
armv4 armv4t armv5 armv5t armv5te armv6 armv6j armv6k
armv6z armv6kz armv6t2 armv6-m armv6s-m armv7 armv7-a
armv7ve armv7-r armv7-m armv7e-m armv8-a iwmmxt iwmmxt2
ISAs:
thumb arm
Optimization Levels:
Os O2
Excluding:
armv6s-m -mthumb
armv6-m -mthumb
armv6zk -mthumb
armv6z -mthumb
armv6k -mthumb
armv6j -mthumb
This patch flattens the condition code selection used in strlen in an
attempt to make the guarding condition for each alternative
implementation clearer and to structure the logic in a manner that
makes it easier to maintain complementary logic between the
alternative 'C' and assembler implementations.
Tested by building newlib and comparing libc.a binaries before and
after for all permutations of:
Architectures:
armv4 armv4t armv5 armv5t armv5te armv6 armv6j armv6k
armv6z armv6kz armv6t2 armv6-m armv6s-m armv7 armv7-a
armv7ve armv7-r armv7-m armv7e-m armv8-a iwmmxt iwmmxt2
ISAs:
thumb arm
Optimization Levels:
Os O2
Excluding:
armv6s-m -mthumb
armv6-m -mthumb
armv6zk -mthumb
armv6z -mthumb
armv6k -mthumb
armv6j -mthumb
ARM newlib has various strcmp implementations that use .cfi_*
directives to generate unwind information.
The effect of this is that the generated objects contain .eh_frame
sections. However, ARM uses its own unwind info format, not
.eh_frame, which is generated by ARM-specific directives, not .cfi_*.
The .eh_frame sections are useless, but also not removed by strip and
may be loaded into memory at runtime.
This patch fixes this by using .cfi_sections .debug_frame (as in
glibc) so that the directives generate .debug_frame instead.
.debug_frame is useful for the debugger, can be removed by strip, and
is not loaded into memory at runtime.
* libc/machine/arm/strcmp-arm-tiny.S: Use .cfi_sections
.debug_frame.
* libc/machine/arm/strcmp-armv4.S: Likewise.
* libc/machine/arm/strcmp-armv4t.S: Likewise.
* libc/machine/arm/strcmp-armv6.S: Likewise.
* libc/machine/arm/strcmp-armv6m.S: Likewise.
* libc/machine/arm/strcmp-armv7.S: Likewise.
* libc/machine/arm/strcmp-armv7m.S: Likewise.
The patch cleans up the auto configury mechanism used to select
different implementations of memchr for various architecture versions.
The approach here is to remove the selection of memchr within automake
and instead use complimentary logic in memchr-stub.c and memchr.S to
choose between the gerneric memchr.c implementation or one of the
architecture specific implementations.
This patch also changes the selection criteria inline with the
previous proposal here:
https://sourceware.org/ml/newlib/2015/msg00752.html
but using the ACLE predefines.
Regressed for armv7-a armv5 armv8-a, correct selection of memcpy
implementation by manual inspection of a test program built for these
three architectures.
This patch cleans up the auto configury mechanism used to select
different implementations of memcpy for various architecture versions.
The approach here is to remove the selection of memcpy within automake
and instead use complimentary logic in memcpy-stub.c and memcpy.S to
choose between the generic memcpy.c implemenation or one of the
architecture specific memcpy*.S implemenations.
Regressed for armv7-a armv5 armv8-a, correct selection of memcpy
implementation by manual inspection of a test program built for these
three architectures.
This revised patch flips the remaining preprocessor logic in
memcpy-stub.c to use ACLE defines as requested in the previous review
and removes the now disused HAVE_ARMV7A and HAVE_ARMV8A configure.in
support.
The newlib configury logic that detects architecture version and
chooses an appropriate memcpy implementation does not consider
ARMv8-a.
This patch adds configury logic to detect ARMv8-a along with the
associated changes in Makefile.am and memcpy.
This is mandated by POSIX.
2015-10-30 Sebastian Huber <sebastian.huber@embedded-brains.de>
libc/include/pthread.h: Include <sched.h> instead of
<sys/sched.h>.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
aligned_alloc() is implemented in terms of posix_memalign() which is
only declared in <stdlib.h> but not defined in Newlib in general. At
least Linux and RTEMS implement this function.
newlib/ChangeLog
2015-10-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/stdlib/Makefile.am (GENERAL_SOURCES): Add
alloc_aligned.c.c.
* libc/stdlib/Makefile.in: Regenerate.
* libc/stdlib/aligned_alloc.c: New.
Import some <stdlib.h> function declarations from latest FreeBSD and
implement them. I am not sure if we should call the global reent
cleanup in quick_exit() similar to exit().
newlib/ChangeLog
2015-10-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/stdlib.h (at_quick_exit): Declare.
(quick_exit): Likewise.
* libc/stdlib/Makefile.am (GENERAL_SOURCES): Add
quick_exit.c.
* libc/stdlib/Makefile.in: Regenerate.
* libc/stdlib/quick_exit.c: New.
- 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.
* include/sys/unistd.h (_SC_LEVEL*): Add cache-related variables as
on Linux.
* fhandler_proc.cc (format_proc_cpuinfo): Fetch cache information
from new cache functions in sysconf.cc, get_cpu_cache_intel and
get_cpu_cache_amd.
* sysconf.cc (__nt_query_system): New local helper.
(get_nproc_values): Utilize __nt_query_system on pre-Windows 7 systems.
Use GetLogicalProcessorInformationEx otherwise to handle more than
64 CPUs. Only handle _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN.
(get_phys_pages): New helper to handle _SC_PHYS_PAGES.
(cpuid2_cache_descriptor): New array to map Intel CPUID 2 descriptor
values to cache type, cache size, associativity and linesize.
(cpuid2_cache_desc_compar): Comparision function for bsearch over
cpuid2_cache_descriptor.
(get_cpu_cache_intel_cpuid2): New function to fetch cache info from
Intel CPUID 2.
(get_cpu_cache_intel_cpuid4): Ditto from Intel CPUID 4.
(get_cpu_cache_intel): New function as CPU-specific entry point.
(assoc): New array to map associativity values from AMD CPUID
0x80000006.
(get_cpu_cache_amd): New function to fetch cache info from AMD CPUIDs
0x80000005 and 0x80000006.
(get_cpu_cache): New function to fetch cache info.
(sca): Call get_phys_pages if _SC_PHYS_PAGES is requested. Call
get_cpu_cache for new _SC_* cache requests.
(SC_MAX): Set to _SC_LEVEL4_CACHE_LINESIZE.
(get_phys_pages(void)): Call get_phys_pages(int).
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* new-features.xml (ov-new2.3): Document sysconf cache addition.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Hi!
I've got the situation, that the function strlen() occurs twice in libc.a
(building newlib for ARM-V7a and Size-Optimized).
In newlib/libc/machine/arm/strlen.c there are the pre-processor stetements ...
#if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED) || \
(defined (__thumb__) && !defined (__thumb2__))
/*...*/
#else
#if !(defined(_ISA_ARM_7) || defined(__ARM_ARCH_6T2__))
/*...*/
#endif
and in newlib/libc/machine/arm/strlen-armv7.S the "exclude" begins with
/* NOTE: This ifdef MUST match the ones in arm/strlen.c
We fallback to the one in arm/strlen.c for size optimised or
for older architectures. */
#if defined(_ISA_ARM_7) || defined(__ARM_ARCH_6T2__) && \
!(defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED) || \
(defined (__thumb__) && !defined (__thumb2__)))
But this is not completely contrary to arm/strlen.c (see above)!
To fix the logical statement in arm/strlen-armv7.S there are parentheses needed
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Hi,
As I mentioned recently [1], newlib is providing a "kill" symbol to link
against, without declaring "kill" in signal.h. This is confusing for the
libgfortran build, which tries to link against kill (which succeeds), then
tries to use it (which triggers -Werror=implicit-function-declaration).
This patch implements my suggestion in that thread - making the declaration
of 'kill' in libc/include/sys/signal.h unconditional.
I've tested this by building a modified libgfortran on AArch64/ARM to see
that the Werror goes away, and the libgfortran build succeeds.
Is something like this OK for newlib? If so, can someone please commit
it on my behalf, as I have no commit access here.
Otherwise, what is your preferred direction for me to take this patch?
Thanks,
James
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
* libc/include/sys/signal.h [__CYGWIN__]: include <sys/ucontext.h>
if compiling for POSIX.1-2008.
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
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
Fix documentation build since 6c2b1842 by not including stdio64 functions in the
reent syscalls menu if the node itself isn't going to be included because it's
under the STDIO64 flag.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
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.
This is an optimized memset for AArch64. Memset is split into 4 main
cases: small sets of up to 16 bytes, medium of 16..96 bytes which are
fully unrolled. Large memsets of more than 96 bytes align the
destination and use an unrolled loop processing 64 bytes per
iteration. Memsets of zero of more than 256 use the dc zva
instruction, and there are faster versions for the common ZVA sizes 64
or 128. STP of Q registers is used to reduce codesize without loss of
performance.
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.