Commit Graph

2154 Commits

Author SHA1 Message Date
Sebastian Huber f86afe5a3a C11 aligned_alloc() implementation
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.
2015-10-19 14:10:33 +02:00
Sebastian Huber da60762bfe C11 aligned_alloc() support for <stdlib.h>
newlib/ChangeLog
2015-10-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>

	* libc/include/stdlib.h (alloc_aligned): Declare.
2015-10-19 14:10:09 +02:00
Sebastian Huber d67f71ab85 C11 quick_exit() support for <stdlib.h>
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.
2015-10-19 14:09:17 +02:00
Jeff Johnston c98d01ee0c Import <threads.h> from latest FreeBSD.
- 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.
2015-10-13 17:52:34 -04:00
Jeff Johnston ecee0b0607 Synchronize with FreeBSD.
* libc/include/sys/cdefs.h: Synchronize with latest FreeBSD
        version.
2015-10-13 17:50:30 -04:00
Jeff Johnston 443467d752 Add FreeBSD style changes to sys/cdefs.h
* libc/include/sys/cdefs.h: Add style changes of latest FreeBSD
        version.
2015-10-13 17:46:47 -04:00
Nick Clifton e6430c9e8c Define setjmp buffer length for IA64. 2015-10-08 15:46:34 +01:00
Jeff Johnston f296bb3569 Minimize newlib code size for ft32
* configure.host (ft32): minimise newlib code size
2015-09-22 18:12:23 -04:00
Jeff Johnston 948b5f0043 Add support for ft32 to newlib. 2015-09-04 14:37:37 -04:00
Hans-Peter Nilsson 82d7069a5e libc/machine/cris/sys/signal.h (kill): Declare. 2015-09-03 01:59:43 +02:00
Corinna Vinschen 38fd7ddb79 Allow sysconf to return CPU cache information
* 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>
2015-08-29 09:16:47 +02:00
Corinna Vinschen e6d9af11f1 strlen-armv7.S: Fix preprocessor check
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>
2015-08-27 12:55:22 +02:00
Andre Simoes Dias Vieira 892cfcb7c2 Fix for pri and scn formats 2015-08-27 12:50:25 +02:00
Jeff Johnston 4098f69c43 or1k: Fix critical handling in malloc locks
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
2015-08-07 15:01:58 -04:00
Shoichi Sakon 001ef5af39 Fix wscanf family positional parameter handling in %lc, %ls, %l[]
* libc/stdio/vfwscanf.c (__SVFWSCANF_R): Convert wrong usage of va_arg
        to GET_ARG in %lc, %ls nad %l[] cases.  Fix unterminated string in %l[]
        case.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-03 21:51:35 +02:00
Sebastian Huber b7ca25162a Fix typo in <sys/lock.h>
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.
2015-07-31 06:21:04 -07:00
Wilco Dijkstra 127c38bd44 [AArch64] Rewrite optimized memset.
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.
2015-07-30 12:51:34 +01:00
Sebastian Huber f04e46b141 Move header files
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.
2015-07-29 12:53:53 -07:00
Joel Sherrill 763e0b7baf newlib/ChangeLog: Left out of previous commit. 2015-07-29 12:48:07 -07:00
Corinna Vinschen 7c96ab0b43 Cygwin: Implement siglongjmp and sigsetjmp functions.
* libc/include/machine/setjmp.h (siglongjmp): Declare as function on
	Cygwin.
	(sigsetjmp): Ditto.
	(_longjmp): Mark as noreturn function on Cygwin.

	* common.din (siglongjmp): Export.
	(sigsetjmp): Export.
	* gendef: Change formatting of some comments.
	(sigsetjmp): Implement.
	(siglongjmp): Implement.
	(__setjmpex): x86_64 only: Drop entry point.
	(setjmp): x86_64 only: Store tls stackptr in Frame now, store MXCSR
	and FPUCW registers in Spare, as MSVCRT does.
	(longjmp): x86_64 only: Restore tls stackptr from Frame now, restore
	MXCSR and FPUCW registers from Spare.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.

	* new-features.xml (ov-new2.2): Document sigsetjmp, siglongjmp.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-21 17:31:02 +02:00
Marcus Shawcroft c7806ef76a [AArch64] Reverting recent optimized memset(). 2015-07-15 13:34:58 +01:00
Wilco Dijkstra 3263f90ef7 [AArch64] Optimized memset.
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.
2015-07-13 13:17:16 +01:00
Marcus Shawcroft 8e6a9ad74d Fix ChangeLog entry for previous two commits. 2015-07-13 13:17:04 +01:00
Wilco Dijkstra b295f6ba44 [AArch64] Optimized memcpy.
This is an optimized memcpy for AArch64.  Copies are split into 3 main
cases: small copies of up to 16 bytes, medium copies of 17..96 bytes
which are fully unrolled.  Large copies of more than 96 bytes align
the destination and use an unrolled loop processing 64 bytes per
iteration.  In order to share code with memmove, small and medium
copies read all data before writing, allowing any kind of overlap.  On
a random copy test memcpy is 40.8% faster on A57 and 28.4% on A53.
2015-07-13 13:09:02 +01:00
Wilco Dijkstra 9503c7f275 [AArch64] Optimized memmove.
This is an optimized memmove for AArch64.  All copies of up to 96
bytes and all backward copies are done by the new memcpy.  The only
remaining case is large forward copies which are done in the same way
as the memcpy loop, but copying from the end rather than the start.
2015-07-13 13:03:02 +01:00
Yaakov Selkowitz 79e419de62 Rework handling of basename variants
As a commonly-included header, the #define basename in <string.h> can
affect code which uses "basename" for its own purposes (e.g. struct
members or C++ namespaced functions).  When such cases occur and some
code includes <string.h> and some not, then errors result.  OTOH,
<libgen.h> is rarely used, and that's where the renaming occurs in
glibc, so code using <libgen.h> should already be safe.

* libc/include/libgen.h (basename): Define as __xpg_basename
for source compatibility with glibc.
Declare with __ASMNAME("basename") for ABI compatibility.
* libc/include/string.h (basename): Define as basename for
source compatibility with glibc.
Declare with __ASMNAME("__gnu_basename") for ABI compatibility.
2015-07-06 14:58:51 -05:00
Corinna Vinschen f9b87aaf10 Fix sys/time.h build problem due to inconsistent macro usage
https://sourceware.org/ml/newlib/2015/msg00520.html describes
	how sys/time.h uses __BSD_VISIBLE while the types used in the
	affected inline functions are guarded with !_POSIX_SOURCE.
	Fix that by guarding the type with __BSD_VISIBLE as well.

        * libc/include/sys/time.h: Explicitely include sys/cdefs.h.
        * libc/include/sys/types.h: Ditto.  Guard BSD convenience base types
        with __BSD_VISIBLE rather than !_POSIX_SOURCE.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-06 14:08:30 +02:00
Sebastian Huber 757c0871f7 Prevent use of uninitialized file lock
The CHECK_INIT() is necessary before the _newlib_flockfile_start() since
this would use otherwise acquire an uninitialized lock which gets
initialized after this leading to a corrupt release.

newlib/ChangeLog
2015-07-01  Sebastian Huber  <sebastian.huber@embedded-brains.de>

	libc/stdio/fputs.c (_puts_r): Add missing CHECK_INIT().
	libc/stdio/gets.c (_gets_r): Add missing _REENT_SMALL_CHECK_INIT() and
	CHECK_INIT().  Use _stdin_r() to get the file pointer instead of stdin.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-02 09:38:06 +02:00
Jon TURNEY 166d86c9d4 Regenerate Makefile.in
Regenerate Makefile.in with changes in commits 153385d8 and 433aad91

2015-06-29  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/ctype/Makefile.in: Regenerate.
	* libc/posix/Makefile.in: Ditto.
	* libc/stdio/Makefile.in: Ditto.
	* libc/stdio64/Makefile.in: Ditto.
	* libc/stdlib/Makefile.in: Ditto.
	* libc/string/Makefile.in: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-29 12:29:50 +01:00
Jon TURNEY 153385d847 Use source files which have makedoc markup, but aren't processed or included.
These source files have makedoc markup, but aren't listed to be chewed by
makedoc. I am assuming that is accidental.

Future work: Note that stdio/fseeko.c, stdio/ftello.c and common/s_isnand.c have
makedoc markup, but duplicate stdio/fseek.c, stdio/ftell.c and common/s_isnan.c
respectively.

2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/ctype/Makefile.am (CHEWOUT_FILES): Add isblank.def.
	* libc/ctype/ctype.tex: Include isblank and add to menu.
	* libc/posix/Makefile.am (CHEWOUT_FILES): Add posix_spawn.def.
	* libc/posix/posix.tex: Include posix_spawn and add to menu.
	* libc/stdio64/Makefile.am (CHEWOUT_FILES): Add fdopen.def.
	* libc/stdio64/stdio64.tex: Include fdopen64 and add to menu.
	* libc/stdio64/fdopen64.c: Improve one-line description.
	* libc/string/Makefile.am (CHEWOUT_FILES): Add strchrnul.def.
	* libc/string/strings.tex: Include strchrnul and add to menu.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-24 12:24:01 +01:00
Jon TURNEY a4dd7dd87c Use makedoc output files which are generated but aren't included
I think these are accidental omissions, as these source files are listed to be
chewed by makedoc, but the result is not included by any texinfo source file.

Future work: Nothing in libc/reent/ which is processed by makedoc is included by
reent.tex

2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdlib/stdlib.tex: Include itoa and utoa, and add to menu.
	* libc/string/strings.tex: Include memrchr and rawmemchr, and add
	to menu.
	* libm/math/math.tex: Include exp10 and pow10, and add to menu.
	* libm/common/s_exp10.c: Improve one-line description.
	* libm/common/s_exp10.c: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-24 12:23:55 +01:00
Jon TURNEY 433aad912d Don't chew files which contain no documentation markup
Don't chew files which contain no documentation markup.

Neither of the alternatives for MALLOCR (mallocr.c or nano-mallocr.c) contain
any documentation markup.

2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdlib/Makefile.am (CHEWOUT_FILES): Remove $(MALLOCR).def.
	* libc/stdio/Makefile.am (CHEWOUT_FILES): Remove getwc.def and
	putwc.def.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-24 12:23:49 +01:00
Jon TURNEY 958c953416 Fix mismatched parentheses in documentation.
2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/locale/locale.c: Fix mismatched parentheses in
	documentation.
	* libc/locale/locale.tex: Ditto.
	* libc/stdio/fgetwc.c: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-24 12:23:25 +01:00
Jon TURNEY de5e58a640 Fix typo-ed function names in efgcvt.c documentation
Fix typo-ed function names in efgcvt.c documentation, neither gvcvt nor gdvtf
exists.

2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdlib/efgcvt.c: Fix typo-ed function names in
	documentation.
	* libc/stdlib/stdlib.tex: Fix function name in menu to match.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 20:56:30 +01:00
Jon TURNEY eb61ffe8dd Fix an inconsistent use of '.' in FUNCTION
Fix an inconsistent use of '.' to separate function names in FUNCTION. ',' is
used everywhere else.

2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdio/fread.c: Fix inconsistent use of '.' to separate
	function names in FUNCTION mark up.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 20:56:15 +01:00
Jon TURNEY ff4a4f2655 Fix SYNOPSIS prototypes without marked up parameter names
2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdlib/llabs.c: Mark up parameter name in ANSI_SYNOPSIS.
	* libc/time/tzset.c: Add and mark up parameter in SYNOPSIS.
	* libm/common/s_nan.c: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 17:30:22 +01:00
Jon TURNEY 6c75f6fcb2 Correct a non-ANSI prototype in SYNOPSIS
2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdio/getchar_u.c: Fix a non-ANSI prototype in SYNOPSIS.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 17:30:17 +01:00
Jon TURNEY e8442c9625 Remove stray punctuation in ANSI_SYNOPSIS prototypes
2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/string/wcscpy.c: Remove stray ',' from prototype in
	ANSI_SYNOPSIS.
	* libc/string/wcpcpy.c: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 17:30:07 +01:00
Jon TURNEY c7b1e4cbf2 Fix some mangled makedoc markup
2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/stdlib/itoa.c: Fix makedoc markup.
	* libc/stdlib/wcsnrtombs.c: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 16:14:53 +01:00
Jon TURNEY 42e040a448 Fix makedoc markup used in texinfo source
2015-06-23  Jon Turney  <jon.turney@dronecode.org.uk>

	* libc/signal/signal.tex: Use texinfo not makedoc markup.
	* libc/stdio/stdio.tex: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 16:14:39 +01:00
Corinna Vinschen 2b615b47d4 sys/signal.h requires sys/cdefs.h
* libc/include/sys/signal.h: Include forgotten sys/cdefs.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-22 10:49:29 +02:00
Corinna Vinschen a88afecce6 ChangeLog entries for Cygwin's alternate signal stack implementation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-20 20:36:16 +02:00
Freddie Chopin 325926031b gmtime_r: Use faster algorithm by Howard Hinnant
* libc/time/gmtime_r.c (gmtime_r): use faster algorithm from
	civil_from_days() by Howard Hinnant

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-15 12:00:59 +02:00
Hale Wang 24e054c8c8 Update the assembler code to support old ARM architectures.
* libc/machine/arm/aeabi_memmove-arm.S (__aeabi_memmove): Update the
        assembler implementation.
        * libc/machine/arm/aeabi_memmove-thumb.S (__aeabi_memmove): Ditto.
        * libc/machine/arm/aeabi_memmove-thumb2.S (__aeabi_memmove): Ditto.
        * libc/machine/arm/aeabi_memset-arm.S (__aeabi_memset): Ditto.
        * libc/machine/arm/aeabi_memset-thumb.S (__aeabi_memset): Ditto.
        * libc/machine/arm/aeabi_memset-thumb2.S (__aeabi_memset): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-01 12:49:37 +02:00
Szabolcs Nagy b27c7d1d9a aarch64: fabs and sqrt implementation with inline asm
* libm/machine/aarch64/e_sqrt.c: New file.
        * libm/machine/aarch64/ef_sqrt.c: New file.
        * libm/machine/aarch64/s_fabs.c: New file.
        * libm/machine/aarch64/sf_fabs.c: New file.
        * libm/machine/aarch64/Makefile.in: Add new source files.
        * libm/machine/aarch64/Makefile.am: Regenerate.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-01 10:17:34 +02:00
David Stacey 8fe35bd15f Correct argz_replace behaviour when memory is exhausted.
* libc/argz/argz_replace.c (argz_replace): Correct behaviour when memory
	is exhausted.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-01 10:09:04 +02:00
Corinna Vinschen 1aeda8a95f Fix comment in sys/wait.h
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-05-28 16:40:43 +02:00
David Stacey ca632c9015 Fix potential memory leak in argz_replace
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-05-27 13:30:20 +02:00
DJ Delorie 4f3cc70cb6 Avoid unneeded truncation to "int"
* libm/math/e_sqrt.c (__ieee754_sqrt): Don't truncate constant to
"int".
2015-05-27 13:30:20 +02:00
Nick Clifton 7b3c1cffce Update signbit functions to work on targets where integers are only 16-bits.
* libm/common/s_signbit.c (__signbitf): Fix for 16-bit targets.
	(__signbitd): Likewise.
2015-05-27 13:30:19 +02:00
Corinna Vinschen a7a784c774 Revert to exposing sys/select.h from sys/time.h on Cygwin
* libc/include/sys/time.h: Include sys/select.h on Cygwin.  Explain why.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-05-02 15:09:03 +02:00
Corinna Vinschen 6109eadff5 Improve check for int32_t being long or int
* libc/include/sys/config.h: Move evaluation of _UINTPTR_EQ_ULONG and
        _UINTPTR_EQ_ULONGLONG from here...
        * libc/include/sys/_intsup.h: ...to here.  Rename to _INTPTR_EQ_LONG
        and _INTPTR_EQ_LONGLONG to refer to signed base type.  Add test for
        base type of int32_t and set _INT32_EQ_LONG accordingly.
        * libc/include/stdint.h: Change checks for __have_long32 to checks
        for _INT32_EQ_LONG.
        * libc/include/inttypes.h: Ditto.  Accommodate aforementioned name
        change.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-29 13:07:17 +02:00
Corinna Vinschen 97a5dda2b0 Fix basename prototype collision string.h vs libgen.h
* libc/include/libgen.h (basename): Drop defining _BASENAME_DEFINED.
        Always define macro basename.  Add comment to explain why.
        * libc/include/string.h (basename): Check for basename instead of
        _BASENAME_DEFINED.  Drop __GNUC__ branch, always use basename macro.
        Change comment to explain why.  Add nonnull function attribute.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 22:03:45 +02:00
Nick Clifton cd0d459135 For the RX port, avoid using string instructions when __RX_DISALLOW_STRING_INSNS__ is defined.
* rx/crt0.S (_start): If string instructions are not allowed,
	avoid using SMOVF.

	* libc/machine/rx/memchr.S: Add non-string insn using version.
	* libc/machine/rx/memcpy.S: Likewise.
	* libc/machine/rx/memmove.S: Likewise.
	* libc/machine/rx/mempcpy.S: Likewise.
	* libc/machine/rx/strcat.S: Likewise.
	* libc/machine/rx/strcmp.S: Likewise.
	* libc/machine/rx/strcpy.S: Likewise.
	* libc/machine/rx/strlen.S: Likewise.
	* libc/machine/rx/strncat.S: Likewise.
	* libc/machine/rx/strncmp.S: Likewise.
	* libc/machine/rx/strncpy.S: Likewise.
2015-04-23 21:57:13 +02:00
Corinna Vinschen 50adb19f03 Add parens around MIN/MAX values in stdint.h.
* libc/include/stdint.h: Throughout add parens around MIN/MAX values.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:11 +02:00
Sebastian Huber 897d3a3cc4 Add <sys/_stdint.h> for FreeBSD compatibility
* libc/include/sys/_stdint.h: New file.
        * libc/include/stdint.h (int8_t): Move to <sys/_stdint.h>.
        (uint8_t): Likewise.
        (int16_t): Likewise.
        (uint16_t): Likewise.
        (int32_t): Likewise.
        (uint32_t): Likewise.
        (int64_t): Likewise.
        (uint64_t): Likewise.
        (intptr_t): Likewise.
        (uintptr_t): Likewise.
        * libc/include/sys/types.h: Include <sys/_stdint.h>.
        * libc/sys/rtems/machine/_types.h: Remove <stdint.h> include.
        * libc/sys/time.h>: Replace __uint32_t with uint32_t and
        __uint64_t with uint64_t.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:10 +02:00
Jon TURNEY 38a8d3e216 Make stack_t typedef generally available
* libc/include/sys/signal.h (stack_t): Make typedef generally
	available.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-04-23 21:57:10 +02:00
Corinna Vinschen 9b42474f29 Fix UTF-16 surrogate handling in wctomb and friends.
* libc/stdlib/wctomb_r.c (__utf8_wctomb): Fix check for handling a
	lone high surrogate.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:09 +02:00
Corinna Vinschen b3a09ae34b Avoid excessive locking and calling tzset in time functions.
* libc/time/lcltime_r.c (localtime_r): Call _tzset_unlocked inside
	TZ lock.
	* libc/time/mktime.c (mktime):  Ditto.
	* libc/time/strftime.c (strftime, wcsftime): Ditto.  Guard against
	calling _tzset_unlocked more than once (baring recursion).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:08 +02:00
Corinna Vinschen c117793326 Add _tzset_unlocked and _tzset_unlocked_r
newlib:

	* libc/time/local.h (_tzset_unlocked_r): Add prototype.
	(_tzset_unlocked): Ditto.
	* libc/time/tzset.c (_tzset_unlocked): New function, call
	_tzset_unlocked_r.
	(tzset): Lock and call _tzset_unlocked_r.
	* libc/time/tzset_r (_tzset_unlocked_r): Remove locking and rename
	from _tzset_r.
	(_tzset_r): Lock and call _tzset_unlocked_r.

cygwin:

	* localtime.cc (tzset_unlocked): Export as _tzset_unlocked.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:08 +02:00
Craig Howland 382fa90fe1 Move tzset calls to time functions.
* libc/stdlib/setenv_r.c (_setenv_r): Remove tzset() call for TZ
	definition.
	* libc/time/lcltime_r.c (localtime_r): Add tzset() call
	* libc/time/mktime.c (mktime):  Ditto.
	* libc/time/strftime.c (strftime, wcsftime): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:08 +02:00
Yaakov Selkowitz 95a4fc8726 strftime: use tzname if TM_ZONE is NULL
This avoids a strlen(NULL) crash a few lines later.

* libc/time/strftime.c (strftime) <%Z>: Initialize tznam to NULL.
Use _tzname as fallback if TM_ZONE is NULL.
2015-04-23 21:57:08 +02:00
Yaakov Selkowitz d67052321e string: add GNU basename(3)
* libc/include/libgen.h (_BASENAME_DEFINED): Define.
* libc/include/string.h (basename): Declare.
* libc/string/Makefile.am (ELIX_4_SOURCES): Add gnu_basename.c.
* libc/string/Makefile.in: Regenerate.
* libc/string/gnu_basename.c: New file.
2015-04-23 21:57:07 +02:00
Sebastian Huber 4f3f09ad72 Import <sys/tree.h> from FreeBSD
* libc/include/sys/tree.h: New file.
2015-04-23 21:57:06 +02:00
Joel Sherrill 839cba2b14 * newlib.hin: Remove _UINTPTR_EQ_ULONG and _UINTPTR_EQ_ULONGLONG.
2013-03-23  Joel Sherrill <joel.sherrill@oarcorp.com>

	* newlib.hin: Remove _UINTPTR_EQ_ULONG and _UINTPTR_EQ_ULONGLONG.
2015-04-23 21:57:06 +02:00
Joel Sherrill 380c00f175 Change from configure time to compile time probe for intptr_t definition.
2015-03-23  Joel Sherrill <joel.sherrill@oarcorp.com

	* configure.in: Delete logic to determine _UINTPTR_EQ_ULONGLONG
	and _UINTPTR_EQ_ULONG at configuration time.
	*libc/include/sys/config.h: Add logic to determine
	_UINTPTR_EQ_ULONGLONG and _UINTPTR_EQ_ULONG at compilation time.
	* libc/include/inttypes.h: Add include of <sys/config.h>.
	* configure: Regenerated.
2015-04-23 21:57:06 +02:00
Steve Ellcey d1df82a6ee Add ChangeLog entry for last patch to libc/include/sys/time.h. 2015-04-23 21:57:05 +02:00
Jon TURNEY 44e5c14e08 Fix newlib texinfo source so 'info libc' and 'info libm' work
If the newlib .info files are installed using install-info, 'info libc' and
'info libm' don't work.

This seems to be due to the formatting of the directory entry line not being
quite right, so fix that.

Also use @direntry texinfo command, rather than writing .info directory entry
literally.

Also use @dircategory texinfo command to place into 'Newlib' category, rather
than ending up in 'Miscellaneous'

newlib/ChangeLog:

2015-03-13  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* libc/libc.texinfo: Fix directory entry.
	* libm/libm.texinfo: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-03-16 15:02:22 +00:00
Corinna Vinschen e6af944145
Drop including cygwin/sys_time.h on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-13 13:19:14 +01:00
Sebastian Huber bb01594897
Merge parts of <sys/time.h> from FreeBSD
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-13 13:17:34 +01:00
Sebastian Huber c93d44add9
Import libc/sys/rtems/include/semaphore.h from FreeBSD.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-12 16:03:42 +01:00
Sebastian Huber b161b155c8 Add and use latest <sys/timespec.h> from FreeBSD
* libc/include/sys/_timespec.h: Import from FreeBSD.
        * libc/include/sys/timespec.h: Likewise.
        * libc/include/time.h: Include <sys/timespec.h>.
       	* libc/include/sys/types.h (timespec): Delete.
        (itimerspec): Likewise.
        * libc/include/machine/time.h: Include <sys/_timespec.h>.
        * libc/include/sys/sched.h: Likewise.
        * libc/include/sys/signal.h: Likewise.
        * libc/include/sys/stat.h: Likewise.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-11 15:45:38 +01:00
Nick Clifton 58c9102ea2 Fix a build problem running the newlib testsuite on targets that only have 32-bit doubles.
* testsuite/newlib.stdio/swprintf.c (main): Change size of value
	used to initialise 'val' variable so that it will compile on
	targets with 32-bit doubles.
2015-03-11 11:14:38 +00:00
Corinna Vinschen 5a97e28f6a * libc/include/stdio.h (FILE): Protect typedef from redefinition.
* libc/include/wchar.h: Ditto.
2015-03-05 17:15:24 +00:00
Joel Sherrill 2387583ee2 2015-02-25 Gedare Bloom <gedare@rtems.org>
* libc/include/machine/time.h (_CLOCKS_PER_SEC_): redefine for RTEMS.
2015-03-03 21:53:55 +00:00
Steve Ellcey bc860c9894 * libc/machine/mips/memset.S: Add support for mips32r6/mips64r6. 2015-03-03 19:49:00 +00:00
Steve Ellcey b8cd02f65a * libc/machine/mips/memcpy.S: Add support for mips32r6/mips64r6. 2015-03-03 17:46:27 +00:00
Steve Ellcey d2f9dbb3ee 2015-02-26 Steve Ellcey <sellcey@imgtec.com>
* libc/machine/mips/memcpy.S: Fix macro indentation and typos in
	comments.
2015-02-26 23:36:56 +00:00
Jon TURNEY 67d150ca14 * libc/include/sys/cdefs.h (_GNU_SOURCE): Move check so it has an
effect when _XOPEN_SOURCE is also defined.
2015-02-25 15:58:41 +00:00
Corinna Vinschen 72ba8b107a * libc/machine/arm/aeabi_memclr.c: New file to support
aeabi_memclr.
	* libc/machine/arm/aeabi_memset.c: New file to support
	aeabi_memset.
	* libc/machine/arm/aeabi_memset-soft.S: Ditto.
	* libc/machine/arm/aeabi_memset-arm.S: Ditto.
	* libc/machine/arm/aeabi_memset-thumb.S: Ditto.
	* libc/machine/arm/aeabi_memset-thumb2.S: Ditto.
	* libc/machine/arm/Makefile.am: Add dependencies.
	* libc/machine/arm/Makefile.in: Regenerated.
2015-02-17 09:26:54 +00:00
Corinna Vinschen 554f33c48d * libc/machine/arm/aeabi_memmove.c: New file to support
aeabi_memmove.
	* libc/machine/arm/aeabi_memmove-soft.S: Ditto.
	* libc/machine/arm/aeabi_memmove-arm.S: Ditto.
	* libc/machine/arm/aeabi_memmove-thumb.S: Ditto.
	* libc/machine/arm/aeabi_memmove-thumb2.S: Ditto.
	* libc/machine/arm/Makefile.am: Add dependencies.
	* libc/machine/arm/Makefile.in: Regenerated.
2015-02-17 09:06:51 +00:00
Nick Clifton b9e7cd9a84 * libc/include/complex.h (cabsl): Add prototype.
(cimagl): Add prototype.
	(creall): Add prototype.
	* libc/include/ieeefp.h: Include float.h.
	(EXT_EXPBITS, EXT_FRACHBITS, EXT_FRACLBITS)
	(EXT_EXP_INFNAN. EXT_EXP_BIAS, EXT_FRACBITS): Define.
	(struct ieee_ext, union ieee_ext_u): New types for long double
	support.
	* libc/include/math.h (finitel): Add prototype.
	(hypotl): Add prototype.
	(sqrtl): Add prototype.
	* libm/common/Makefile.am (lsrc): Add sl_finite.c.
	* libm/common/Makefile.in: Regenerate.
	* libm/common/fdlibm.h (__ieee754_hypotl): Add prototype.
	* libm/common/hypotl.c (hypotl): Add implementation for when long
	double is larger than double.
	* libm/common/sqrtl.c (sqrtl): Likewise.
	* libm/common/sl_finite.c: New file.  Adds implementation of the
	finitel function.
	* libm/complex/Makefile.am (lsrc): Define.
	(libcomplex_la_SOURCES): Add lsrc.
	(lib_a_SOURCES): Add lsrc.
	* libm/complex/Makefile.in: Regenerate.
	* libm/complex/cabs.c: Add documentation of cabsl function.
	* libm/complex/cimag.c: Add documentation of cimagl function.
	* libm/complex/creall.c: Add documentation of creall function.
	* libm/complex/cabsl.c: New file.  Adds implementation of the
	cabsl function.
	* libm/complex/cimagl.c: New file.  Adds implementation of the
	cimagl function.
	* libm/complex/creall.c: New file.  Adds implementation of the
	creall function.
	* libm/math/Makefile.am (lsrc): Define.
	(libmath_la_SOURCES): Add lsrc.
	(lib_a_SOURCES): Add lsrc.
	* libm/math/Makefile.in: Regenerate.
	* libm/math/el_hypot.c: New file.  Adds implementation of the
	__ieee754_hypotl function.
2015-02-06 16:14:04 +00:00
Corinna Vinschen f2eb8ca8bf * libc/include/wchar.h (wcstold): Drop _LDBL_EQ_DBL requirement for
declaration.
2015-02-04 11:02:36 +00:00
Nick Clifton 1f3dd90552 * libc/stdlib/wcstold.c (wcstold): Add implementation for when
long double is not the same as double.
2015-01-29 08:37:26 +00:00
Corinna Vinschen 3e4183d15b * libc/include/sys/time.h: #include <sys/cdefs.h> for __BSD_VISIBLE. 2015-01-28 21:03:41 +00:00
Corinna Vinschen 2ee3908b45 Complete action from 2001-12-18:
* libc/machine/i386/f_*: Remove duplicate files.
2015-01-23 10:16:00 +00:00
Yaakov Selkowitz 128e9e0be5 * libc/sys/sparc64/sys/time.h: #include <sys/types.h> for time_t. 2015-01-22 17:34:47 +00:00
Corinna Vinschen bdc1799556 * libc/sys/or1k/mlock.c: Fix dependency on libgloss. 2015-01-22 15:32:51 +00:00
Eric Botcazou bf8f43ae8a * COPYING.LIBGLOSS: Add Controls and Data Services copyright.
* COPYING.NEWLIB: Likewise.
libgloss/
	* configure.in: Add Visium support.
	* configure: Regenerate.
	* visium/: New directory.
newlib/
	* configure.host: Add Visium support.
	* libc/machine/configure.in: Likewise.
	* libc/machine/configure: Regenerate.
	* libc/machine/visium/: New directory.
	* libc/include/machine/setjmp.h (_JBLEN): Define for Visium.
	* libc/include/machine/ieeefp.h (__IEEE_BIG_ENDIAN): Likewise.
	* libc/include/machine/time.h (_CLOCKS_PER_SEC_): Likewise.
2015-01-21 18:27:47 +00:00
Corinna Vinschen d63bec588e * libc/sys/configure.in: Add OpenRISC.
* libc/sys/configure: Regenerate.
2015-01-20 12:28:27 +00:00
Corinna Vinschen 43f80ffb7d Fix typo in entry header 2015-01-20 12:27:30 +00:00
Corinna Vinschen c30509f569 Fix dates 2015-01-20 10:13:26 +00:00
Corinna Vinschen 086cd00d24 * libc/machine/aarch64/strlen.S (strlen): Improve performance. 2015-01-20 10:11:56 +00:00
Corinna Vinschen d0695096ba * configure.host: Add extra system for OpenRISC baremetal. 2015-01-20 09:59:40 +00:00
Jeff Johnston 89b6034299 2015-01-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* libc/include/sys/unistd.h [__BSD_VISIBLE]: Add issetugid() prototype.
2015-01-14 21:19:26 +00:00
Jeff Johnston 4fab65dc6b 2015-01-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* doc/makedoc.c: Use uintptr_t to avoid int/pointer size warnings
2015-01-14 21:15:36 +00:00
Corinna Vinschen 29193dd04c * configure.host: Add extra system for OpenRISC baremetal
* 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
2015-01-14 09:25:16 +00:00
Corinna Vinschen 8ddeb7008e * testsuite/newlib.wctype/tiswctype.c (main): Use wide character type
function.
2015-01-12 10:50:26 +00:00
Corinna Vinschen 808fde520f * libc/time/strftime.c (__strftime): Utilize __TM_GMTOFF and __TM_ZONE
on systems where available.  On Cygwin, call function to get values.
	Add comment to explain why.  Drop TZ_LOCK/TZ_UNLOCK in 'z' case since
	it's not necessary.  In 'Z' case, add a comment to document a potential
	codeset problem.
2015-01-08 09:51:34 +00:00
Corinna Vinschen ee65ca81d7 * testsuite/newlib.wctype/twctrans.c (main): Use towlower and towupper. 2015-01-08 09:35:14 +00:00