summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Implement __libc_early_initfw/libc-early-init-2Florian Weimer2019-11-2814-10/+311
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function is defined in libc.so, and the dynamic loader calls right after relocation has been finished, before any ELF constructors or the preinit function is invoked. It is also used in the static build for initializing parts of the static libc. To locate __libc_early_init, a direct symbol lookup function is used, _dl_lookup_direct. It does not search the entire symbol scope and consults merely a single link map. This function could also be used to implement lookups in the vDSO (as an optimization). A per-namespace variable (libc_map) is added for locating libc.so, to avoid repeated traversals of the search scope. It is similar to GL(dl_initfirst). An alternative would have been to thread a context argument from _dl_open down to _dl_map_object_from_fd (where libc.so is identified). This could have avoided the global variable, but the change would be larger as a result. It would not have been possible to use this to replace GL(dl_initfirst) because that global variable is used to pass the function pointer past the stack switch from dl_main to the main program. Replacing that requires adding a new argument to _dl_init, which in turn needs changes to the architecture-specific libc.so startup code written in assembler. __libc_early_init should not be used to replace _dl_var_init (as it exists today on some architectures). Instead, _dl_lookup_direct should be used to look up a new variable symbol in libc.so, and that should then be initialized from the dynamic loader, immediately after the object has been loaded in _dl_map_object_from_fd (before relocation is run). This way, more IFUNC resolvers which depend on these variables will work.
* Introduce <elf_machine_sym_no_match.h>Florian Weimer2019-11-285-23/+90
| | | | | | | | | | | | | | MIPS needs to ignore certain existing symbols during symbol lookup. The old scheme uses the ELF_MACHINE_SYM_NO_MATCH macro, with an inline function, within its own header, with a sysdeps override for MIPS. This allows re-use of the function from another file (without having to include <dl-machine.h> or providing the default definition for ELF_MACHINE_SYM_NO_MATCH). Built with build-many-glibcs.py, with manual verification that sysdeps/mips/elf_machine_sym_no_match.h is picked up on MIPS. Tested on aarch64-linux-gnu, i686-linux-gnu, powerpc64-linux-gnu, s390x-linux-gnu, x86_64-linux-gnu.
* Move _dl_open_check to its original place in dl_open_workerFlorian Weimer2019-11-271-6/+2
| | | | | | | | | | | | This reverts the non-test change from commit d0093c5cefb7f7a4143f ("Call _dl_open_check after relocation [BZ #24259]"), given that the underlying bug has been fixed properly in commit 61b74477fa7f63 ("Remove all loaded objects if dlopen fails, ignoring NODELETE [BZ #20839]"). Tested on x86-64-linux-gnu, with and without --enable-cet. Change-Id: I995a6cfb89f25d2b0cf5e606428c2a93eb48fc33
* Block signals during the initial part of dlopenFlorian Weimer2019-11-271-2/+26
| | | | | | | | | | | Lazy binding in a signal handler that interrupts a dlopen sees intermediate dynamic linker state. This has likely been always unsafe, but with the new pending NODELETE state, this is clearly incorrect. Other threads are excluded via the loader lock, but the current thread is not. Blocking signals until right before ELF constructors run is the safe thing to do. Change-Id: Iad079080ebe7442c13313ba11dc2797953faef35
* Remove all loaded objects if dlopen fails, ignoring NODELETE [BZ #20839]Florian Weimer2019-11-2710-38/+328
| | | | | | | | | | | | | This introduces a “pending NODELETE” state in the link map, which is flipped to the persistent NODELETE state late in dlopen, via activate_nodelete. During initial relocation, symbol binding records pending NODELETE state only. dlclose ignores pending NODELETE state. Taken together, this results that a partially completed dlopen is rolled back completely because new NODELETE mappings are unloaded. Tested on x86_64-linux-gnu and i386-linux-gnu. Change-Id: Ib2a3d86af6f92d75baca65431d74783ee0dbc292
* Avoid late dlopen failure due to scope, TLS slotinfo updates [BZ #25112]Florian Weimer2019-11-274-131/+258
| | | | | | | | | | | | | | | | | | | | | | | | 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-272-49/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Lazy binding failures during dlopen/dlclose must be fatal [BZ #24304]Florian Weimer2019-11-277-21/+216
| | | | | | | | | | | | | | | | | | | | | If a lazy binding failure happens during the execution of an ELF constructor or destructor, the dynamic loader catches the error and reports it using the dlerror mechanism. This is undesirable because there could be other constructors and destructors that need processing (which are skipped), and the process is in an inconsistent state at this point. Therefore, we have to issue a fatal dynamic loader error error and terminate the process. Note that the _dl_catch_exception in _dl_open is just an inner catch, to roll back some state locally. If called from dlopen, there is still an outer catch, which is why calling _dl_init via call_dl_init and a no-exception is required and cannot be avoiding by moving the _dl_init call directly into _dl_open. _dl_fini does not need changes because it does not install an error handler, so errors are already fatal there. Change-Id: I6b1addfe2e30f50a1781595f046f44173db9491a
* resolv: Implement trust-ad option for /etc/resolv.conf [BZ #20358]Florian Weimer2019-11-2711-1/+253
| | | | | | | | | | | | | | | | | This introduces a concept of trusted name servers, for which the AD bit is passed through to applications. For untrusted name servers (the default), the AD bit in responses are cleared, to provide a safe default. This approach is very similar to the one suggested by Pavel Šimerda in <https://bugzilla.redhat.com/show_bug.cgi?id=1164339#c15>. The DNS test framework in support/ is enhanced with support for setting the AD bit in responses. Tested on x86_64-linux-gnu. Change-Id: Ibfe0f7c73ea221c35979842c5c3b6ed486495ccc
* dlsym: Do not determine caller link map if not neededFlorian Weimer2019-11-271-4/+21
| | | | | | | | | | | | | | | | Obtaining the link map is potentially very slow because it requires iterating over all loaded objects in the current implementation. If the caller supplied an explicit handle (i.e., not one of the RTLD_* constants), the dlsym implementation does not need the identity of the caller (except in the special case of auditing), so this change avoids computing it in that case. Even in the minimal case (dlsym called from a main program linked with -dl), this shows a small speedup, perhaps around five percent. The performance improvement can be arbitrarily large in principle (if _dl_find_dso_for_object has to iterate over many link maps). Change-Id: Ide5d9e2cc7ac25a0ffae8fb4c26def0c898efa29
* libio: Disable vtable validation for pre-2.1 interposed handles [BZ #25203]Florian Weimer2019-11-271-0/+5
| | | | | | | | | | | | Commit c402355dfa7807b8e0adb27c009135a7e2b9f1b0 ("libio: Disable vtable validation in case of interposition [BZ #23313]") only covered the interposable glibc 2.1 handles, in libio/stdfiles.c. The parallel code in libio/oldstdfiles.c needs similar detection logic. Fixes (again) commit db3476aff19b75c4fdefbe65fcd5f0a90588ba51 ("libio: Implement vtable verification [BZ #20191]"). Change-Id: Ief6f9f17e91d1f7263421c56a7dc018f4f595c21
* 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-2726-2708/+418
| | | | | | | | | | | | | | | | | | 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-272-7/+36
| | | | | | | | | | | | | | | | | [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*).
* Compile elf/rtld.c with -fno-tree-loop-distribute-patterns.Sandra Loosemore2019-11-261-0/+6
| | | | | | | | | | | | | | In GCC 10, the default at -O2 is now -ftree-loop-distribute-patterns. This optimization causes GCC to "helpfully" convert the hand-written loop in _dl_start into a call to memset, which is not available that early in program startup. Similar problems in other places in GLIBC have been addressed by explicitly building with -fno-tree-loop-distribute-patterns, but this one may have been overlooked previously because it only affects targets where HAVE_BUILTIN_MEMSET is not defined. This patch fixes a bug observed on nios2-linux-gnu target that caused all programs to segv on startup.
* 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-2631-434/+625
| | | | | | | | | | | | | | | | | | | | | | | | 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-2626-261/+417
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2618-0/+78
| | | | | | | | | | | | | 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-2619-94/+6
| | | | | | | | | | | | | 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
* locale: Greek -> ASCII transliteration table [BZ #12031]Egor Kobylkin2019-11-261-0/+135
|
* ru_UA locale: use copy "ru_RU" in LC_TIME (bug 25044)Rafał Lużyński2019-11-261-69/+1
| | | | | | | | | | Replacing incorrect abbreviated weekday names "Пнд", "Вто", "Срд"... with correct ones "Пн", "Вт", "Ср"... makes the LC_TIME sections in those two locales almost identical. The only remaining difference was that ab_alt_mon elements in ru_UA were lowercase while in ru_RU they had the first letter uppercase, the latter was pointed as a better choice by a native speaker. This commit unifies LC_TIME between ru_RU and ru_UA.
* 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.
* Use Linux 5.4 in build-many-glibcs.py.Joseph Myers2019-11-261-1/+1
| | | | | | This patch makes build-many-glibcs.py use Linux 5.4. Tested with build-many-glibcs.py (compilers and glibcs builds).
* 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.
* ldbl-128ibm-compat: Add wide character scanning functionsGabriel F. T. Gomes2019-11-2211-1/+248
| | | | | | | | | | | | | Similarly to what was done for regular character scanning functions, this patch uses the new mode mask, SCANF_LDBL_USES_FLOAT128, in the 'mode' argument of the wide characters scanning function, __vfwscanf_internal (which is also extended to support scanning floating-point values with IEEE binary128, by redirecting calls to __wcstold_internal to __wcstof128_internal). Tested for powerpc64le. Reviewed-By: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Add regular character scanning functionsGabriel F. T. Gomes2019-11-2213-3/+421
| | | | | | | | | | | | | | | | | | | The 'mode' argument to __vfscanf_internal allows the selection of the long double format for all long double arguments requested by the format string. Currently, there are two possibilities: long double with the same format as double or long double as something else. The 'something else' format varies between architectures, and on powerpc64le, it means IBM Extended Precision format. In preparation for the third option of long double format on powerpc64le, this patch uses the new mode mask, SCANF_LDBL_USES_FLOAT128, which tells __vfscanf_internal to call __strtof128_internal, instead of __strtold_internal, and save the output into a _Float128 variable. Tested for powerpc64le. Reviewed-By: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Test positional argumentsGabriel F. T. Gomes2019-11-224-4/+38
| | | | | | | | | | | | | The format string can request positional parameters, instead of relying on the order in which they appear as arguments. Since this has an effect on how the type of each argument is determined, this patch extends the test cases to use positional parameters with mixed double and long double types, to verify that the IEEE long double implementations of *printf work correctly in this scenario. Tested for powerpc64le. Reviewed-By: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Test double valuesGabriel F. T. Gomes2019-11-224-110/+117
| | | | | | | | | | | | A single format string can take double and long double parameters at the same time. Internally, these parameters are routed to the same function, which correctly reads them and calls the underlying functions responsible for the actual conversion to string. This patch adds a new case to test this scenario. Tested for powerpc64le. Reviewed-By: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Add wide character, fortified printing functionsGabriel F. T. Gomes2019-11-2213-1/+357
| | | | | | | | | | | | | | | | | Similarly to what was done for the regular character, fortified printing functions, this patch combines the mode masks PRINTF_LDBL_USES_FLOAT128 and PRINTF_FORTIFY to provide wide character versions of fortified printf functions. It also adds two flavors of test cases: one that explicitly calls the fortified functions, and another that reuses the non-fortified test, but defining _FORTIFY_SOURCE as 2. The first guarantees that the implementations are actually being tested (independently of what's in bits/wchar2.h), whereas the second guarantees that the redirections calls the correct function in the IBM and IEEE long double cases. Tested for powerpc64le. Reviewed-By: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Add regular character, fortified printing functionsGabriel F. T. Gomes2019-11-2219-0/+649
| | | | | | | | | | | | | | | | | | | | | | | | | | Since the introduction of internal functions with explicit flags for the printf family of functions, the 'mode' parameter can be used to select which format long double parameters have (with the mode flags: PRINTF_LDBL_IS_DBL and PRINTF_LDBL_USES_FLOAT128), as well as to select whether to check for overflows (mode flag: PRINTF_FORTIFY). This patch combines PRINTF_LDBL_USES_FLOAT128 and PRINTF_FORTIFY to provide the IEEE binary128 version of printf-like function for platforms where long double can take this format, in addition to the double format and to some non-ieee format (currently, this means powerpc64le). There are two flavors of test cases provided with this patch: one that explicitly calls the fortified functions, for instance __asprintf_chk, and another that reuses the non-fortified test, but defining _FORTIFY_SOURCE as 2. The first guarantees that the implementations are actually being tested (in bits/stdio2.h, vprintf gets redirected to __vfprintf_chk, which would leave __vprintf_chk untested), whereas the second guarantees that the redirections calls the correct function in the IBM and IEEE long double cases. Tested for powerpc64le. Reviewed-By: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Add wide character printing functionsGabriel F. T. Gomes2019-11-2211-1/+321
| | | | | | | | | | | | | | | Similarly to what was done for regular character printing functions, this patch uses the new mode mask, PRINTF_LDBL_USES_FLOAT128, in the 'mode' argument of the wide characters printing function, __vfwprintf_internal (which is also extended to support printing floating-point values with IEEE binary128, by saving floating-point values into variables of type __float128 and adjusting the parameters to __printf_fp and __printf_fphex as if it was a call from a wide-character version of strfromf128 (even though such version does not exist)). Tested for powerpc64le. Reviewed-By: Paul E. Murphy <murphyp@linux.ibm.com>
* ldbl-128ibm-compat: Add regular character printing functionsGabriel F. T. Gomes2019-11-2217-1/+603
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'mode' argument to __vfprintf_internal allows the selection of the long double format for all long double arguments requested by the format string. Currently, there are two possibilities: long double with the same format as double or long double as something else. The 'something else' format varies between architectures, and on powerpc64le, it means IBM Extended Precision format. In preparation for the third option of long double format on powerpc64le, this patch uses the new mode mask, PRINTF_LDBL_USES_FLOAT128, which tells __vfprintf_internal to save the floating-point values into variables of type __float128 and adjusts the parameters to __printf_fp and __printf_fphex as if it was a call from strfromf128. Many files from the stdio-common, wcsmbs, argp, misc, and libio directories will have IEEE binary128 counterparts. Setting the correct compiler options to these files (original and counterparts) would produce a large amount of repetitive Makefile rules. To avoid this repetition, this patch adds a Makefile routine that iterates over the files adding or removing the appropriate flags. 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>
* Use DEPRECATED_SCANF macro for remaining C99-compliant scanf functionsGabriel F. T. Gomes2019-11-223-9/+2
| | | | | | | | | | | | | | | | | | | | When the commit commit 03992356e6fedc5a5e9d32df96c1a2c79ea28a8f Author: Zack Weinberg <zackw@panix.com> Date: Sat Feb 10 11:58:35 2018 -0500 Use C99-compliant scanf under _GNU_SOURCE with modern compilers. added the DEPRECATED_SCANF macro to select when redirections of *scanf functions to their ISO C99 compliant versions should happen, it accidentally missed doing it for vfwscanf, vwscanf, and vswscanf. Tested for powerpc64le and with build-many-glibcs (i686-linux-gnu and nios2-linux-gnu are failing with current master, and with this patch, but I didn't see a regression). Change-Id: I706b344a3fb50be017cdab9251d9da18a3ba8c60
* misc: Set generic pselect as ENOSYSAdhemerval Zanella2019-11-223-76/+80
| | | | | | | | | | | | | | | | | | The generic pselect implementation has the very specific race condition that motived the creation of the pselect syscall (no atomicity in signal mask set/reset). Using it as generic implementation is counterproductive Also currently only microblaze uses it as fallback when used on kernel prior 3.15. This patch moves the generic implementation to a microblaze specific one, sets the generic internal as a ENOSYS, and cleanups the Linux generic implementation. The microblaze implementation mimics the previous Linux generic one, where it either uses pselect6 directly if __ASSUME_PSELECT or a first try pselect6 then the fallback otherwise. Checked on x86_64-linux-gnu and microblaze-linux-gnu.
* Remove duplicate inline implementation of issignalingfPaul A. Clarke2019-11-222-11/+2
| | | | | | | | | | | | | | | | | | | | Very recent commit 854e91bf6b4221f424ffa13b9ef50f35623b7b74 enabled inline of issignalingf() in general (__issignalingf in include/math.h). There is another implementation for an inline use of issignalingf (issignalingf_inline in sysdeps/ieee754/flt-32/math_config.h) which could instead make use of the new enablement. Replace the use of issignalingf_inline with __issignaling. Using issignaling (instead of __issignalingf) will allow future enhancements to the type-generic implementation, issignaling, to be automatically adopted. The implementations are slightly different, and compile to slightly different code, but I measured no significant performance difference. The second implementation was brought to my attention by: Suggested-by: Joseph Myers <joseph@codesourcery.com> Reviewed-by: Joseph Myers <joseph@codesourcery.com>
* Don't use a custom wrapper macro around __has_include (bug 25189).Emilio Cobos Álvarez2019-11-212-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | This causes issues when using clang with -frewrite-includes to e.g., submit the translation unit to a distributed compiler. In my case, I was building Firefox using sccache. See [1] for a reduced test-case since I initially thought this was a clang bug, and [2] for more context. Apparently doing this is invalid C++ per [cpp.cond], which mentions [3]: > The #ifdef and #ifndef directives, and the defined conditional > inclusion operator, shall treat __has_include and __has_cpp_attribute > as if they were the names of defined macros. The identifiers > __has_include and __has_cpp_attribute shall not appear in any context > not mentioned in this subclause. [1]: https://bugs.llvm.org/show_bug.cgi?id=43982 [2]: https://bugs.llvm.org/show_bug.cgi?id=37990 [3]: http://eel.is/c++draft/cpp.cond#7.sentence-2 Change-Id: Id4b8ee19176a9e4624b533087ba870c418f27e60
* Enable inlining issignalingf within glibcPaul A. Clarke2019-11-212-29/+53
| | | | | | | | | issignalingf is a very small function used in some areas where better performance (and smaller code) might be helpful. Create inline implementation for issignalingf. Reviewed-by: Joseph Myers <joseph@codesourcery.com>
* Introduce DL_LOOKUP_FOR_RELOCATE flag for _dl_lookup_symbol_xFlorian Weimer2019-11-212-1/+5
| | | | | | | | | | This will allow changes in dependency processing during non-lazy binding, for more precise processing of NODELETE objects: During initial relocation in dlopen, the fate of NODELETE objects is still unclear, so objects which are depended upon by NODELETE objects cannot immediately be marked as NODELETE. Change-Id: Ic7b94a3f7c4719a00ca8e6018088567824da0658