about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Unify and simplify bits/byteswap.h, bits/byteswap-16.h headers (bug 14508, ↵Joseph Myers2018-02-068-670/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug 15512, bug 17082, bug 20530). We have a general principle of preferring optimizations for library facilities to use compiler built-in functions rather than being located in library headers, where the compiler can reasonably optimize code without needing to know glibc implementation details. This patch applies this principle to bits/byteswap.h, eliminating all the architecture-specific variants and bits/byteswap-16.h. The __bswap_16, __bswap_32 and __bswap_64 interfaces all become inline functions, never macros, using the GCC built-in functions where available and otherwise a single architecture-independent definition using shifts and masking (which compilers may well be able to detect and optimize; GCC has detection of various byte-swapping idioms). The __bswap_constant_32 macro needs to stay around because of uses in static initializers within glibc and its tests, and so for consistency all __bswap_constant_* are kept rather than just being inlined into the old-GCC-or-non-GCC parts of the __bswap_* inline function definitions. Various open bugs are addressed by this cleanup, with caveats about exactly what is covered by those bugs and when the bugs applied at all. Bug 14508 reports -Wformat warnings building glibc because __bswap_* sometimes returned the wrong types. Obviously we already don't have such warnings any more or the build would be failing, given -Werror, and I suspect that bug was originally for wrong types for x86_64, as fixed by commit d394eb742a3565d7fe7a4b02710a60b5f219ee64 (glibc 2.17). The only case I saw removed by this patch where the types would still have been wrong was the non-__GNUC__ case of __bswap_64 in the s390 header (using unsigned long long int, but uint64_t would be unsigned long int for 64-bit). In any case, the single header consistently uses __uintN_t types after this patch, thereby eliminating all such bugs. The existing string/test-endian-types.c test already suffices to verify that the types are correct with the compiler used to build glibc and its tests. Bug 15512 reports an error from __bswap_constant_16 with -Werror -Wsign-conversion. I am unable to reproduce this with any GCC version supporting -Wsign-conversion - all seem to be able to avoid warning for ((x) >> 8) & 0xffu, where x is uint16_t, which while it formally does involve an implicit conversion from int to unsigned int, is also a case where it should be easy for the compiler to see that the value converted is never negative. But in this patch __bswap_constant_16 is changed to use signed 0xff so that no such implicit conversion occurs at all, and a test with -Werror -Wsign-conversion is added. Bug 17082 objects to the use of ({}) statement expressions in these macros preventing use at file scope (in C, that's in sizeof etc.; in C++, more generally in static initializers). The particular case of these interfaces is fixed by this patch as it changes them to inline functions, eliminating all uses of ({}) in bits/byteswap.h, and a corresponding testcase is added. The bug tries to raise a more general policy question about use of ({}) in macros in installed headers, referring to "many other libc functions" (unspecified which functions are being considered). Since such policy questions belong on libc-alpha, and since there *are* macros in installed headers which can't really avoid using ({}) (where they are type-generic, so can't use an inline function, but need a temporary variable, and a few where the interface involves returning memory from alloca so can't use an inline function either), I propose to consider that bug fixed with this change. That is without prejudice to any other new bugs anyone wishes to file *for precisely defined sets of macros* requesting moving away from ({}) *where it is clearly possible for those interfaces*. Where ({}) can be avoided, typically by use of an inline function, I think that's a good idea - that inline functions are typically to be preferred to ({}) for header interfaces where such optimizations are useful but the interface is suited to being defined using an inline function. Bug 20530 requests use of __builtin_bswap16 when available (GCC 4.8 and later), which this patch implements. Tested for x86_64, and with build-many-glibcs.py. Also did an x86_64 test with the __GNUC_PREREQ conditionals changed to "#if 0" to verify the old-GCC/non-GCC case in the headers. (There are already existing tests for correctness of results of these interfaces.) [BZ #14508] [BZ #15512] [BZ #17082] [BZ #20530] * bits/byteswap.h: Update file comment. Do not include <bits/byteswap-16.h>. (__bswap_constant_16): Cast result to __uint16_t. Use signed 0xff constant. (__bswap_16): Define as inline function. (__bswap_constant_32): Reformat definition. (__bswap_32): Always define as inline function, not macro, using __uint32_t. Use __builtin_bswap32 if [__GNUC_PREREQ (4, 3)], otherwise __bswap_constant_32. (__bswap_constant_64): Reformat definition. Do not use __extension__ here. (__bswap_64): Always define as inline function, not macro. Use __extension__ on function definition. Use __builtin_bswap64 if [__GNUC_PREREQ (4, 3)], otherwise __bswap_constant_64. * string/test-endian-file-scope.c: New file. * string/test-endian-sign-conversion.c: Likewise. * string/Makefile (headers): Remove bits/byteswap-16.h. (tests): Add test-endian-file-scope and test-endian-sign-conversion. (CFLAGS-test-endian-sign-conversion.c): New variable. * bits/byteswap-16.h: Remove file. * sysdeps/ia64/bits/byteswap-16.h: Likewise. * sysdeps/ia64/bits/byteswap.h: Likewise. * sysdeps/m68k/bits/byteswap.h: Likewise. * sysdeps/s390/bits/byteswap-16.h: Likewise. * sysdeps/s390/bits/byteswap.h: Likewise. * sysdeps/tile/bits/byteswap.h: Likewise. * sysdeps/x86/bits/byteswap-16.h: Likewise. * sysdeps/x86/bits/byteswap.h: Likewise.
* Use xmalloc in tst-setcontext-fpscr.c (bug 19668).Joseph Myers2018-02-061-2/+2
| | | | | | | | | | | | | | | | | | Bug 19668 reports an unchecked malloc call in the test sysdeps/powerpc/fpu/tst-setcontext-fpscr.c. This patch makes that test use xmalloc. It does not otherwise move this test to the support/ infrastructure or support/test-driver.c; the test has various uses of exit and _exit on error cases, and uses atexit, and while I think those things would all still work in the context of test-driver.c, it's not an immediately obvious conversion the way it would be for many tests that don't use test-driver.c. Tested for powerpc. [BZ #19668] * sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Include <support/support.h>. Do not include <malloc.h>. (query_auxv): Use xmalloc instead of malloc.
* Only define loff_t for __USE_MISC (bug 14553).Joseph Myers2018-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Bug 14553 reports that sys/types.h defines loff_t unconditionally, despite it not being part of any supported standard. This is permitted by the POSIX *_t reservation, but as a quality-of-implementation issue it's still best not to define it except for __USE_MISC. This patch conditions the definition accordingly, updating a macro in sysdeps/unix/sysv/linux/sys/quota.h to use __loff_t so it still works even if __USE_MISC is not defined. codesearch.debian.net suggests there are quite a lot of loff_t uses outside glibc, but it might well make sense to change all (few) uses of loff_t or __loff_t inside glibc to use off64_t or __off64_t instead, leaving only the definitions, treating this name as obsolescent. Tested for x86_64. [BZ #14553] * posix/sys/types.h (loff_t): Only define for [__USE_MISC]. * sysdeps/unix/sysv/linux/sys/quota.h (dqoff): Use __loff_t instead of loff_t.
* getlogin_r: switch Linux variant to struct scratch_bufferFlorian Weimer2018-02-061-21/+13
| | | | | | | | [BZ #18023] * sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid): Use scratch_buffer instead of extend_alloca. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add TCP_FASTOPEN_KEY, TCP_FASTOPEN_NO_COOKIE from Linux 4.15.Joseph Myers2018-02-061-0/+2
| | | | | | | | | | This patch adds the TCP_FASTOPEN_KEY and TCP_FASTOPEN_NO_COOKIE macros from Linux 4.15 to sysdeps/gnu/netinet/tcp.h. Tested for x86_64. * sysdeps/gnu/netinet/tcp.h (TCP_FASTOPEN_KEY): New macro. (TCP_FASTOPEN_NO_COOKIE): Likewise.
* Add IPV6_FREEBIND from Linux 4.15.Joseph Myers2018-02-061-0/+1
| | | | | | | | | This patch adds the IPV6_FREEBIND macro from Linux 4.15 to sysdeps/unix/sysv/linux/bits/in.h. Tested for x86_64. * sysdeps/unix/sysv/linux/bits/in.h (IPV6_FREEBIND): New macro.
* Add MAP_SYNC from Linux 4.15.Joseph Myers2018-02-0610-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the MAP_SYNC macro from Linux 4.15 to various bits/mman.h headers. Note that this is *not* added to all architectures: in Linux 4.15, this macro is only in asm-generic/mman.h, and only some architectures' asm/mman.h include the asm-generic file - the architectures not using the asm-generic file will need their own values of MAP_SYNC allocated to support this functionality (some of them also already have conflicting mmap flags so the value there will have to be different from the generic 0x80000). Specifically, for glibc architectures, alpha hppa mips powerpc sparc tile lack allocations of values for MAP_SYNC. Tested for x86_64. * sysdeps/unix/sysv/linux/aarch64/bits/mman.h [__USE_MISC] (MAP_SYNC): New macro. * sysdeps/unix/sysv/linux/arm/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/ia64/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/m68k/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/microblaze/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/nios2/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/riscv/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/s390/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/sh/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise. * sysdeps/unix/sysv/linux/x86/bits/mman.h [__USE_MISC] (MAP_SYNC): Likewise.
* Add MAP_SHARED_VALIDATE from Linux 4.15.Joseph Myers2018-02-062-0/+4
| | | | | | | | | | | | This patch adds the MAP_SHARED_VALIDATE macro from Linux 4.15 to bits/mman-linux.h and the hppa bits/mman.h. Tested for x86_64. * sysdeps/unix/sysv/linux/bits/mman-linux.h [__USE_MISC] (MAP_SHARED_VALIDATE): New macro. * sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_MISC] (MAP_SHARED_VALIDATE): Likewise.
* i386: Use __glibc_likely/__glibc_likely in dl-machine.hH.J. Lu2018-02-051-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The differences in elf/dl-reloc.os are --- before 2018-02-05 03:53:31.970492246 -0800 +++ after 2018-02-05 03:53:49.719902340 -0800 @@ -1202,9 +1202,9 @@ _dl_relocate_object: movl -60(%ebp), %eax testl %eax, %eax je .L249 - movl 8(%eax), %eax - movl 8(%ebx), %esi - cmpl %esi, %eax + movl 8(%eax), %esi + movl 8(%ebx), %eax + cmpl %eax, %esi ja .L284 jb .L707 .L285: @@ -2255,7 +2255,7 @@ _dl_relocate_object: cmpl $6, %edi movl $4, %edx je .L132 - cmpl %ecx, %eax + cmpl %eax, %ecx je .L350 cmpl $7, %edi je .L419 @@ -2735,7 +2735,7 @@ _dl_relocate_object: je .L120 .L121: movl -96(%ebp), %edx - movl $640, 8(%esp) + movl $639, 8(%esp) leal __PRETTY_FUNCTION__.9431@GOTOFF(%edx), %eax movl %eax, 12(%esp) leal .LC9@GOTOFF(%edx), %eax @@ -3454,10 +3454,10 @@ _dl_relocate_object: movl -152(%ebp), %eax movl %eax, 4(%esp) call _dl_dprintf - movl -60(%ebp), %eax - movl 8(%ebx), %esi + movl 8(%ebx), %eax + movl -60(%ebp), %ebx movl -112(%ebp), %edx - movl 8(%eax), %eax + movl 8(%ebx), %esi jmp .L285 .L713: movl %esi, (%esp) * sysdeps/i386/dl-machine.h (elf_machine_rel): Replace __builtin_expect with __glibc_likely and __glibc_unlikely. (elf_machine_rela): Likewise. (elf_machine_lazy_rel): Likewise.
* x86-64: Use __glibc_likely/__glibc_likely in dl-machine.hH.J. Lu2018-02-051-7/+7
| | | | | | | | | | | | | | | | | | | | The differences in elf/dl-reloc.os are --- before 2018-02-05 03:52:32.803125207 -0800 +++ after 2018-02-05 03:52:14.913711879 -0800 @@ -1129,7 +1129,7 @@ _dl_relocate_object: leaq __PRETTY_FUNCTION__.9767(%rip), %rcx leaq .LC11(%rip), %rsi leaq .LC12(%rip), %rdi - movl $540, %edx + movl $539, %edx call __GI___assert_fail .p2align 4,,10 .p2align 3 * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Replace __builtin_expect with __glibc_likely and __glibc_likely. (elf_machine_lazy_rel): Likewise.
* sparc: Check PIC instead of SHARED in start.S [BZ #22638]H.J. Lu2018-02-052-4/+4
| | | | | | | | | | Since start.o may be compiled as PIC, we should check PIC instead of SHARED. [BZ #22638] * sysdeps/sparc/sparc32/start.S (_start): Check PIC instead of SHARED. * sysdeps/sparc/sparc64/start.S (_start): Likewise.
* preadv2/pwritev2: Handle offset == -1 [BZ #22753]Florian Weimer2018-02-028-8/+33
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* aarch64: Use the L() macro for labels in memcmpSiddhesh Poyarekar2018-02-021-16/+16
| | | | | | The L() macro makes the assembly a bit more readable. * sysdeps/aarch64/memcmp.S: Use L() macro for labels.
* Update syscall-names.list for 4.15.Joseph Myers2018-02-011-2/+3
| | | | | | | | | | | | | | | | This patch updates sysdeps/unix/sysv/linux/syscall-names.list for Linux 4.15. There only appears to be one new syscall to add to the list. (The riscv_flush_icache syscall is *not* added because for whatever reason it doesn't appear in the uapi asm/unistd.h; only in arch/riscv/include/uapi/asm/syscalls.h, which is only included by the non-uapi asm/unistd.h - and only syscalls whose __NR_* macros are defined in the uapi asm/unistd.h are relevant for this list.) Tested for x86_64, and with build-many-glibcs.py. * sysdeps/unix/sysv/linux/syscall-names.list: Update kernel version to 4.15. (s390_sthyi): New syscall.
* Move LDBL_CLASSIFY_COMPAT to its own header.Joseph Myers2018-02-0115-30/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The general rule in glibc is that it's better for a macro to be always defined, and tested with #if, than for it to be tested with #ifdef, because the latter is prone to typos in the macro name as well as to the header with the macro accidentally not being included in a file testing it. (Testing with an "if" statement is even better, in those cases where it's possible to do things that way, as it then means both cases in the code get checked for syntax in glibc builds with either value of the condition.) math_private.h has several different groups of macros, meaning that architectures wanting to override some of them need to define those then include the generic version, which then defines macros if not already defined. It's hard to avoid that arrangement completely, but various cases can be improved by splitting out macros or groups of macros into separate files. This patch splits out the LDBL_CLASSIFY_COMPAT macro into a separate ldbl-classify-compat.h header. This macro is tested with #ifdef; this patch changes it to testing with #if, with a default definition to 0 in the generic header and then architecture-specific headers defining it to 1. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/generic/ldbl-classify-compat.h: New file. * sysdeps/arm/ldbl-classify-compat.h: Likewise. * sysdeps/m68k/coldfire/ldbl-classify-compat.h: Likewise. * sysdeps/microblaze/ldbl-classify-compat.h: Likewise. * sysdeps/mips/ldbl-classify-compat.h: Likewise. * sysdeps/nios2/ldbl-classify-compat.h: Likewise. * sysdeps/sh/ldbl-classify-compat.h: Likewise. * sysdeps/ieee754/dbl-64/s_finite.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/s_isinf.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/s_isnan.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/arm/math_private.h (LDBL_CLASSIFY_COMPAT): Remove macro. * sysdeps/mips/math_private.h (LDBL_CLASSIFY_COMPAT): Likewise. * sysdeps/m68k/coldfire/math_private.h: Remove file. * sysdeps/microblaze/math_private.h: Likewise. * sysdeps/nios2/math_private.h: Likewise. * sysdeps/sh/math_private.h: Likewise.
* Remove some math_private.h libc_feholdexcept_setround overrides.Joseph Myers2018-02-015-106/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | math_private.h headers for configurations lacking support for floating-point exceptions and rounding modes define libc_feholdexcept_setround to override the default version with one that discards its rounding mode argument. Unlike other such libc_fe* macros that I removed, this one is actually used for such configurations (in dbl-64/e_sqrt.c). However, this does not make the macro required. It's only used for such configurations with FE_TONEAREST as the rounding mode (anything needing another mode should not be used when that mode is unavailable), and the default definition just calls __feholdexcept and __fesetround. Since we now have suitable inline do-nothing definitions of __feholdexcept and __fesetround for the cases of no exceptions and rounding modes, we can just rely on those inlines to achieve the same optimization as this macro definition. Thus, this patch removes those macro definitions (and the math_private.h headers containing them, when no longer needed after that removal). Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/m68k/coldfire/fpu/math_private.h: Move to .... * sysdeps/m68k/coldfire/math_private.h: ... here. * sysdeps/m68k/coldfire/nofpu/math_private.h: Remove file. * sysdeps/tile/math_private.h: Likewise. * sysdeps/microblaze/math_private.h (libc_feholdexcept_setround): Remove macro. * sysdeps/nios2/math_private.h (libc_feholdexcept_setround): Likewise.
* Remove some math_private.h libc_fe* overrides.Joseph Myers2018-02-014-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | math_private.h headers for configurations lacking support for floating-point exceptions and rounding modes define various libc_fe* macros to override the default versions with ones that discard any exception or rounding mode arguments. Three of the four macros defined in these headers are no longer needed there: those macros are only used in fma implementations that are not used for such configurations, now all those configurations properly use soft-fp fma implementations instead. (Effectively, those macros were a workaround to allow glibc to build in the absence of a proper fma implementation for this case - now there is such an implementation, there is no need to support building the wrong implementation for those configurations.) Thus, this patch removes the unnecessary macros. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/m68k/coldfire/nofpu/math_private.h (libc_fesetround): Remove macro. (libc_fetestexcept): Likewise. (libc_feupdateenv_test): Likewise. * sysdeps/microblaze/math_private.h (libc_fesetround): Likewise. (libc_fetestexcept): Likewise. (libc_feupdateenv_test): Likewise. * sysdeps/nios2/math_private.h (libc_fesetround): Likewise. (libc_fetestexcept): Likewise. (libc_feupdateenv_test): Likewise. * sysdeps/tile/math_private.h (libc_fesetround): Likewise. (libc_fetestexcept): Likewise. (libc_feupdateenv_test): Likewise.
* Add feholdexcept inline in generic math_private.h.Joseph Myers2018-02-011-0/+12
| | | | | | | | | | | | | | | | | | | | | Continuing the process of improving and cleaning up the handling of configurations lacking support for floating-point exceptions and rounding modes, this patch adds trivial inline definitions of feholdexcept and __feholdexcept to the set of inlines for such configurations in math_private.h. These inlines were missing from the tile version used as a basis for the previous inlines, despite a few such function calls ending up in libm.so. Tested with build-many-glibcs.py. As expected, installed stripped shared libraries are unchanged for architectures supporting exceptions and rounding modes, but changed for architectures lacking such support. * sysdeps/generic/math_private.h [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (feholdexcept): New inline function. [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (__feholdexcept): Likewise.
* Move fenv.h override inline functions to generic math_private.h.Joseph Myers2018-02-012-14/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tile version of math_private.h defines some inline functions for fenv.h functions, to optimize away internal calls to these functions that do nothing given no support for floating-point exceptions and rounding modes. (Some functions may have error cases for invalid arguments, but those aren't applicable to the internal calls from within glibc.) Other configurations lacking support for exceptions and rounding modes lack such inline functions. This patch moves them to the generic math_private.h, appropriately conditioned, so that all such configurations can benefit from the. include/fenv.h is made to check whether there are any non-default rounding modes; that needs to be done there, rather than later, because get-rounding-mode.h defines values for otherwise unsupported FE_* rounding modes. It also gives an error for FE_TONEAREST undefined, a case that already did not work for building the glibc testsuite; the convention has by now been established that all architectures need to provide a version of bits/fenv.h that at least defines FE_TONEAREST. Tested with build-many-glibcs.py. As expected, installed stripped shared libraries are unchanged for tile and for architectures supporting exceptions and rounding modes, but changed for non-tile architectures not supporting exceptions and rounding modes that previously lacked this optimization (e.g. Nios II libm.so is about 1kB smaller). The optimization is not in fact complete (does not cover feholdexcept / __feholdexcept, so a few calls to those remain unnecessarily within libm even after this patch), but that can be dealt with separately. * include/fenv.h [!_ISOMAC && !FE_TONEAREST]: Give #error. [!_ISOMAC] (FE_HAVE_ROUNDING_MODES): New macro. * sysdeps/generic/math_private.h [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (fegetenv): New inline function. [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (__fegetenv): Likewise. [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (fesetenv): Likewise. [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (__fesetenv): Likewise. [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (feupdateenv): Likewise. [!FE_HAVE_ROUNDING_MODES && FE_ALL_EXCEPT == 0] (__feupdateenv): Likewise. [!FE_HAVE_ROUNDING_MODES] (fegetround): Likewise. [!FE_HAVE_ROUNDING_MODES] (__fegetround): Likewise. [!FE_HAVE_ROUNDING_MODES] (fesetround): Likewise. [!FE_HAVE_ROUNDING_MODES] (__fesetround): Likewise. * sysdeps/tile/math_private.h (fegetenv): Remove inline function. (__fegetenv): Likewise. (fesetenv): Likewise. (__fesetenv): Likewise. (feupdateenv): Likewise. (__feupdateenv): Likewise. (fegetround): Likewise. (__fegetround): Likewise. (fesetround): Likewise. (__fesetround): Likewise.
* Move some fenv.h override macros to generic math_private.h.Joseph Myers2018-02-015-25/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Various configurations lacking support for floating-point exceptions and rounding modes have a math_private.h that overrides certain functions and macros, internal and external, to avoid references to FE_* constants that are undefined in those configurations. For example, there are unconditional feraiseexcept (FE_INVALID) calls in generic libm code, and these macro definitions duly define feraiseexcept to ignore its argument to avoid an error from FE_INVALID being undefined. In fact it is easy to tell in an architecture-independent way whether this is needed, by testing whether FE_ALL_EXCEPT == 0. Thus, this patch puts such a test, and feraiseexcept and __feraiseexcept macros, in the generic math_private.h, so reducing the duplication between architecture versions of this header. The feclearexcept macro present in several versions of this header, and fetestexcept in the tile version, are not needed; they would have been needed before there were proper soft-fp fma implementations (when generic versions, that depend on FE_TOWARDZERO and FE_INEXACT, were being used for configurations not supporting those features), but aren't needed any more, and so are removed. The tile version of this header has several inline functions for fenv.h functions to optimize calls to them away in such configurations where they do nothing useful, and all these header versions also have definitions of some of the libc_fe* internal macros. I intend to make those generic in subsequent patches. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. * sysdeps/generic/math_private.h [FE_ALL_EXCEPT == 0] (feraiseexcept): New macro. [FE_ALL_EXCEPT == 0] (__feraiseexcept): Likewise. * sysdeps/m68k/coldfire/nofpu/math_private.h (feraiseexcept): Remove macro. (__feraiseexcept): Likewise. (feclearexcept): Likewise. * sysdeps/microblaze/math_private.h (feraiseexcept): Likewise. (__feraiseexcept): Likewise. (feclearexcept): Likewise. * sysdeps/nios2/math_private.h (feraiseexcept): Likewise. (__feraiseexcept): Likewise. (feclearexcept): Likewise. * sysdeps/tile/math_private.h (feraiseexcept): Likewise. (__feraiseexcept): Likewise. (feclearexcept): Likewise. (fetestexcept): Likewise.
* Add ColdFire math-tests.h.Joseph Myers2018-02-011-0/+29
| | | | | | | | | | Since I've been fixing build issues for ColdFire, this patch adds a math-tests.h file for ColdFire, reflecting the lack of support for exceptions and rounding modes for soft float. I think it is logically correct, but have not tested it beyond build-many-glibcs.py for both hard and soft float. * sysdeps/m68k/coldfire/math-tests.h: New file.
* Fix m68k bits/fenv.h for no-FPU ColdFire.Joseph Myers2018-02-011-11/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The m68k bits/fenv.h is in sysdeps/m68k/fpu/, meaning that no-FPU ColdFire instead gets the generic (top-level) bits/fenv.h. That top-level bits/fenv.h defines no rounding mode constants. That no longer works for building glibc tests: some tests fail to build (at least with warnings) if no rounding mode macros are defined, so at least FE_TONEAREST must be defined in all cases (as various architectures without rounding mode support indeed do), while __FE_UNDEFINED must be defined in the case where not all the standard rounding modes are supported. On general principles of supporting multilib toolchains with a single set of headers shared between multilibs for a given architecture, it's also desirable for the same bits/fenv.h header to work for both FPU and no-FPU configurations. Thus, this patch moves the m68k bits/fenv.h to sysdeps/m68k/bits/fenv.h, and inserts appropriate conditionals to handle the no-FPU case. All the exception macros, and FE_NOMASK_ENV, are disabled in the no-FPU case; FE_ALL_EXCEPT is defined to 0 in that case. All rounding modes except FE_TONEAREST are disabled in that case, and __FE_UNDEFINED is defined accordingly. To avoid an unnecessary ABI change, fenv_t is defined in the no-FPU case to match the definition it would have got from the generic bits/fenv.h. This suffices to get a clean glibc and testsuite build for this configuration with build-many-glibcs.py (and keeps a clean build for the other m68k configurations); it has not been otherwise tested. * sysdeps/m68k/fpu/bits/fenv.h: Move to .... * sysdeps/m68k/bits/fenv.h: ... here. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (FE_INEXACT): Do not define. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (FE_DIVBYZERO): Likewise. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (FE_UNDERFLOW): Likewise. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (FE_OVERFLOW): Likewise. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (FE_INVALID): Likewise. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (FE_ALL_EXCEPT): Define to 0. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (__FE_UNDEFINED): New enum constant. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (FE_TOWARDZERO): Do not define. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (FE_DOWNWARD): Likewise. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (FE_UPWARD): Likewise. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (fenv_t): Define to match generic bits/fenv.h. [!__HAVE_68881__ && !__HAVE_FPU__ && !__mcffpu__] (FE_NOMASK_ENV): Do not define.
* Fix -Os log1p, log1pf build (bug 21314).Carlos O'Donell2018-02-012-3/+26
| | | | | | | | | | | | | | | | | | | | | | As reported in bug 21314, building log1p and log1pf fails with -Os because of a spurious -Wmaybe-uninitialized warning (reported there for GCC 5 for MIPS, I see it also with GCC 7 for x86_64). This patch, based on the patches in the bug, fixes this using the DIAG_* macros. Tested for x86_64 with -Os that this eliminates those warnings and so allows the build to progress further. 2018-02-01 Carlos O'Donell <carlos@redhat.com> Ramin Seyed-Moussavi <lordrasmus@gmail.com> Joseph Myers <joseph@codesourcery.com> [BZ #21314] * sysdeps/ieee754/dbl-64/s_log1p.c: Include <libc-diag.h>. (__log1p): Disable -Wmaybe-uninitialized for -Os around computation using c. * sysdeps/ieee754/flt-32/s_log1pf.c: Include <libc-diag.h>. (__log1pf): Disable -Wmaybe-uninitialized for -Os around computation using c.
* allocalim.h: use __glibc_likely instead of __builtin_expectSamuel Thibault2018-01-301-2/+2
| | | | | * sysdeps/pthread/allocalim.h (__libc_use_alloca): Use __glibc_likely instead of __builtin_expect.
* hurd: include generic's hp-timing.h instead of copying itSamuel Thibault2018-01-301-18/+1
| | | | | * sysdeps/mach/hurd/hp-timing.h: include <sysdeps/generic/hp-timing.h> instead of copying it.
* hurd: Add tlsdesc.symSamuel Thibault2018-01-301-0/+19
| | | | * sysdeps/mach/hurd/i386/tlsdesc.sym: New file.
* hurd: disable hp timingSamuel Thibault2018-01-301-0/+38
| | | | | | | | We don't have support for hp timing for now, even the i686 variant, which needs to know the CPU speed. Copied from sysdeps/generic/hp-timing.h * sysdeps/mach/hurd/hp-timing.h: New file.
* hurd: Fix comments for FREAD and FWRITESamuel Thibault2018-01-291-1/+1
| | | | | * bits/fcntl.h: Fix comment for FREAD and FWRITE. * sysdeps/mach/hurd/bits/fcntl.h: Likewise.
* allocalim.h: Fix codestyleSamuel Thibault2018-01-291-3/+3
| | | | | * sysdeps/pthread/allocalim.h (__libc_use_alloca): Commute operands of || to respect codestyle.
* Reject invalid definitions of _POSIX_CHOWN_RESTRICTED, _POSIX_NO_TRUNC, ↵Andreas Schwab2018-01-292-24/+18
| | | | | | | | _POSIX_VDISABLE POSIX requires that the constants _POSIX_CHOWN_RESTRICTED, _POSIX_NO_TRUNC, and _POSIX_VDISABLE are always defined to a value other than -1.
* hurd: Add expected ABI listsSamuel Thibault2018-01-2911-0/+3674
| | | | | | | | | | | | | | | | * hurd/Versions: Fix version when _hurd_exec_paths was added. * mach/Versions: Fix version when __mach_host_self_ was added. * sysdeps/mach/hurd/i386/ld.abilist: New file. * sysdeps/mach/hurd/i386/libBrokenLocale.abilist: New file. * sysdeps/mach/hurd/i386/libanl.abilist: New file. * sysdeps/mach/hurd/i386/libc.abilist: New file. * sysdeps/mach/hurd/i386/libcrypt.abilist: New file. * sysdeps/mach/hurd/i386/libdl.abilist: New file. * sysdeps/mach/hurd/i386/libm.abilist: New file. * sysdeps/mach/hurd/i386/libnsl.abilist: New file. * sysdeps/mach/hurd/i386/libresolv.abilist: New file. * sysdeps/mach/hurd/i386/librt.abilist: New file. * sysdeps/mach/hurd/i386/libutil.abilist: New file.
* RISC-V: Add ipc_priv.hPalmer Dabbelt2018-01-291-0/+21
| | | | | | | | | This contains a definition of __IPC_64 that matches the RISC-V Linux ABI. 2018-01-29 Darius Rad <darius@bluespec.com> * sysdeps/unix/sysv/linux/riscv/ipc_priv.h: New file.
* RISC-V: Build InfastructurePalmer Dabbelt2018-01-2918-0/+433
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch lays out the top-level orginazition of the RISC-V port. It contains all the Implies files as well as various other fragments of build infastructure for the RISC-V port. This contains the only change to a shared file: config.h.in. RISC-V is a family of base ISAs with optional extensions. The base ISAs are RV32I and RV64I, which are 32-bit and 64-bit integer-only ISAs, but this port currently only supports RV64I based systems. Support for RISC-V lives in in sysdeps/riscv. In addition to these ISAs, our glibc port supports most of the currently-defined extensions: the A extension for atomics, the M extension for multiplication, the C extension for compressed instructions, and the F/D extensions for single/double precision IEEE floating-point. Most of these extensions are handled by GCC, but glibc defines various floating-point wrappers and emulation routines as well as some atomic wrappers. We support running glibc-based programs on Linux, the support for which lives in sysdeps/unix/sysv/linux/riscv. 2018-01-29 Palmer Dabbelt <palmer@sifive.com> * sysdeps/riscv/Implies: New file. * sysdeps/riscv/Makefile: Likewise. * sysdeps/riscv/configure: Likewise. * sysdeps/riscv/configure.ac: Likewise. * sysdeps/riscv/nptl/Makefile: Likewise. * sysdeps/riscv/preconfigure: Likewise. * sysdeps/riscv/rv64/Implies-after: Likewise. * sysdeps/riscv/rv64/rvd/Implies: Likewise. * sysdeps/riscv/rv64/rvf/Implies: Likewise. * sysdeps/unix/sysv/linux/riscv/Implies: Likewise. * sysdeps/unix/sysv/linux/riscv/Makefile: Likewise. * sysdeps/unix/sysv/linux/riscv/Versions: Likewise. * sysdeps/unix/sysv/linux/riscv/configure: Likewise. * sysdeps/unix/sysv/linux/riscv/configure.ac: Likewise. * sysdeps/unix/sysv/linux/riscv/ldd-rewrite.sed: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/Implies: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/Makefile: Likewise. * sysdeps/unix/sysv/linux/riscv/shlib-versions: Likewise.
* RISC-V: Add ABI ListsPalmer Dabbelt2018-01-2919-0/+8087
| | | | | | | | | | | | | | | | | | | | | | | I started with the aarch64 ABI lists and manually went through each difference, ensuring that the missing entries had been deprecated along the line. Darius generated the ulps files by running the test cases on QEMU. 2018-01-29 Palmer Dabbelt <palmer@sifive.com> * sysdeps/riscv/nofpu/libm-test-ulps: New file. * sysdeps/riscv/nofpu/libm-test-ulps-name: Likewise. * sysdeps/riscv/rv64/rvd/libm-test-ulps: Likewise. * sysdeps/riscv/rv64/rvd/libm-test-ulps-name: Likewise. * sysdeps/unix/sysv/linux/riscv/localplt.data: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/c++-types.data: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libanl.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libdl.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libnsl.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/librt.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libutil.abilist: Likewise.
* RISC-V: Linux Startup and Dynamic Loading CodePalmer Dabbelt2018-01-293-0/+152
| | | | | | | | | | This contains the Linux-specific code for loading programs on RISC-V. 2018-01-29 Palmer Dabbelt <palmer@sifive.com> * sysdeps/unix/sysv/linux/riscv/dl-static.c: New file. * sysdeps/unix/sysv/linux/riscv/ldconfig.h: Likewise. * sysdeps/unix/sysv/linux/riscv/ldsodefs.h: Likewise.
* RISC-V: Linux ABIPalmer Dabbelt2018-01-2923-0/+1423
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux-specific code that is required for maintaining ABI compatibility. This doesn't contain the actual system call interface, that is split out in order to avoid having a patch that's too big. 2018-01-29 Palmer Dabbelt <palmer@sifive.com> * sysdeps/riscv/nptl/pthread-offsets.h: New file. * sysdeps/riscv/nptl/pthreaddef.h: Likewise. * sysdeps/unix/sysv/linux/riscv/bits/fcntl.h: Likewise. * sysdeps/unix/sysv/linux/riscv/bits/mman.h: Likewise. * sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h: Likewise. * sysdeps/unix/sysv/linux/riscv/dl-cache.h: Likewise. * sysdeps/unix/sysv/linux/riscv/flush-icache.c: Likewise. * sysdeps/unix/sysv/linux/riscv/getcontext.S: Likewise. * sysdeps/unix/sysv/linux/riscv/init-first.c: Likewise. * sysdeps/unix/sysv/linux/riscv/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/riscv/makecontext.c: Likewise. * sysdeps/unix/sysv/linux/riscv/readelflib.c: Likewise. * sysdeps/unix/sysv/linux/riscv/register-dump.h: Likewise. * sysdeps/unix/sysv/linux/riscv/setcontext.S: Likewise. * sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h: Likewise. * sysdeps/unix/sysv/linux/riscv/swapcontext.S: Likewise. * sysdeps/unix/sysv/linux/riscv/sys/cachectl.h: Likewise. * sysdeps/unix/sysv/linux/riscv/sys/procfs.h: Likewise. * sysdeps/unix/sysv/linux/riscv/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/riscv/sys/user.h: Likewise. * sysdeps/unix/sysv/linux/riscv/ucontext-macros.h: Likewise. * sysdeps/unix/sysv/linux/riscv/ucontext_i.sym: Likewise.
* RISC-V: Linux Syscall InterfacePalmer Dabbelt2018-01-299-0/+601
| | | | | | | | | | | | | | | | | Contains the Linux system call interface, as well as the definitions of a handful of system calls. 2018-01-29 Palmer Dabbelt <palmer@sifive.com> * sysdeps/riscv/nptl/nptl-sysdep.S: New file. * sysdeps/unix/sysv/linux/riscv/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/riscv/clone.S: Likewise. * sysdeps/unix/sysv/linux/riscv/profil-counter.h: Likewise. * sysdeps/unix/sysv/linux/riscv/pt-vfork.S: Likewise. * sysdeps/unix/sysv/linux/riscv/syscall.c: Likewise. * sysdeps/unix/sysv/linux/riscv/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/riscv/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/riscv/vfork.S: Likewise.
* RISC-V: Atomic and Locking RoutinesPalmer Dabbelt2018-01-294-0/+303
| | | | | | | | | | | | | This patch implements various atomic and locking routines on RISC-V. We mandate the A extension on Linux-capable RISC-V systems, so this can rely on always having the various atomic instructions availiable. 2018-01-29 Palmer Dabbelt <palmer@sifive.com> * sysdeps/riscv/nptl/bits/pthreadtypes-arch.h: New file. * sysdeps/riscv/nptl/bits/semaphore.h: Likewise. * sysdeps/riscv/nptl/libc-lowlevellock.c: Likewise. * sysdeps/unix/sysv/linux/riscv/atomic-machine.h: Likewise.
* RISC-V: Hard Float SupportPalmer Dabbelt2018-01-2958-0/+2161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains hardware floating-point support for the RISC-V ISA. While we currently only support hard-float systems with both the F and D extensions, I've left the F-specific code split out into seperate folders in order to ease adding support for F-only and RV32I-based systems in the future. I gave this a quick once-over and believe I've removed all the code that implements RV32IF, RV32IFD, and RV64IF targets. 2018-01-29 Palmer Dabbelt <palmer@sifive.com> * sysdeps/riscv/rv64/rvd/s_ceil.c: New file. * sysdeps/riscv/rv64/rvd/s_floor.c: Likewise. * sysdeps/riscv/rv64/rvd/s_llrint.c: Likewise. * sysdeps/riscv/rv64/rvd/s_llround.c: Likewise. * sysdeps/riscv/rv64/rvd/s_lrint.c: Likewise. * sysdeps/riscv/rv64/rvd/s_lround.c: Likewise. * sysdeps/riscv/rv64/rvd/s_nearbyint.c: Likewise. * sysdeps/riscv/rv64/rvd/s_rint.c: Likewise. * sysdeps/riscv/rv64/rvd/s_round.c: Likewise. * sysdeps/riscv/rv64/rvd/s_roundeven.c: Likewise. * sysdeps/riscv/rv64/rvd/s_trunc.c: Likewise. * sysdeps/riscv/rv64/rvf/s_llrintf.c: Likewise. * sysdeps/riscv/rv64/rvf/s_llroundf.c: Likewise. * sysdeps/riscv/rv64/rvf/s_lrintf.c: Likewise. * sysdeps/riscv/rv64/rvf/s_lroundf.c: Likewise. * sysdeps/riscv/rvd/e_sqrt.c: Likewise. * sysdeps/riscv/rvd/s_copysign.c: Likewise. * sysdeps/riscv/rvd/s_finite.c: Likewise. * sysdeps/riscv/rvd/s_fma.c: Likewise. * sysdeps/riscv/rvd/s_fmax.c: Likewise. * sysdeps/riscv/rvd/s_fmin.c: Likewise. * sysdeps/riscv/rvd/s_fpclassify.c: Likewise. * sysdeps/riscv/rvd/s_isinf.c: Likewise. * sysdeps/riscv/rvd/s_isnan.c: Likewise. * sysdeps/riscv/rvd/s_issignaling.c: Likewise. * sysdeps/riscv/rvf/e_sqrtf.c: Likewise. * sysdeps/riscv/rvf/fclrexcpt.c: Likewise. * sysdeps/riscv/rvf/fegetenv.c: Likewise. * sysdeps/riscv/rvf/fegetmode.c: Likewise. * sysdeps/riscv/rvf/fegetround.c: Likewise. * sysdeps/riscv/rvf/feholdexcpt.c: Likewise. * sysdeps/riscv/rvf/fesetenv.c: Likewise. * sysdeps/riscv/rvf/fesetexcept.c: Likewise. * sysdeps/riscv/rvf/fesetmode.c: Likewise. * sysdeps/riscv/rvf/fesetround.c: Likewise. * sysdeps/riscv/rvf/feupdateenv.c: Likewise. * sysdeps/riscv/rvf/fgetexcptflg.c: Likewise. * sysdeps/riscv/rvf/fraiseexcpt.c: Likewise. * sysdeps/riscv/rvf/fsetexcptflg.c: Likewise. * sysdeps/riscv/rvf/ftestexcept.c: Likewise. * sysdeps/riscv/rvf/get-rounding-mode.h: Likewise. * sysdeps/riscv/rvf/math_private.h: Likewise. * sysdeps/riscv/rvf/s_ceilf.c: Likewise. * sysdeps/riscv/rvf/s_copysignf.c: Likewise. * sysdeps/riscv/rvf/s_finitef.c: Likewise. * sysdeps/riscv/rvf/s_floorf.c: Likewise. * sysdeps/riscv/rvf/s_fmaf.c: Likewise. * sysdeps/riscv/rvf/s_fmaxf.c: Likewise. * sysdeps/riscv/rvf/s_fminf.c: Likewise. * sysdeps/riscv/rvf/s_fpclassifyf.c: Likewise. * sysdeps/riscv/rvf/s_isinff.c: Likewise. * sysdeps/riscv/rvf/s_isnanf.c: Likewise. * sysdeps/riscv/rvf/s_issignalingf.c: Likewise. * sysdeps/riscv/rvf/s_nearbyintf.c: Likewise. * sysdeps/riscv/rvf/s_rintf.c: Likewise. * sysdeps/riscv/rvf/s_roundevenf.c: Likewise. * sysdeps/riscv/rvf/s_roundf.c: Likewise. * sysdeps/riscv/rvf/s_truncf.c: Likewise.
* RISC-V: Generic <math.h> and soft-fp RoutinesPalmer Dabbelt2018-01-297-0/+330
| | | | | | | | | | | | | | | | | This patch contains the miscellaneous math routines and headers we have implemented for RISC-V. This includes things from <math.h> that aren't completely ISA-generic, floating-point bit manipulation, and soft-fp hooks. 2018-01-29 Palmer Dabbelt <palmer@sifive.com> * sysdeps/riscv/bits/fenv.h: New file. * sysdeps/riscv/e_sqrtl.c: Likewise. * sysdeps/riscv/fpu_control.h: Likewise. * sysdeps/riscv/math-tests.h: Likewise. * sysdeps/riscv/nofpu/Implies: Likewise. * sysdeps/riscv/sfp-machine.h: Likewise. * sysdeps/riscv/tininess.h: Likewise.
* RISC-V: Thread-Local Storage SupportPalmer Dabbelt2018-01-295-0/+264
| | | | | | | | | | | | | | | | | This patch implements TLS support for RISC-V. We support all four standard TLS addressing modes (LE, IE, LD, and GD) when running on Linux via NPTL. There is a draft psABI document that defines our TLS ABI here https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#thread-local-storage 2018-01-29 Palmer Dabbelt <palmer@sifive.com> * sysdeps/riscv/dl-tls.h: New file. * sysdeps/riscv/libc-tls.c: Likewise. * sysdeps/riscv/nptl/tcb-offsets.sym: Likewise. * sysdeps/riscv/nptl/tls.h: Likewise. * sysdeps/riscv/stackinfo.h: Likewise.
* RISC-V: ABI ImplementationPalmer Dabbelt2018-01-2923-0/+1154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains code that needs to directly know about the RISC-V ABI, which is specified in a work-in-progress psABI document: https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md This is meant to contain all the RISC-V code that needs to explicitly name registers or manage in-memory structure layout. This does not contain any of the Linux-specific code. 2018-01-29 Palmer Dabbelt <palmer@sifive.com> * sysdeps/riscv/__longjmp.S: New file. * sysdeps/riscv/backtrace.c: Likewise. * sysdeps/riscv/bits/endian.h: Likewise. * sysdeps/riscv/bits/setjmp.h: Likewise. * sysdeps/riscv/bits/wordsize.h: Likewise. * sysdeps/riscv/bsd-_setjmp.c: Likewise. * sysdeps/riscv/bsd-setjmp.c: Likewise. * sysdeps/riscv/dl-trampoline.S: Likewise. * sysdeps/riscv/gccframe.h: Likewise. * sysdeps/riscv/jmpbuf-offsets.h: Likewise. * sysdeps/riscv/jmpbuf-unwind.h: Likewise. * sysdeps/riscv/machine-gmon.h: Likewise. * sysdeps/riscv/memusage.h: Likewise. * sysdeps/riscv/setjmp.S: Likewise. * sysdeps/riscv/sys/asm.h: Likewise. * sysdeps/riscv/tls-macros.h: Likewise.
* sysdeps/init_array: Add PREINIT_FUNCTION to crti.SPalmer Dabbelt2018-01-291-0/+14
| | | | | | | | | | | | | The RISC-V port contains a crti.S that simply contains a link to PREINIT_FUNCTION (when defined). As this should be entirely generic, Joseph Myers suggested that we update the generic init_array version to contain this. Since RISC-V is the only user of init_array this won't break any existing ports. 2018-01-29 Palmer Dabbelt <palmer@sifive.com> * sysdeps/init_array/crti.S (.section .init_array): Add PREINIT_FUNCTION when defined.
* microblaze: don't use copy_file_range syscall with kernel headers < 4.10Romain Naour2018-01-291-0/+5
| | | | | | | | | | | | | | copy_file_range syscall was added for microblaze in 4.10. This patch makes the MicroBlaze kernel-features.h undefine __ASSUME_COPY_FILE_RANGE for toolchains built with kernel headers < 4.10. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_COPY_FILE_RANGE) [__LINUX_KERNEL_VERSION < 0x040A00]: Undef. [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=7181e5590e5ba898804aef3ee6be7f27606e6f8b Signed-off-by: Romain Naour <romain.naour@gmail.com>
* hurd: Fix includesSamuel Thibault2018-01-293-1/+2
| | | | | | | * sysdeps/mach/hurd/net/ethernet.h: Include <stdint.h>. * sysdeps/mach/hurd/net/if_arp.h: Include <stdint.h>. * sysdeps/mach/hurd/net/if_ppp.h: Do not include non-existing <net/ppp_defs.h>.
* hurd: Fix _POSIX_VDISABLE valueSamuel Thibault2018-01-291-1/+1
| | | | | * sysdeps/mach/hurd/bits/posix_opt.h (_POSIX_VDISABLE): Set to '\0' instead of invalid -1.
* hurd: Build stubs for new gnumach.defsSamuel Thibault2018-01-282-2/+2
| | | | | | * mach/Makefile (user-interfaces): Add mach/gnumach. * sysdeps/mach/configure.ac (mach_interface_list): Add gnumach. * sysdeps/mach/configure (mach_interface_list): Regenerate.
* hurd: Fix allocalim buildSamuel Thibault2018-01-281-2/+5
| | | | | * sysdeps/pthread/allocalim.h [!defined PTHREAD_STACK_MIN]: Do not check size against PTHREAD_STACK_MIN.
* hurd: Fix posix optionsSamuel Thibault2018-01-281-2/+2
| | | | | | | _POSIX_CHOWN_RESTRICTED and _POSIX_NO_TRUNC should be always defined. * sysdeps/mach/hurd/bits/posix_opt.h (_POSIX_CHOWN_RESTRICTED, _POSIX_NO_TRUNC): Define to 0.
* hurd: Fix getifaddrs / freeifaddrs expositionSamuel Thibault2018-01-281-2/+0
| | | | | | | | | | | 400669754de4 ('hurd: Fix nscd build') had the side effect of making libc's freeaddrinfo expose freeifaddrs through __check_pf. We can just move the renames to gai.c itself, along others. * sysdeps/mach/hurd/check_pf.c (__getifaddrs, __freeifaddrs): Do not define macros. * nscd/gai.c (__getifaddrs): Define macro to getifaddrs. (__freeifaddrs): Define macro to freeifaddrs.