about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Always use wordsize-64 version of s_rint.c.Stefan Liebler2019-12-113-75/+17
| | | | | | | | | | This patch replaces s_rint.c in sysdeps/dbl-64 with the one in sysdeps/dbl-64/wordsize-64 and removes the latter one. The code is not changed except changes in code style. Also adjusted the include path in x86_64 file. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Always use wordsize-64 version of s_nearbyint.c.Stefan Liebler2019-12-113-88/+17
| | | | | | | | | | This patch replaces s_nearbyint.c in sysdeps/dbl-64 with the one in sysdeps/dbl-64/wordsize-64 and removes the latter one. The code is not changed except changes in code style. Also adjusted the include path in x86_64 file. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* hurd: Fix using altstack while in an RPC call to be abortedSamuel Thibault2019-12-111-13/+14
| | | | | | | * sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler): Always check for interrupted code being with esp pointing at mach_msg arguments, even when using an altstack. If we need to abort the RPC we will need this.
* nptl: Add more missing placeholder abi symbol from nanosleep moveAdhemerval Zanella2019-12-0915-9/+15
| | | | | | | | | | | | | | | | | | | | This patch adds the missing __libpthread_version_placeholder for GLIBC_2.2.6 version from the nanosleep implementation move from libpthread to libc (79a547b162). It also fixes the wrong compat symbol definitions added by changing back the version used on vfork check and remove the __libpthread_version_placeholder added on some ABI (4f4bb489e0dd). The __libpthread_version_placeholder is also refactored to make it simpler to add new compat_symbols by adding a new macro compat_symbol_unique which uses the compiler extension __COUNTER__ to generate unique strong alias to be used with compat_symbol. Checked with a updated-abi on the all affected abis of the nanosleep move. Change-Id: I347a4dbdc931bb42b359456932dd1e17aa4d4078
* sysdeps/riscv/start.S: rename .Lload_gp to load_gp (bug 24376)Andreas Schwab2019-12-091-3/+3
| | | | | Renaming the symbol keeps the label in the symbol table as a normal local label, so that `objdump -d' can pick it up as an anchor.
* y2038: linux: Provide __timer_settime64 implementationLukasz Majewski2019-12-051-6/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __timer_settime64 explicit 64 bit function for setting flags, interval and value of specified timer. Moreover, a 32 bit version - __timer_settime has been refactored to internally use __timer_settime64. The __timer_settime is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion to 64 bit struct __timespec64 from struct timespec (and opposite when old_value pointer is provided). The new __timer_settime64 syscall available from Linux 5.1+ has been used, when applicable. The original INLINE_SYSCALL() macro has been replaced with INLINE_SYSCALL_CALL() to avoid explicit passing the number of arguments. Build tests: - The code has been tested on x86_64/x86 (native compilation): make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\ make xcheck PARALLELMFLAGS="-j8" - The glibc has been build tested (make PARALLELMFLAGS="-j8") for x86 (i386), x86_64-x32, and armv7 Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master - Use of cross-test-ssh.sh for ARM (armv7): make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck Linux kernel, headers and minimal kernel version for glibc build test matrix: - Linux v5.1 (with timer_settime64) and glibc build with v5.1 as minimal kernel version (--enable-kernel="5.1.0") The __ASSUME_TIME64_SYSCALLS flag defined. - Linux v5.1 and default minimal kernel version The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports timer_settime64 syscall. - Linux v4.19 (no timer_settime64 support) with default minimal kernel version for contemporary glibc (3.2.0) This kernel doesn't support timer_settime64 syscall, so the fallback to timer_settime is tested. Above tests were performed with Y2038 redirection applied as well as without (so the __TIMESIZE != 64 execution path is checked as well). No regressions were observed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* y2038: linux: Provide __timer_gettime64 implementationLukasz Majewski2019-12-051-4/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provides new __timer_gettime64 explicit 64 bit function for reading status of specified timer. To be more precise - the remaining time and interval set with timer_settime. Moreover, a 32 bit version - __timer_gettime has been refactored to internally use __timer_gettime64. The __timer_gettime is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion from 64 bit struct __timespec64 to struct timespec. The new __timer_gettime64 syscall available from Linux 5.1+ has been used, when applicable. The original INLINE_SYSCALL() macro has been replaced with INLINE_SYSCALL_CALL() to avoid explicit passing the number of arguments. Build tests: - The code has been tested on x86_64/x86 (native compilation): make PARALLELMFLAGS="-j8" && make check PARALLELMFLAGS="-j8" && \\ make xcheck PARALLELMFLAGS="-j8" - The glibc has been build tested (make PARALLELMFLAGS="-j8") for x86 (i386), x86_64-x32, and armv7 Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master - Use of cross-test-ssh.sh for ARM (armv7): make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck Linux kernel, headers and minimal kernel version for glibc build test matrix: - Linux v5.1 (with timer_gettime64) and glibc build with v5.1 as minimal kernel version (--enable-kernel="5.1.0") The __ASSUME_TIME64_SYSCALLS flag defined. - Linux v5.1 and default minimal kernel version The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports timer_gettime64 syscall. - Linux v4.19 (no timer_gettime64 support) with default minimal kernel version for contemporary glibc (3.2.0) This kernel doesn't support timer_gettime64 syscall, so the fallback to timer_gettime is tested. Above tests were performed with Y2038 redirection applied as well as without (so the __TIMESIZE != 64 execution path is checked as well). No regressions were observed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* timer: Decouple x86_64 specific timer_settime from generic Linux implementationLukasz Majewski2019-12-052-11/+10
| | | | | | | | | | | | | | | | The x86_64 specific timer_settime implementation (from ./linux/x86_64/timer_settime.c) reused the Linux generic one (from ./linux/timer_settime.c) to implement handling some compatible timers (previously defined in librt, now in libc). As the generic implementation now is going to also support new (available from Linux 5.1+) timer_settime64 syscall, those two implementations have been decoupled for easier conversion. The original INLINE_SYSCALL() macro has been replaced with INLINE_SYSCALL_CALL() to avoid explicit passing the number of arguments. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* timer: Decouple x86_64 specific timer_gettime from generic Linux implementationLukasz Majewski2019-12-052-11/+8
| | | | | | | | | | | | | | | | The x86_64 specific timer_gettime implementation (from ./linux/x86_64/timer_gettime.c) reused the Linux generic one (from ./linux/timer_gettime.c) to implement handling some compatible timers (previously defined in librt, now in libc). As the generic implementation now is going to also support new (available from Linux 5.1+) timer_gettime64 syscall, those two implementations have been decoupled for easier conversion. The original INLINE_SYSCALL() macro has been replaced with INLINE_SYSCALL_CALL() to avoid explicit passing the number of arguments. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* misc/test-errno-linux: Handle EINVAL from quotactlFlorian Weimer2019-12-051-2/+3
| | | | | | | | | In commit 3dd4d40b420846dd35869ccc8f8627feef2cff32 ("xfs: Sanity check flags of Q_XQUOTARM call"), Linux 5.4 added checking for the flags argument, causing the test to fail due to too restrictive test expectations. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/clock_gettime: Use clock_gettime64 if avaliableAlistair Francis2019-12-041-1/+43
| | | | | | | | With the clock_gettime64 call we prefer to use vDSO. There is no call to clock_gettime64 on glibc with older headers and kernel 5.1+ if it doesn't support vDSO. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps: Add clock_gettime64 vDSOAlistair Francis2019-12-042-0/+14
| | | | | | | | | | | | | Add support for the clock_gettim64 vDSO calls. These are protected by the HAVE_CLOCK_GETTIME64_VSYSCALL define. HAVE_CLOCK_GETTIME64_VSYSCALL should be defined for 32-bit platforms (WORDSIZE == 32) that only run on the 5.1 kernel or later. WORDSIZE == 64 platforms can use #define __vdso_clock_gettime64 __vdso_clock_gettime and use the __vdso_clock_gettime syscall as they don't have a __vdso_clock_gettime64 call. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Expand $(as-needed) and $(no-as-needed) throughout the build systemFlorian Weimer2019-12-031-1/+1
| | | | | | | | | Since commit a3cc4f48e94f32c9532ee36982ac00eb1e5719b0 ("Remove --as-needed configure test."), --as-needed support is no longer optional. The macros are not much shorter and do not provide documentary value, either, so this commit removes them.
* ldbl-128ibm-compat: Add tests for strfroml, strtold, and wcstoldGabriel F. T. Gomes2019-12-037-0/+103
| | | | | | | | | | | | | | | | | Since the commit commit 86a0f56158bd9cbaf2d640e2e6c66539f4cbbcc1 Author: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com> Date: Thu Jun 28 13:57:50 2018 +0530 ldbl-128ibm-compat: Introduce ieee128 symbols IEEE long double versions of strfroml, strtold, and wcstold have been prepared, but not exposed (which will only happen when the full support for IEEE long double is complete). This patch adds tests for these functions in both IBM and IEEE long double mode. Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Add tests for strfmon and strfmon_lGabriel F. T. Gomes2019-12-034-0/+67
| | | | | | | | | | This patch adds elementary tests to check that strfmon and strfmon_l correctly evaluate long double values with IBM Extended Precision and IEEE binary128 format. Tested for powerpc64le. Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Add strfmon_l with IEEE long double formatRajalakshmi Srinivasaraghavan2019-12-034-0/+85
| | | | | | | | | | | | Similarly to what has been done for printf-like functions, more specifically to the internal implementation in __vfprintf_internal, this patch extends __vstrfmon_l_internal to deal with long double values with binary128 format (as a third format option and reusing the float128 implementation). Tested for powerpc64le, powerpc64, x86_64, and with build-many-glibcs. Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Replace http with https in new filesGabriel F. T. Gomes2019-12-0363-63/+63
| | | | | | | Several commits to the ldbl-128ibm-compat directory added new files where the URL in the copyright notice pointed to an http, rather than to an https, address. This happened because I copied the notices before commit ID 5a82c74822d3. This trivial patch fixes this issue.
* elf: Do not run IFUNC resolvers for LD_DEBUG=unused [BZ #24214]Florian Weimer2019-12-026-10/+20
| | | | | | | | | This commit adds missing skip_ifunc checks to aarch64, arm, i386, sparc, and x86_64. A new test case ensures that IRELATIVE IFUNC resolvers do not run in various diagnostic modes of the dynamic loader. Reviewed-By: Szabolcs Nagy <szabolcs.nagy@arm.com>
* hurd: Fix ld.so __access override from libcSamuel Thibault2019-12-014-5/+7
| | | | | | ld.so symbols to be overriden by libc need to be extern to really get overriden. __access happens to have never been exposed, putting it to GLIBC_PRIVATE.
* hurd: Fix ld.so __getcwd override from libcSamuel Thibault2019-12-015-5/+8
| | | | | | ld.so symbols to be overriden by libc need to be extern to really get overriden. __getcwd happens to have never been exposed, putting it to GLIBC_PRIVATE.
* hurd: Make __sigprocmask GLIBC_PRIVATESamuel Thibault2019-12-013-6/+4
| | | | We do not need to expose it.
* hurd: Fix renameat2 errorSamuel Thibault2019-12-011-0/+2
| | | | | renameat2 has to exclude RENAME_EXCHANGE | RENAME_NOREPLACE with EINVAL, as tested by stdio-common/tst-renameat2.
* hurd: Fix ld.so linkSamuel Thibault2019-12-015-5/+17
| | | | | Since a2e8aa0d9ea6 ("Block signals during the initial part of dlopen") dl_open uses sigprocmask, so we need a stub implementation.
* Update kernel version to 5.4 in tst-mman-consts.py.Joseph Myers2019-11-291-1/+1
| | | | | | | | This patch updates the kernel version in the test tst-mman-consts.py to 5.4. (There are no new constants covered by this test in 5.4 that need any other header changes.) Tested with build-many-glibcs.py.
* Update SOMAXCONN value from Linux 5.4.Joseph Myers2019-11-291-1/+1
| | | | | | | | | | | | | | | | | Linux 5.4 changes the SOMAXCONN value from 128 to 4096 (this isn't in a uapi header; various constants related to the kernel/userspace interface, including this one, are in the non-uapi linux/socket.h header). This patch increases the value in glibc. As I understand it, it is safe to use a higher value even with older kernels (the kernel will simply adjust the value passed to listen to be no more than the value supported in the kernel), and SOMAXCONN is actually only a default for a sysctl value in the kernel that can be changed at runtime. So I think updating the value in glibc is a reasonable and safe thing to do. Tested for x86_64.
* Update syscall-names.list for Linux 5.4.Joseph Myers2019-11-281-2/+2
| | | | | | | | This patch updates syscall-names.list for Linux 5.4. There are no new syscalls, so this is just a matter of updating the version number listed in the file. Tested with build-many-glibcs.py.
* Define MADV_COLD and MADV_PAGEOUT from Linux 5.4.Joseph Myers2019-11-281-0/+2
| | | | | | | | Linux 5.4 adds constants MADV_COLD and MADV_PAGEOUT (defined with the same values on all architectures). This patch adds them to bits/mman-linux.h. Tested for x86_64.
* Avoid late dlopen failure due to scope, TLS slotinfo updates [BZ #25112]Florian Weimer2019-11-271-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | This change splits the scope and TLS slotinfo updates in dlopen into two parts: one to resize the data structures, and one to actually apply the update. The call to add_to_global_resize in dl_open_worker is moved before the demarcation point at which no further memory allocations are allowed. _dl_add_to_slotinfo is adjusted to make the list update optional. There is some optimization possibility here because we could grow the slotinfo list of arrays in a single call, one the largest TLS modid is known. This commit does not fix the fatal meory allocation failure in _dl_update_slotinfo. Ideally, this error during dlopen should be recoverable. The update order of scopes and TLS data structures is retained, although it appears to be more correct to fully initialize TLS first, and then expose symbols in the newly loaded objects via the scope update. Tested on x86_64-linux-gnu. Change-Id: I240c58387dabda3ca1bcab48b02115175fa83d6c
* Avoid late failure in dlopen in global scope update [BZ #25112]Florian Weimer2019-11-271-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | The call to add_to_global in dl_open_worker happens after running ELF constructors for new objects. At this point, proper recovery from malloc failure would be quite complicated: We would have to run the ELF destructors and close all opened objects, something that we currently do not do. Instead, this change splits add_to_global into two phases, add_to_global_resize (which can raise an exception, called before ELF constructors run), and add_to_global_update (which cannot, called after ELF constructors). A complication arises due to recursive dlopen: After the inner dlopen consumes some space, the pre-allocation in the outer dlopen may no longer be sufficient. A new member in the namespace structure, _ns_global_scope_pending_adds keeps track of the maximum number of objects that need to be added to the global scope. This enables the inner add_to_global_resize call to take into account the needs of an outer dlopen. Most code in the dynamic linker assumes that the number of global scope entries fits into an unsigned int (matching the r_nlist member of struct r_scop_elem). Therefore, change the type of _ns_global_scope_alloc to unsigned int (from size_t), and add overflow checks. Change-Id: Ie08e2f318510d5a6a4bcb1c315f46791b5b77524
* ldbl-128ibm-compat: Add syslog functionsGabriel F. T. Gomes2019-11-2710-1/+163
| | | | | | | | | | | | | | | | Similarly to __vfprintf_internal and __vfscanf_internal, the internal implementation of syslog functions (__vsyslog_internal) takes a 'mode_flags' parameter used to select the format of long double parameters. This patch adds variants of the syslog functions that set 'mode_flags' to PRINTF_LDBL_USES_FLOAT128, thus enabling the correct printing of long double values on powerpc64le, when long double has IEEE binary128 format (-mabi=ieeelongdouble). Tested for powerpc64le. Reviewed-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Joseph Myers <joseph@codesourcery.com> Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Add obstack printing functionsGabriel F. T. Gomes2019-11-2712-1/+209
| | | | | | | | | | | Similarly to the functions from the *printf family, this patch adds implementations for __obstack_*printf* functions that set the 'mode_flags' parameter to PRINTF_LDBL_USES_FLOAT128, before making calls to __vfprintf_internal (indirectly through __obstack_vprintf_internal). Tested for powerpc64le. Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Reuse tests for err.h and error.h functionsGabriel F. T. Gomes2019-11-271-0/+15
| | | | | | | | | | | | | Commit IDs 9771e6cb5102 and 7597b0c7f711 added tests for the functions from err.h and error.h that can take long double parameters. Afterwards, commit ID f0eaf8627654 reused them on architectures that changed the long double format from the same as double to something else (i.e.: architectures that imply ldbl-opt). This patch reuses it again for IEEE long double on powerpc64le. Tested for powerpc64le. Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Add error.h functionsGabriel F. T. Gomes2019-11-273-1/+56
| | | | | | | | | | | | Use the recently added, internal functions, __error_at_line_internal and __error_internal, to provide error.h functions that can take long double arguments with IEEE binary128 format on platforms where long double can also take double format or some non-IEEE format (currently, this means powerpc64le). Tested for powerpc64le. Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Add err.h functionsGabriel F. T. Gomes2019-11-273-0/+106
| | | | | | | | | | | | Use the recently added, internal functions, __vwarnx_internal and __vwarn_internal, to provide err.h functions that can take long double arguments with IEEE binary128 format on platforms where long double can also take double format or some non-IEEE format (currently, this means powerpc64le). Tested for powerpc64le. Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Add argp_error and argp_failureGabriel F. T. Gomes2019-11-273-0/+59
| | | | | | | | | | | | Use the recently added, internal functions, __argp_error_internal and __argp_failure_internal, to provide argp_error and argp_failure that can take long double arguments with IEEE binary128 format on platforms where long double can also take double format or some non-IEEE format (currently, this means powerpc64le). Tested for powerpc64le. Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
* sparc: Use atomic compiler builtins on sparcAdhemerval Zanella2019-11-2716-1032/+166
| | | | | | | | | | | | | | | | | This patch removes the arch-specific atomic instruction, relying on compiler builtins. The __sparc32_atomic_locks support is removed and a configure check is added to check if compiler uses libatomic to implement CAS. It also removes the sparc specific sem_* and pthread_barrier_* implementations. It in turn allows buidling against a LEON3/LEON4 sparcv8 target, although it will still be incompatible with generic sparcv9. Checked on sparcv9-linux-gnu and sparc64-linux-gnu. I also checked with build against sparcv8-linux-gnu with -mcpu=leon3. Tested-by: Andreas Larsson <andreas@gaisler.com>
* Remove 32 bit sparc v7 supportAdhemerval Zanella2019-11-2724-2702/+410
| | | | | | | | | | | | | | | | | | The patch is straighforward: - The sparc32 v8 implementations are moved as the generic ones. - A configure test is added to check for either __sparc_v8__ or __sparc_v9__. - The triple names are simplified and sparc implies sparcv8. The idea is to keep support on sparcv8 architectures that does support CAS instructions, such as LEON3/LEON4. Checked on a sparcv9-linux-gnu and sparc64-linux-gnu. Tested-by: Andreas Larsson <andreas@gaisler.com>
* S390: Fix handling of needles crossing a page in strstr z15 ifunc-variant. ↵Stefan Liebler2019-11-271-1/+1
| | | | | | | | | | | | | | | | | [BZ #25226] If the specified needle crosses a page-boundary, the s390-z15 ifunc variant of strstr truncates the needle which results in invalid results. This is fixed by loading the needle beyond the page boundary to v18 instead of v16. The bug is sometimes observable in test-strstr.c in check1 and check2 as the haystack and needle is stored on stack. Thus the needle can be on a page boundary. check2 is now extended to test haystack / needles located on stack, at end of page and on two pages. This bug was introduced with commit 6f47401bd5fc71209219779a0426170a9a7395b0 ("S390: Add arch13 strstr ifunc variant.") and is already released in glibc 2.30.
* nptl: Fix __PTHREAD_MUTEX_INITIALIZER for !__PTHREAD_MUTEX_HAVE_PREVAdhemerval Zanella2019-11-261-1/+1
| | | | | | | | The nptl: Add struct_mutex.h added a wrong initializer for architectures that uses the generic struct_mutex.h. Checked on sparcv9-linux-gnu (where I noted the issue with the nptl/tst-initializers1*).
* hppa: Remove unrequired nptl headersAdhemerval Zanella2019-11-261-1171/+0
| | | | | | | | | | Now that both pthread_mutex_t and pthread_rwlock_t static initializer are parametrized in their own headers HPPA pthread.h is identical to generic nptl one. Checked on hppa-linux-gnu. Change-Id: I236cfceb5656cfcce42c9e367a4f6803e2abd88b
* nptl: Add default pthread-offsets.hAdhemerval Zanella2019-11-2612-74/+26
| | | | | | | | | | This patch adds a default pthread-offsets.h based on default thread definitions from struct_mutex.h and struct_rwlock.h. The idea is to simplify new ports inclusion. Checked with a build on affected abis. Change-Id: I7785a9581e651feb80d1413b9e03b5ac0452668a
* nptl: Add default pthreadtypes-arch.hAdhemerval Zanella2019-11-269-320/+17
| | | | | | | | | | | | | | | | | | | | | | | This patch adds a default pthreadtypes-arch.h, the idea is to simpify new ports inclusion and an override is required only if the architecture adds some arch-specific extensions or requirement. The default values on the new generic header are based on current architecture define value and they are not optimal compared to current code requirements as below. - On 64 bits __SIZEOF_PTHREAD_BARRIER_T is defined as 32 while is sizeof (struct pthread_barrier) is 20 bytes. - On 32 bits __SIZEOF_PTHREAD_ATTR_T is defined as 36 while sizeof (struct pthread_attr) is 32. The default values are not changed so the generic header could be used by some architectures. Checked with a build on affected abis. Change-Id: Ie0cd586258a2650f715c1af0c9fe4e7063b0409a
* nptl: Add struct_rwlock.hAdhemerval Zanella2019-11-2630-433/+624
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new generic __pthread_rwlock_arch_t definition meant to be used by new ports. Its layout mimics the current usage on some 64 bits ports and it allows some ports to use the generic definition. The arch __pthread_rwlock_arch_t definition is moved from pthreadtypes-arch.h to another arch-specific header (struct_rwlock.h). Also the static intialization macro for pthread_rwlock_t is set to use an arch defined on (__PTHREAD_RWLOCK_INITIALIZER) which simplifies its implementation. The default pthread_rwlock_t layout differs from current ports with: 1. Internal layout is the same for 32 bits and 64 bits. 2. Internal flag is an unsigned short so it should not required additional padding to align for word boundary (if it is the case for the ABI). Checked with a build on affected abis. Change-Id: I776a6a986c23199929d28a3dcd30272db21cd1d0
* nptl: Add struct_mutex.hAdhemerval Zanella2019-11-2625-260/+415
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current way of defining the common mutex definition for POSIX and C11 on pthreadtypes-arch.h (added by commit 06be6368da16104be5) is not really the best options for newer ports. It requires define some misleading flags that should be always defined as 0 (__PTHREAD_COMPAT_PADDING_MID and __PTHREAD_COMPAT_PADDING_END), it exposes options used solely for linuxthreads compat mode (__PTHREAD_MUTEX_USE_UNION and __PTHREAD_MUTEX_NUSERS_AFTER_KIND), and requires newer ports to explicit define them (adding more boilerplate code). This patch adds a new default __pthread_mutex_s definition meant to be used by newer ports. Its layout mimics the current usage on both 32 and 64 bits ports and it allows most ports to use the generic definition. Only ports that use some arch-specific definition (such as hardware lock-elision or linuxthreads compat) requires specific headers. For 32 bit, the generic definitions mimic the other 32-bit ports of using an union to define the fields uses on adaptive and robust mutexes (thus not allowing both usage at same time) and by using a single linked-list for robust mutexes. Both decisions seemed to follow what recent ports have done and make the resulting pthread_mutex_t/mtx_t object smaller. Also the static intialization macro for pthread_mutex_t is set to use a macro __PTHREAD_MUTEX_INITIALIZER where the architecture can redefine in its struct_mutex.h if it requires additional fields to be initialized. Checked with a build on affected abis. Change-Id: I30a22c3e3497805fd6e52994c5925897cffcfe13
* nptl: Remove rwlock elision definitionsAdhemerval Zanella2019-11-2617-46/+7
| | | | | | | | | | The new rwlock implementation added by cc25c8b4c1196 (2.25) removed support for lock-elision. This patch removes remaining the arch-specific unused definitions. Checked with a build against all affected ABIs. Change-Id: I5dec8af50e3cd56d7351c52ceff4aa3771b53cd6
* nptl: Add tests for internal pthread_rwlock_t offsetsAdhemerval Zanella2019-11-2617-0/+70
| | | | | | | | | | | | | This patch new build tests to check for internal fields offsets for internal pthread_rwlock_t definition. Althoug the '__data.__flags' field layout should be preserved due static initializators, the patch also adds tests for the futexes that may be used in a shared memory (although using different libc version in such scenario is not really supported). Checked with a build against all affected ABIs. Change-Id: Iccc103d557de13d17e4a3f59a0cad2f4a640c148
* nptl: Cleanup mutex internal offset testsAdhemerval Zanella2019-11-2617-84/+0
| | | | | | | | | | | | | The offsets of pthread_mutex_t __data.__nusers, __data.__spins, __data.elision, __data.list are not required to be constant over the releases. Only the __data.__kind is used for static initializers. This patch also adds an additional size check for __data.__kind. Checked with a build against affected ABIs. Change-Id: I7a4e48cc91b4c4ada57e9a5d1b151fb702bfaa9f
* sysdeps/posix/getaddrinfo: Return early on invalid address familyTim Rühsen2019-11-261-22/+18
| | | | Check address family before expensive function call (__check_pf).
* sysdeps/posix: Simplify if expression in getaddrinfoTim Rühsen2019-11-261-1/+1
| | | | Small code cleanup for better readability.
* arm: Fix armv7 selection after 'Split BE/LE abilist'Adhemerval Zanella2019-11-255-0/+5
| | | | | | | | | | | | It adds the missing Implies for armv7, armv6, armv6t2 after the commit 1673ba87fefe019c. Without the Implies a build with the compiler targeting the aforementioned architecture does not select the arch-specific optimization including the ifunc selectors. I checked with a build against armv5, armv6, armv6t2, armv7, and armv7-neon for both LE and BE. For armv6 and armv7 I also checked that both sysdeps selection and the resulting implementation built is the expected ones.