summaryrefslogtreecommitdiffstats
path: root/newlib
Commit message (Collapse)AuthorAgeFilesLines
...
* Add some POSIX header files for RTEMSSebastian Huber2017-05-2520-6/+4641
| | | | | | | | | | | | | | | | | | | | | Add the POSIX header files * arpa/inet.h * net/if.h * netdb.h * netinet/in.h * netinet/tcp.h * sys/socket.h * sys/syslog.h * sys/uio.h * sys/un.h * syslog.h * termios.h and their dependencies for RTEMS. The origin of these files is the latest FreeBSD. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* FreeBSD compatibility for RTEMS <sys/cpuset.h>Sebastian Huber2017-05-254-138/+402
| | | | | | | | | | | Make the RTEMS <sys/cpuset.h> compatible with the latest FreeBSD version. Fix the CPU_COPY() parameter order, see also: https://devel.rtems.org/ticket/3023 Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add __bitcount*() to RTEMS <machine/types.h>Sebastian Huber2017-05-252-0/+92
| | | | | | | Use a dedicated header file <machine/_bitcount.h> to avoid cyclic header dependencies in future changes. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Move ARM access.c from machine to sysSebastian Huber2017-05-255-14/+13
| | | | | | | | | The implementation of the POSIX access() function is nothing machine specific like memcpy(), etc. Move it back to the system domain. This avoids problems due to the include search order of the Newlib/GCC build which picks up machine includes before system includes. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Increase MSIZE for RTEMSSebastian Huber2017-05-251-1/+1
| | | | | | | | Increase the MSIZE for RTEMS to be in line with the latest FreeBSD version. The legacy network stack of RTEMS will provides its own definition. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* FreeBSD compatibility for RTEMS <sys/param.h>Sebastian Huber2017-05-252-125/+180
| | | | | | | Update the RTEMS <machine/param.h> and <sys/param.h> to be compatible with the latest FreeBSD version. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add generic <machine/_align.h> for RTEMSSebastian Huber2017-05-252-11/+42
| | | | | | | It uses __BIGGEST_ALIGNMENT__ which is available in recent GCC and LLVM/clang. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Add __packed to struct ldieeeKito Cheng2017-04-181-8/+9
| | | | | - We don't want any padding in struct ldieee, otherwise the offset might wrong in most compiler.
* newlib: remove __infinity{f,ld} constantsCorinna Vinschen2017-04-185-35/+6
| | | | | | | | | | | | | | | previous commit 4c90db7bc89e7fa1077025fefdd58269dc71a6ac introduced a compile time error because libm/common/s_infconst.c used the remove __fmath, __dmath, and __ldmath union types. Since this is very old, and unused for a very long time, just drop the file and thus the __infinity constants entirely. Exception: Cygwin exports __infinity from the beginning. There's a very, VERY low probability that any existing executable or lib still uses this constant, but we just keep it in for backward compat, nevertheless. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Remove legacy unions which are no longer usedJeff Johnston2017-04-171-23/+0
| | | | - remove __fmath, __dmath, and __ldmath unions
* Optimise memchr for NEON-enabled processorsPrakhar Bahuguna2017-04-062-2/+185
|
* Add BSD-specific reallocarray()Sebastian Huber2017-04-044-17/+68
| | | | | It is available in FreeBSD, NetBSD and OpenBSD, but not in glibc. It is used for example by OpenSSH.
* Renumber copyright clause 4imp2017-04-041-1/+1
| | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96
* queue.3: Document existing QMD_* macroscem2017-04-041-0/+39
| | | | | | Feedback from: bapt, bdrewery, emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D3983
* queue(3): Enhance queue debugging macroscem2017-04-041-5/+37
| | | | | | | | | | | | | Split the QUEUE_MACRO_DEBUG into QUEUE_MACRO_DEBUG_TRACE and QUEUE_MACRO_DEBUG_TRASH. Add the debug macrso QMD_IS_TRASHED() and QMD_SLIST_CHECK_PREVPTR(). Document these in queue.3. Reviewed by: emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D3984
* Add two new macros, SLIST_CONCAT and LIST_CONCATmckusick2017-04-041-2/+36
| | | | | | | | | Add two new macros, SLIST_CONCAT and LIST_CONCAT. Note in both the queue.h header file and in the queue.3 manual page that they are O(n) so should be used only in low-usage paths with short lists (otherwise an STAILQ or TAILQ should be used). Reviewed by: kib
* Make the <sys/queue.h> fully usable within C++hselasky2017-04-041-14/+73
| | | | | | | | | | | | | | | | | | Make the system queue header file fully usable within C++ programs by adding macros to define class lists. This change is backwards compatible for all use within C and C++ programs. Only C++ programs will have added support to use the queue macros within classes. Previously the queue macros could only be used within structures. The queue.3 manual page has been updated to describe the new functionality and some alphabetic sorting has been done while at it. Differential Revision: https://reviews.freebsd.org/D2745 PR: 200827 (exp-run) MFC after: 2 weeks
* Pass macro arguments properly.hselasky2017-04-041-2/+2
| | | | MFC after: 1 week
* Fix order of arguments in the TRACEBUF_INITIALIZERhselasky2017-04-041-1/+1
| | | | | | | Fix order of arguments in the TRACEBUF_INITIALIZER macro so that we can define QUEUE_MACRO_DEBUG to debug list problems. MFC after: 1 week
* Add new FOREACH_FROM variants for queue(3)lstewart2017-04-041-0/+53
| | | | | | | | | | | | | Add new FOREACH_FROM variants of the queue(3) FOREACH macros which can optionally start the traversal from a previously found element by passing the element in as "var". Passing a NULL "var" retains the same semantics as the regular FOREACH macros. Kudos to phk for suggesting the "FROM" suffix instead of my original proposal. Reviewed by: jhb (previous version), rpaulo MFC after: 1 week
* Renumber copyright clause 4imp2017-04-041-1/+1
| | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96
* don't use C99 static array indices with older GCC versionsavg2017-04-041-0/+1
| | | | | | | | | | | | | | For example, the FreeBSD GCC (4.2.1) has a spotty support for that feature. If the static keyword is used with an unnamed array parameter in a function declaration, then the compilation fails with: error: static or type qualifiers in abstract declarator The feature does work if the parameter is named. So, the restriction introduced in this commit can be removed when all affected function prototypes have the workaround. MFC after: 1 week Sponsored by: Panzura
* Addition of clang nullability qualifiers.pfg2017-04-041-0/+7
| | | | | | | | | | | | | | | For consistency with the qualifiers added in r310977, define a new qualifier _Null_unspecified which is also defined in clang 3.7+. Add two new macros: __NULLABILITY_PRAGMA_PUSH __NULLABILITY_PRAGMA_POP These are for use in headers when we want avoid noisy warnings if some pointers are left without nullability annotations. These are added with way ahead of their first use to teach the GCC ports headers of their existance before their first use.
* Remove unused __gnu_inline() attribute.pfg2017-04-041-16/+0
| | | | | | | | | | | | This was meant to be used by a future FORTIFY_SOURCE implementation. Probably for good, FORTIFY_SOURCE and this particular GCCism were never well supported by clang or other compilers. Furthermore, the technology has long since been replaced by either static checkers, sanitizers, or even just the strong stack protector that was enabled by default. Drop __gnu_inline to avoid cluttering the headers. MFC after: 5 days
* Addition of clang nullability qualifiers.pfg2017-04-041-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Add two new qualifiers for use by the static checkers: _Nonnull The _Nonnull nullability qualifier indicates that null is not a meaningful value for a value of the _Nonnull pointer type. _Nullable The _Nullable nullability qualifier indicates that a value of the _Nullable pointer type can be null. These were introduced in Clang 3.7. For more information, see: http://clang.llvm.org/docs/AttributeReference.html#nonnull We add these now without using them so that the GCC ports have time to pick up the header change. Hinted by: Android Bionic libc [1] Also seen in: Apple's Libc-1158.20.4 [1] https://github.com/android/platform_bionic/commit/baa2a973bd776a51bb05a8590ab05d86eea7b321
* Fix C++ includability of crypto headers with static array sizesasomers2017-04-041-0/+14
| | | | | | | | | | | | | | | | | | | | | | C99 allows array function parameters to use the static keyword for their sizes. This tells the compiler that the parameter will have at least the specified size, and calling code will fail to compile if that guarantee is not met. However, this syntax is not legal in C++. This commit reverts r300824, which worked around the problem for sys/md5.h only, and introduces a new macro: min_size(). min_size(x) can be used in headers as a static array size, but will still compile in C++ mode. Reviewed by: cem, ed MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8277 fix a typo in __STDC_VERSION__ in __min_size requirements MFC after: 1 week Sponsored by: Panzura
* Stop exposing the C11 _Atomic() macro in <sys/cdefs.h>, when compiling for C++.dim2017-04-041-1/+2
| | | | | | | | | | | It clashes with the one in libc++'s <atomic> header. (Previously, the _Atomic() macro was defined in <stdatomic.h>, which is only for use with C11, but for various reasons it was moved to its current location in r251804.) Discussed with: bdrewery, ed MFC after: 2 weeks
* Rename __sentinel to __null_sentinelpfg2017-04-041-2/+2
| | | | | | GCC 5 uses a conflicting __sentinel definition in include/c++/bits/stl_algo.h Reported by: matteo
* Use enum __packed in favour of -fshort-enumsSebastian Huber2017-04-036-48/+49
| | | | | | | | | | | | Some architectures like ARM encode the short enum option state in the object file and the linker checks that this option is consistent for all objects of an executable. In case applications use -fno-short-enums, then this leads to linker warnings. Use the enum __packed attribute for the relevent enums to avoid the -fshort-enums compiler option. This attribute is at least available on GCC, LLVM/clang and the Intel compiler. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Use .syntax unified instead of .syntax divided.cygwin-2_8_0-releaseCatherine Moore2017-03-302-2/+2
|
* Rename <sys/_locale.h> to <xlocale.h>Yaakov Selkowitz2017-03-2210-12/+12
| | | | | | | | | The locale_t type is provided by <xlocale.h> on Linux, FreeBSD, and Darwin. While, like on some of those systems, it is automatically included by <locale.h> with the proper feature test macros, its presence under this particular name is still presumed in real-world software. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* ARM: Fix IEEE-754 sqrt implementationSebastian Huber2017-03-222-2/+2
| | | | | Older GCC (e.g. 4.9.3) seem to define __ARM_FP even in case soft-float is used.
* ARM: Optimize IEEE-754 sqrt implementationSebastian Huber2017-03-214-1/+108
| | | | Use the vsqrt.f64 and vsqrt.f32 instructions if available.
* libc/string/strsignal.c: Use of || not && lead to dead code.Joel Sherrill2017-03-151-4/+2
| | | | Coverity Id: 175333
* rtems/crt0.c: getentropy() stub did not return a value.Joel Sherrill2017-03-151-1/+1
| | | | Coverity Scan ID: 175342
* Fix duplocale (libc/locale/duplocale.c) which fails to properly call ↵Koichi Murase2017-03-132-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __loadlocale Problem: After passing locales created by 'duplocale' to 'uselocale', referencing 'MB_CUR_MAX', which is actually expanded to '__locale_mb_cur_max()' by preprocessors, causes segmentation faults. Direct use of locales from 'newlocale' does not cause the problem. This is the problem of 'duplocale'. $ echo $LANG ja_JP.UTF-8 $ cat test.c #include <stdlib.h> #include <locale.h> volatile int var; int main(void) { locale_t const loc = newlocale(LC_ALL_MASK, "", NULL); locale_t const dup = duplocale(loc); locale_t const old = uselocale(dup); var = MB_CUR_MAX; /* <-- crashes here */ uselocale(old); freelocale(dup); freelocale(loc); return 0; } $ gcc test.c $ ./a Segmentation fault (core dumped) # Note: "core dumped" in the above message was actually written in # Japanese, but I translated the part to post a mail in English. Bug: In the beginning of '__loadlocale' (newlib/libc/locale/locale.c:501), there is a code which checks if the operations can be skipped: > /* Avoid doing everything twice if nothing has changed. */ > if (!strcmp (new_locale, loc->categories[category])) > return loc->categories[category]; While, in the function '_duplocale_r' (newlib/libc/locale/ duplocale.c), '__loadlocale' is called as in the quoted codes: > /* If the object is not a "C" locale category, copy it. Just call > __loadlocale. It knows what to do to replicate the category. */ > tmp_locale.lc_cat[i].ptr = NULL; > tmp_locale.lc_cat[i].buf = NULL; > if (!__loadlocale (&tmp_locale, i, tmp_locale.categories[i])) > goto error; This call of '__loadlocale' results in the skip check being !strcmp(tmp_locale.categories[i], tmp_locale.categories[i]), which is always true. This means that the actual operations of '__loadLocale' will never be performed for 'duplocale'. Fix: The call of '__loadlocale' in '_duplocale_r' is modified. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Update makedocbook for bd547490Jon Turney2017-02-151-3/+4
| | | | | | | | Teach makedocbook how to handle some new things seen in the makedoc markup since bd547490: - struct lines appearing in the synopsis - use of @strong{} texinfo markup
* Allow locking routine to be retargetedThomas Preud'homme2017-02-1310-14/+316
| | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment when targeting bare-metal targets or systems without definition for the locking primitives newlib, uses dummy empty macros. This has the advantage of reduced size and faster implementation but does not allow the application to retarget the locking routines. Retargeting is useful for a single toolchain to support multiple systems since then it's only at link time that you know which system you are targeting. This patch adds a new configure option --enable-newlib-retargetable-locking to use dummy empty functions instead of dummy empty macros. The default is to keep the current behavior to not have any size or speed impact on targets not interested in this feature. To allow for any size of lock, the _LOCK_T type is changed into pointer to struct _lock and the _init function are tasked with allocating the locks. The platform being targeted must provide the static locks. A dummy implementation of the locking routines and static lock is provided for single-threaded applications to link successfully out of the box. To ensure that the behavior is consistent (either no locking whatsoever or working locking), the dummy implementation is strongly defined such that a partial retargeting will cause a doubly defined link error. Indeed, the linker will only pull in the file providing the dummy implementation if it cannot find an implementation for one of the routine or lock.
* Only define static locks in multithreaded modeThomas Preud'homme2017-02-135-6/+28
| | | | | | | | | | | | | Newlib build system defines __SINGLE_THREAD__ to allow concurrency code to be only compiled when newlib is configured for multithread. One such example are locks which become useless in single thread mode. Although most static locks are indeed guarded by !defined(__SINGLE_THREAD__), some are not. This commit adds these missing guards to __dd_hash_mutex, __atexit_recursive_mutex, __at_quick_exit_mutex and __arc4random_mutex. It also makes sure locking macros in lock.h are noop in single thread mode.
* Unify names of all lock objectsFreddie Chopin2017-02-069-40/+40
| | | | | | | | | | | | | | | | | | In preparation for the patch that would allow retargeting of locking routines, rename all lock objects to follow this pattern: "__<name>_[recursive_]mutex". Following locks were renamed: __dd_hash_lock -> __dd_hash_mutex __sfp_lock -> __sfp_recursive_mutex __sinit_lock -> __sinit_recursive_mutex __atexit_lock -> __atexit_recursive_mutex _arc4random_mutex -> __arc4random_mutex __env_lock_object -> __env_recursive_mutex __malloc_lock_object -> __malloc_recursive_mutex __atexit_mutex -> __at_quick_exit_mutex __tz_lock_object -> __tz_mutex
* arm: Fix addressing in optpld macroKyrill Tkachov2017-01-262-4/+4
| | | | | | | | | | | | | | | In patch b219285f873cc79361355938bd2a994957b4a6ef you have a syntax error in the PLD instruction. The syntax for the pld argument should be in square brackets as it's a memory address like so: pld [r1]. With your patch the newlib build fails for armv7-a targets. This patch fixes the build failures. Tested by making sure the newlib build completes successfully. 2016-01-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com> * libc/machine/arm/strcpy.c (strcpy): Fix PLD assembly syntax. * libc/machine/arm/strlen-stub.c (strlen): Likewise.
* arm: Remove RETURN macroPat Pannuto2017-01-256-33/+23
| | | | | | | | | | | | | | LTO can re-order top-level assembly blocks, which can cause this macro definition to appear after its use (or not at all), causing compilation failures. On modern toolchains (armv4t+), assembly should write `bx lr` in all cases, and linkers will transparently convert them to `mov pc, lr`, allowing us to simply remove the macro. (source: https://groups.google.com/forum/#!topic/comp.sys.arm/3l7fVGX-Wug and verified empirically) For the armv4.S file, preserve this macro to maximize backwards compatibility.
* arm: Remove optpld macroPat Pannuto2017-01-253-18/+11
| | | | | | | | | | | LTO can re-order top-level assembly blocks, which can cause this macro definition to appear after its use (or not at all), causing compilation failures. As the macro has very few uses, simply removing it by inlining is a simple fix. n.b. one of the macro invocations in strlen-stub.c was already guarded by the relevant #define, so it is simply converted directly to a pld
* Remove unneeded references to arm_asm.hPat Pannuto2017-01-258-10/+4
| | | | | This should result in no functional changes, it simply removes references to arm_asm.h that did not use anything from that file.
* devctl.h: Fix typo and include proper headerSebastian Huber2017-01-251-6/+6
| | | | | | | Remove stray commas. Include <sys/cdefs.h> for __restrict (includes <stddef.h> indirectly). Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* RTEMS: Harmonize MAXNAMLEN and NAME_MAXSebastian Huber2017-01-251-0/+4
| | | | | | | Override MAXNAMLEN definition in <dirent.h> and make sure it equals NAME_MAX. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Prefix consistenly target-independent locks with __Thomas Preudhomme2017-01-252-11/+11
| | | | | | | | | | | | | | | | | | | Hi, With the patch to allow newlib's locking routine to be retargeted currently under discussion, we need to start thinking of locks as part of newlib's ABI since newlib depends on specific names being provided by the OS. This patch renames 2 locks so that they follow the same naming convention as other locks. It needs to be applied before the retargeting patch, while locks are still an internal consideration. Newlib builds successfully with this change. Ok for master branch? Best regards, Thomas
* nl_langinfo: Add NL_LOCALE_NAME macroEric Blake2017-01-202-1/+18
| | | | | | | | | | | | | | | | | | | | | Provide an extension NL_LOCALE_NAME() macro, with semantics matching glibc, which can be used as: nl_langinfo_l(NL_LOCALE_NAME(LC_MESSAGES), locale); to get back the locale string that locale was originally created with during newlocale(). This in turn allows a library (such as gettext) to determine what thread-local locale settings it has inherited from the main program without having to be told what parameters were passed to newlocale(), for less overall coupling between parts of the program. gnulib is set up to use the extension: https://lists.gnu.org/archive/html/bug-gnulib/2017-01/msg00129.html * libc/include/langinfo.h (NL_LOCALE_NAME): New macro * libc/locale/nl_langinfo.c (nl_langinfo_l): Expose locale names of a locale_t's category components. Signed-off-by: Eric Blake <eblake@redhat.com>
* devctl.h: Use __restrict not restrictJoel Sherrill2017-01-171-5/+5
|
* Add missing headers to fix implicit function defnsPat Pannuto2017-01-164-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A few files were missing headers for memset/malloc, likely missed because the files don't directly call the functions, rather they come in via macros in libc/include/sys/reent.h: #define _REENT_CHECK(var, what, type, size, init) do { \ struct _reent *_r = (var); \ if (_r->what == NULL) { \ _r->what = (type)malloc(size); \ #define _REENT_CHECK_ASCTIME_BUF(var) \ _REENT_CHECK(var, _asctime_buf, char *, _REENT_ASCTIME_SIZE, \ memset((var)->_asctime_buf, 0, _REENT_ASCTIME_SIZE)) Without these fixes, implicit function signatures are provided, which gcc warns could cause aliasing issues down the line: ../../../../../../../newlib-2.5.0/newlib/libc/time/asctime.c:62:3: warning: type of 'memset' does not match original declaration [-Wlto-type-mismatch] /Volumes/code/external/newlib-cygwin/newlib/libc/include/string.h:29:7: note: return value type mismatch _PTR _EXFUN(memset,(_PTR, int, size_t)); ^ /Volumes/code/external/newlib-cygwin/newlib/libc/include/string.h:29:7: note: 'memset' was previously declared here /Volumes/code/external/newlib-cygwin/newlib/libc/include/string.h:29:7: note: code may be misoptimized unless -fno-strict-aliasing is used ../../../../../../../newlib-2.5.0/newlib/libc/time/asctime.c:62:3: warning: type of 'malloc' does not match original declaration [-Wlto-type-mismatch] /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: return value type mismatch extern _PTR malloc _PARAMS ((size_t)); ^ /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: 'malloc' was previously declared here /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: code may be misoptimized unless -fno-strict-aliasing is used ../../../../../../../newlib-2.5.0/newlib/libc/time/lcltime.c:58:3: warning: type of 'malloc' does not match original declaration [-Wlto-type-mismatch] /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: return value type mismatch extern _PTR malloc _PARAMS ((size_t)); ^ /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: 'malloc' was previously declared here /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: code may be misoptimized unless -fno-strict-aliasing is used ../../../../../../../newlib-2.5.0/newlib/libc/string/strsignal.c:70:3: warning: type of 'malloc' does not match original declaration [-Wlto-type-mismatch] /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: return value type mismatch extern _PTR malloc _PARAMS ((size_t)); ^ /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: 'malloc' was previously declared here /Volumes/code/external/newlib-cygwin/newlib/libc/include/malloc.h:37:13: note: code may be misoptimized unless -fno-strict-aliasing is used Including the proper headers elminates the implicit function signatures and these warnings.