about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* Fix build failure on tilepro due to unsupported atomicsWilco Dijkstra2017-10-182-1/+7
| | | | | * malloc/malloc.c (malloc_state): Use int for have_fastchunks since not all targets support atomics on bool.
* Use __f128 to define FLT128_* constants in include/float.h for old GCC.Joseph Myers2017-10-172-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | When using compilers before GCC 7, include/float.h provides fallback definitions of FLT128_* constants. These definitions use 'Q' constant suffixes, which works for configurations with _Float128 ABI-distinct from long double, but not where it has the same ABI as long double. This patch changes the definitions to use the __f128 macro from <bits/floatn.h>, so allowing them to work in the non-distinct _Float128 case (where they are used in building glibc tests, not for building glibc itself) as well. Tested (a) with build-many-glibcs.py with GCC 6 (installed stripped shared libraries unchanged by the patch); (b) with build-many-glibcs.py with GCC 6 together with the main patch to enable float128 aliases; (c) for x86_64 with both GCC 6 and GCC 7. * include/float.h [!__GNUC_PREREQ (7, 0) && __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (FLT128_MAX): Define using __f128. [!__GNUC_PREREQ (7, 0) && __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (FLT128_EPSILON): Likewise. [!__GNUC_PREREQ (7, 0) && __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (FLT128_MIN): Likewise. [!__GNUC_PREREQ (7, 0) && __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (FLT128_TRUE_MIN): Likewise.
* posix: Add p{readv,writev}2 flags to generic uio-ext.hAdhemerval Zanella2017-10-173-3/+11
| | | | | * bits/uio-ext.h (RWF_HIPRI, RWF_DSYNC, RWF_SYNC, RWF_NOWAIT): New defines.
* Improve malloc initialization sequenceWilco Dijkstra2017-10-173-118/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | The current malloc initialization is quite convoluted. Instead of sometimes calling malloc_consolidate from ptmalloc_init, call malloc_init_state early so that the main_arena is always initialized. The special initialization can now be removed from malloc_consolidate. This also fixes BZ #22159. Check all calls to malloc_consolidate and remove calls that are redundant initialization after ptmalloc_init, like in int_mallinfo and __libc_mallopt (but keep the latter as consolidation is required for set_max_fast). Update comments to improve clarity. Remove impossible initialization check from _int_malloc, fix assert in do_check_malloc_state to ensure arena->top != 0. Fix the obvious bugs in do_check_free_chunk and do_check_remalloced_chunk to enable single threaded malloc debugging (do_check_malloc_state is not thread safe!). [BZ #22159] * malloc/arena.c (ptmalloc_init): Call malloc_init_state. * malloc/malloc.c (do_check_free_chunk): Fix build bug. (do_check_remalloced_chunk): Fix build bug. (do_check_malloc_state): Add assert that checks arena->top. (malloc_consolidate): Remove initialization. (int_mallinfo): Remove call to malloc_consolidate. (__libc_mallopt): Clarify why malloc_consolidate is needed.
* Use relaxed atomics for malloc have_fastchunksWilco Dijkstra2017-10-172-32/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently free typically uses 2 atomic operations per call. The have_fastchunks flag indicates whether there are recently freed blocks in the fastbins. This is purely an optimization to avoid calling malloc_consolidate too often and avoiding the overhead of walking all fast bins even if all are empty during a sequence of allocations. However using catomic_or to update the flag is completely unnecessary since it can be changed into a simple boolean and accessed using relaxed atomics. There is no change in multi-threaded behaviour given the flag is already approximate (it may be set when there are no blocks in any fast bins, or it may be clear when there are free blocks that could be consolidated). Performance of malloc/free improves by 27% on a simple benchmark on AArch64 (both single and multithreaded). The number of load/store exclusive instructions is reduced by 33%. Bench-malloc-thread speeds up by ~3% in all cases. * malloc/malloc.c (FASTCHUNKS_BIT): Remove. (have_fastchunks): Remove. (clear_fastchunks): Remove. (set_fastchunks): Remove. (malloc_state): Add have_fastchunks. (malloc_init_state): Use have_fastchunks. (do_check_malloc_state): Remove incorrect invariant checks. (_int_malloc): Use have_fastchunks. (_int_free): Likewise. (malloc_consolidate): Likewise.
* Inline tcache functionsWilco Dijkstra2017-10-172-2/+7
| | | | | | | | | | | The functions tcache_get and tcache_put show up in profiles as they are a critical part of the tcache code. Inline them to give tcache a 16% performance gain. Since this improves multi-threaded cases as well, it helps offset any potential performance loss due to adding single-threaded fast paths. * malloc/malloc.c (tcache_put): Inline. (tcache_get): Inline.
* Fix armv7-a compiler option nameAdhemerval Zanella2017-10-171-2/+2
| | | | | This patch fixes the wrong -march name option used to define the ARMv7-A glibc variant pushed on commit 3d26560.
* New locale ca_ES@valencia [BZ #2522]Aurelien Jarno2017-10-173-0/+95
| | | | | | | | | | | | | The Valencian (meridional Catalan) locale is basically a copy of the Catalan locale. The point of having a separate locale is only for PO translations. This locale is already provided by several distributions and is already supported by various projects like LibreOffice, Mozilla, Gnome, KDE. Aurelien Jarno <aurelien@aurel32.net> [BZ #2522] * localedata/locales/ca_ES@valencia: New file. * localedata/SUPPORTED: Add ca_ES@valencia/UTF-8.
* Let signbit use the builtin in C++ mode with gcc < 6.x (bug 22296)Romain Naour2017-10-172-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using gcc < 6.x, signbit does not use the type-generic __builtin_signbit builtin, instead it uses __MATH_TG. However, when library support for float128 is available, __MATH_TG uses __builtin_types_compatible_p, which is not available in C++ mode. On the other hand, libstdc++ undefines (in cmath) many macros from math.h, including signbit, so that it can provide its own functions. However, during its configure tests, libstdc++ just tests for the availability of the macros (it does not undefine them, nor does it provide its own functions). Finally, libstdc++ configure tests include math.h and get the definition of signbit that uses __MATH_TG (and __builtin_types_compatible_p). Since libstdc++ does not undefine the macros during its configure tests, they fail. This patch lets signbit use the builtin in C++ mode when gcc < 6.x is used. This allows the configure test in libstdc++ to work. Tested for x86_64. [BZ #22296] * math/math.h: Let signbit use the builtin in C++ mode with gcc < 6.x Cc: Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com> Cc: Joseph Myers <joseph@codesourcery.com>
* Add build-many-glibcs.py arm-linux-gnueabihf-v7{-disable-multiarch}Adhemerval Zanella2017-10-172-1/+9
| | | | | | | | | | | | | | | This patch adds two extra configuration for arm-linux-gnueabihf to cover for multiarch support: 1. arm-linux-gnueabihf-v7a: enables multiarch support by using -march=armv7a. 2. Same as 1. but with --disable-multiarch. Check with build-many-glibcs.py for both options. * scripts/build-many-glibcs.py (Context.add_all_configs): Add arm-linux-gnueabihf multiarch extra_glibcs.
* Add common ifunc-init.h headerAdhemerval Zanella2017-10-173-40/+60
| | | | | | | | | | This patch moves the generic definition from x86_64 init-arch to a common header ifunc-init.h. No functional changes is expected. Checked on a x86_64-linux-gnu build. * sysdeps/generic/ifunc-init.h: New file. * sysdeps/x86/init-arch.h: Use generic ifunc-init.h.
* Place monetary symbol in el_GR and el_CY after the amountMike FABIAN2017-10-174-18/+11
| | | | | | | | | CLDR uses this pattern as well. [BZ #22019] * localedata/locales/el_GR: Set n_cs_precedes to 0. * localedata/locales/el_CY: copy "el_GR" because it is identical. * stdlib/tst-strfmon_l.c: adapt test case.
* Move some float128 symbol version definitions.Joseph Myers2017-10-165-109/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With support for _Float128 functions on platforms where that type has the same ABI as long double, as well as on platforms where it is ABI-distinct, those functions will need to be exported from glibc's shared libraries at appropriate symbol versions in each case. This patch avoids duplication of lists of symbols to export by moving the symbols other than __* to math/Versions and stdlib/Versions. There, they are conditional on <float128-abi.h> defining FLOAT128_VERSION and a default version of that header is added that does not define that macro. Enabling the float128 function aliases will then include adding a sysdeps/ieee754/ldbl-128/float128-abi.h that defines FLOAT128_VERSION to GLIBC_2.27. Symbols __* remain in sysdeps/ieee754/float128/Versions; those symbols should be present only once per floating-point format, not once per type. Note that if any platforms currently lacking support for a type with binary128 format get glibc support for such a type in future (whether only as _Float128, or also as a new long double format), and new libm functions (present for all types) have been added by then, additional macros will be needed to allow such functions to get a version of the form "GLIBC_2.28 if the platform had _Float128 support by then, or the later version at which that platform had _Float128 support added". This is not however a preexisting condition, but would have applied equally to the existing support for _Float128 as an ABI-distinct type. New all-type libm functions should just be added to the appropriate symbol version (currently GLIBC_2.27) for all types, with such special-case handling for _Float128 versions (and _Float64x as well in future) waiting until someone actually wants to add support for _Float128 to an existing platform after a release in which that platform and a post-2.26 libm function had support but that platform lacked _Float128 support. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. Also tested in conjunction with the remaining changes to enable float128 aliases. * sysdeps/generic/float128-abi.h: New file. * sysdeps/ieee754/float128/Versions (FLOAT128_VERSION): Move non-__prefixed symbols to .... * math/Versions: ... here. Include <float128-abi.h>. * stdlib/Versions ... and here. Include <float128-abi.h>
* version.h: Switch to ".9000" as the suffix for the development versionFlorian Weimer2017-10-162-1/+6
|
* malloc: Use compat_symbol_reference in libmcheck [BZ #22050]Florian Weimer2017-10-162-0/+9
| | | | | | | | Since glibc 2.24, __malloc_initialize_hook is a compat symbol. As a result, the link editor does not export a definition of __malloc_initialize_hook from the main program, so that it no longer interposes the variable definition in libc.so. Specifying the symbol version restores the exported symbol.
* malloc: Do not compile mcheck-init.o as libc moduleFlorian Weimer2017-10-162-0/+5
| | | | | Otherwise, this will lead to a link failure because the reference to mcheck is hidden.
* shlib-compat: Update documentation of the compat_symbol_reference macroCarlos O'Donell2017-10-162-2/+11
|
* Support running libm tests for float128 as alias for long double.Joseph Myers2017-10-163-4/+18
| | | | | | | | | | | | | | | | | | | This patch adds support for running libm tests for float128 in the case where the float128 functions are aliases of long double functions. In this case, the sysdeps Makeconfig file (i.e. sysdeps/ieee754/ldbl-128/Makeconfig) will need to define "float128-alias-fcts = yes" to enable the tests. Tested for x86_64. Also tested with build-many-glibcs.py; installed stripped shared libraries are unchanged by the patch. Also tested together with changes to enable the float128 aliases. * math/Makefile (test-types): Add $(type-float128-$(float128-alias-fcts)). * math/test-float128.h (TYPE_STR): Define conditional on [FLT128_MANT_DIG == LDBL_MANT_DIG]. (ULP_IDX): Likewise. (ULP_I_IDX): Likewise.
* Support strtof128 etc. aliases.Joseph Myers2017-10-164-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for building strtof128, wcstof128, strtof128_l and wcstof128_l as aliases, in the case of __HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. Also tested together with changes to enable float128 aliases. * stdlib/strtold.c: Include <bits/floatn.h> [__HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128] (strtof128): Define and later undefine as macro. Define as weak alias if [!USE_WIDE_CHAR]. [__HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128] (wcstof128): Define and later undefine as macro. Define as weak alias if [USE_WIDE_CHAR]. * sysdeps/ieee754/ldbl-128/strtold_l.c [__HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128] (strtof128_l): Define and later undefine as macro. Define as weak alias if [!USE_WIDE_CHAR]. [__HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128] (wcstof128_l): Define and later undefine as macro. Define as weak alias if [USE_WIDE_CHAR]. * sysdeps/ieee754/ldbl-64-128/strtold_l.c: Include <bits/floatn.h>. [__HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128] (strtof128_l): Define and later undefine as macro. Define as weak alias if [!USE_WIDE_CHAR]. [__HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128] (wcstof128_l): Define and later undefine as macro. Define as weak alias if [USE_WIDE_CHAR].
* locale: Don't use \n with record_verbose messages.Carlos O'Donell2017-10-152-3/+8
| | | | | | | | | Recorded verbose messages no longer need to pass \n in their message string since the record_verbose function adds \n to the messages (like error and warnings do also). The avoids seeing a double \n for verbose messages. Signed-off-by: Carlos O'Donell <carlos@redhat.com>
* Silence -O3 -Wall warning in malloc/hooks.c with GCC 7 [BZ #22052]H.J. Lu2017-10-152-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | realloc_check has unsigned char *magic_p; ... __libc_lock_lock (main_arena.mutex); const mchunkptr oldp = mem2chunk_check (oldmem, &magic_p); __libc_lock_unlock (main_arena.mutex); if (!oldp) malloc_printerr ("realloc(): invalid pointer"); ... if (newmem == NULL) *magic_p ^= 0xFF; with static void malloc_printerr(const char *str) __attribute__ ((noreturn)); GCC 7 -O3 warns hooks.c: In function ‘realloc_check’: hooks.c:352:14: error: ‘magic_p’ may be used uninitialized in this function [-Werror=maybe-uninitialized] *magic_p ^= 0xFF; due to the GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82090 This patch silences GCC 7 by using DIAG_IGNORE_NEEDS_COMMENT. [BZ #22052] * malloc/hooks.c (realloc_check): Use DIAG_IGNORE_NEEDS_COMMENT to silence -O3 -Wall warning with GCC 7.
* Add a test for profiling static executableH.J. Lu2017-10-145-1/+102
| | | | | | | | | | | | | | | | | | | | The function, main, is added to profiling output of static executable which must link against gcrt1.o. * Makeconfig (+link-static-before-libc): Use the first of $(CRT-$(@F)) and $(csu-objpfx)$(static-start-installed-name). * gmon/Makefile (tests): Add tst-gmon-static. (tests-static): Likewise. (CFLAGS-tst-gmon-static.c): New. (CRT-tst-gmon-static): Likewise. (DEFAULT-LDFLAGS-tst-gmon-static): Likewise. (tst-gmon-static-ENV): Likewise. (tests-special): Likewise. ($(objpfx)tst-gmon-static.out): Likewise. (clean-tst-gmon-static-data): Likewise. ($(objpfx)tst-gmon-static-gprof.out): Likewise. * gmon/tst-gmon-static-gprof.sh: New file. * gmon/tst-gmon-static.c: Likewise.
* locale: No warning for non-symbolic character (bug 22295)Carlos O'Donell2017-10-132-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | In "Is it OK to write ASCII strings directly into locale source files?" https://sourceware.org/ml/libc-alpha/2017-07/msg00807.html there is universal consensus that we do not have to keep writing <Uxxxx> symbolic characters in locale files. Ulrich Drepper's historical comment was that symbolic characters were used for the eventuality of converting the source files to any encoding system. Fast forward to today and UTF-8 is the standard. So the requirement of <Uxxxx> is hard to justify. Zack Weinberg's excellent scripts are coming along we can use these to find instances of human errors in the scripts: https://sourceware.org/ml/libc-alpha/2017-07/msg00860.html https://sourceware.org/ml/libc-alpha/2017-08/msg00136.html It still won't be easy to distinguish from i for í, but that's still the case for <Uxxxx> characters which humans can't read either. Since we all agreed that we should be able to use non-symbolic (<Uxxxx>) characters in locale files, the following change removes the verbose warning that is raised if you use non-symbolic characters in the locale file. Signed-off-by: Carlos O'Donell <carlos@redhat.com>
* locale: Allow "" int_curr_Symbol (bug 22294)Carlos O'Donell2017-10-132-2/+14
| | | | | | | | | | | | | | | The builtin POSIX locale has "" as the international currency symbol, but a non-builtin locale may not have such a blank int_curr_symbol. Therefore to support non-builtin locales with similar "" int_curr_symbol we adjust the LC_MONETARY parser to allow the normal 4-character int_curr_symbol *and* the empty "" no symbol. Anything else remains invalid. Tested by building all the locales. Tested also with a custom C.UTF-8 locale with "" for int_curr_symbol. Signed-off-by: Carlos O'Donell <carlos@redhat.com>
* locale: Fix localedef exit code (Bug 22292)Carlos O'Donell2017-10-1326-489/+767
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The error and warning handling in localedef, locale, and iconv is a bit of a mess. We use ugly constructs like this: WITH_CUR_LOCALE (error (1, errno, gettext ("\ cannot read character map directory `%s'"), directory)); to issue errors, and read error_message_count directly from the error API to detect errors. The problem with that is that the code also uses error to print warnings, and informative messages. All of this leads to problems where just having warnings will produce an exit status as-if errors had been seen. To fix this situation I have adopted the following high-level changes: * All errors are counted distinctly. * All warnings are counted distinctly. * All informative messages are not counted. * Increasing verbosity cannot generate *more* errors, and it previously did for errors conditional on verbose, this is now fixed. * Increasing verbosity *can* generate *more* warnings. * Making the output quiet cannot generate *fewer* errors, and it previously did for errors conditional on be_quiet, this is now fixed. * Each of error, warning, and informative message has it's own function to call defined in record-status.h, and they are: record_error, record_warning, and record_verbose. * The record_error function always records an error, but conditional on be_quiet may not print it. * The record_warning function always records a warning, but conditional on be_quiet may not print it. * The record_verbose function only prints the verbose message if verbose is true and be_quiet is false. This has allowed the following fix: * Previously any warnings were being treated as errors because they incremented error_message_count, but now we properly return an exit status of 1 if there are warnings but output was generated. All of this allows localedef to correctly decide if errors, or warnings were present, and produce the correct exit code. The locale and iconv programs now also use record-status.h and we have removed the WITH_CUR_LOCALE hack, and instead have internal push_locale/pop_locale functions centralized in the record routines. Signed-off-by: Carlos O'Donell <carlos@redhat.com>
* localedata: Reorganize Unicode LC_CTYPE inclusion.Carlos O'Donell2017-10-134-2309/+2369
| | | | | | | | | | | | | | | | The commit does the following things: * Move non-transliteration Unicode generated data to i18n_ctype. * Copy the i18n_ctype data into i18n and add transliteration. In the future, any locale which needs Unicode LC_CTYPE data can also just use `copy i18n_ctype` and get the base character classes and maps without transliteration. Tested by compiling all the locales and my prototype C.UTF-8 which uses it. Signed-off-by: Carlos O'Donell <carlos@redhat.com>
* Support strfromf128 alias.Joseph Myers2017-10-132-0/+17
| | | | | | | | | | | | | | This patch adds support for building strfromf128 as an alias of strfroml, in the case of __HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. Also tested together with changes to enable float128 aliases. * stdlib/strfroml.c: Include <bits/floatn.h>. [__HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128] (strfromf128): Define before include of <stdlib.h> and undefine afterwards, then define as weak alias.
* Use libm_alias_ldouble_other in ldbl-64-128/s_nextafterl.c.Joseph Myers2017-10-132-0/+9
| | | | | | | | | | | | | | | | This patch makes ldbl-64-128/s_nextafterl.c restore the default weak_alias definition and use libm_alias_ldouble_other (having undefined and redefined weak_alias for the include of ldbl-128/s_nextafterl.c, so the libm_alias_ldouble use in the latter file is ineffective). Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. Also tested together with changes to enable float128 aliases. * sysdeps/ieee754/ldbl-64-128/s_nextafterl.c (weak_alias): Undefine and restore default definition. Use libm_alias_ldouble_other.
* nptl: Preserve error in setxid thread broadcast in coredumps [BZ #22153]Peter Zelezny2017-10-132-2/+13
|
* Fix TLS relocations against local symbols on powerpc32, sparc32 and sparc64James Clarke2017-10-134-1/+15
| | | | | | | | | | | | | | | | | | | | | Normally, TLS relocations against local symbols are optimised by the linker to be absolute. However, gold does not do this, and so it is possible to end up with, for example, R_SPARC_TLS_DTPMOD64 referring to a local symbol. Since sym_map is left as null in elf_machine_rela for the special local symbol case, the relocation handling thinks it has nothing to do, and so the module gets left as 0. Havoc then ensues when the variable in question is accessed. Before this fix, the main_local_gold program would receive a SIGBUS on sparc64, and SIGSEGV on powerpc32. With this fix applied, that test now passes like the rest of them. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Assign sym_map to be map for local symbols, as TLS relocations use sym_map to determine whether the symbol is defined and to extract the TLS information. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Likewise.
* powerpc: Avoid putting floating point values in memory [BZ #22189]Tulio Magno Quites Machado Filho2017-10-132-0/+11
| | | | | | [BZ #22189] * sysdeps/powerpc/fpu/math_private.h (math_opt_barrier): (math_force_eval): Add powerpc version.
* [BZ #22142] powerpc: Fix the carry bit on mpn_[add|sub]_n on POWER7Tulio Magno Quites Machado Filho2017-10-134-4/+27
| | | | | | | | | | | | | | | | | Fix the ifdef clause that was being used in the opposite way, setting a wrong value of the carry bit. This is also correcting 2 memory accesses that were mistakenly referring to r0 while they were supposed to mean the immediate value 0. [BZ #22142] * stdio-common/tst-printf.c (fp_test): Add tests for DBL_MAX and -DBL_MAX. (do_test): Likewise. * stdio-common/tst-printf.sh: Likewise. * sysdeps/powerpc/powerpc64/power7/add_n.S: Invert the initial ifdef clause in order to set the carry bit right. Replace r0 by 0 without changing the behavior.
* Use libm_alias_ldouble for SPARC fabsl.Joseph Myers2017-10-133-2/+12
| | | | | | | | | | | | | | | | This patch makes SPARC fabsl implementation use libm_alias_ldouble, to prepare them for also defining _Float128 function aliases. Tested with build-many-glibcs.py that installed stripped shared libraries (sparc64-linux-gnu and sparcv9-linux-gnu) are unchanged by the patch. * sysdeps/sparc/sparc32/fpu/s_fabsl.c: Include <libm-alias-ldouble.h>. (fabsl): Define using libm_alias_ldouble. * sysdeps/sparc/sparc64/fpu/s_fabsl.c: Include <libm-alias-ldouble.h>. (fabsl): Define using libm_alias_ldouble.
* Fix ldbl-opt/w_lgamma_compatl.c libm_alias_ldouble_other usage.Joseph Myers2017-10-132-5/+3
| | | | | | | | | | | | | | | Testing with changes to enable _Float128 function aliases shows that the libm_alias_ldouble_other usage in ldbl-opt/w_lgamma_compatl.c does not in fact work. Furthermore, it is unnecessary; the relevant aliases get created through w_lgammal_compat2.c. This patch removes the problem code. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. Also tested in conjunction with patches to enable _Float128 function aliases. * sysdeps/ieee754/ldbl-opt/w_lgamma_compatl.c [BUILD_LGAMMA]: Remove conditional code.
* Fix ldbl-opt/s_clog10l.c libm_alias_ldouble_other usage.Joseph Myers2017-10-132-3/+11
| | | | | | | | | | | | | | | | | | | | | Testing with changes to enable _Float128 function aliases shows that the libm_alias_ldouble_other usage in ldbl-opt/s_clog10l.c does not in fact work, because __clog10l is defined with long_double_symbol rather than as a normal C alias. This patch fixes this by renaming the __clog10l__internal alias (not strictly necessary, but avoids a hack with "__clog10l_interna" / "__clog10l__interna" as first argument to libm_alias_ldouble_other) and using the renamed alias when calling libm_alias_ldouble_other. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanges by the patch. Also tested in conjunction with patches to enable _Float128 function aliases. * sysdeps/ieee754/ldbl-opt/s_clog10l.c (__clog10l__internal): Rename to __clog10_internal_l. (__clog10_internal_l): Define aliases using libm_alias_ldouble_other instead of using libm_alias_ldouble_other with __clog10.
* Benchtests for sinf, cosf and sincosfRajalakshmi Srinivasaraghavan2017-10-135-1/+10633
| | | | Numbers used from cos and sin inputs.
* fix posix/tst-spawn testSzabolcs Nagy2017-10-122-8/+16
| | | | | | | The test spawns two children but only waited for one. The fix avoids printing to stderr. * posix/tst-spawn.c (do_test): Wait for both children.
* Update ChangeLog entry for commit d165ca6498H.J. Lu2017-10-121-0/+1
|
* Support profiling PIE [BZ #22284]H.J. Lu2017-10-124-10/+79
| | | | | | | | | | | | | | | | | | | | | | | | | Since PIE can be loaded at any address, we need to subtract load address from PCs. [BZ #22284] * gmon/Makefile [$(have-fpie)$(build-shared) == yesyes] (tests, tests-pie): Add tst-gmon-pie. (CFLAGS-tst-gmon-pie.c): New. (CRT-tst-gmon-pie): Likewise. (tst-gmon-pie-ENV): Likewise. [$(have-fpie)$(build-shared) == yesyes] (tests-special): Likewise. ($(objpfx)tst-gmon-pie.out): Likewise. (clean-tst-gmon-pie-data): Likewise. ($(objpfx)tst-gmon-pie-gprof.out): Likewise. * gmon/gmon.c [PIC]: Include <link.h>. [PIC] (callback): New function. (write_hist): Add an argument for load address. Subtract load address from PCs. (write_call_graph): Likewise. (write_gmon): Call __dl_iterate_phdr to get load address, pass it to write_hist and write_call_graph. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Run libm long double tests for long double = double.Joseph Myers2017-10-117-11/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All interfaces in the glibc API ought to be covered by the testsuite, even where they alias other interfaces. This patch arranges for libm tests to be run for long double when it aliases double; previously those tests were run only for the floating-point types with distinct formats. The long double tests are made to use the double ulps values in this case, as having a separate duplicate set of ulps for them seems unnecessary; to accommodate that, the test-<type>.h headers now specify the macro indexing into the ulps array explicitly instead of having it computed from PREFIX. Nothing special is done about vector function tests. None are supported for any long double = double platforms, and supporting vector functions for a type alias such as _Float32 would not simply fall out of adding the scalar aliases for that type - it would require vector function wrappers like those for *_finite (or, better, a new GCC feature to allow specifying the asm name for vector functions independently of that for scalar ones, as previously discussed), so it seems reasonable to require the sysdeps makefile setting of libmvec-tests to be updated if any such tests are to be run for type aliases. Tested for x86_64 and arm. * math/Makefile (test-types-basic): New variable. (test-types): Likewise. (libm-test-support): Use $(test-types) instead of $(types). (libm-tests-base-normal): Likewise. (libm-tests-base-finite): Likewise. (libm-tests-base-inline): Likewise. (generated): Likewise. ($(objpfx)libm-test-support-$(t).c): Likewise. (libm-tests-for-type iterator): Likewise. (libm-test-support iterator): Likewise. * math/libm-test-support.c (ulp_i_idx): Use ULP_I_IDX. (ulp_idx): Use ULP_IDX. * math/test-ldouble.h: Include <float.h>. (TYPE_STR): Define conditional on [LDBL_MANT_DIG == DBL_MANT_DIG]. (ULP_IDX): New macro. (ULP_I_IDX): Likewise. * math/test-double.h (ULP_IDX): Likewise. (ULP_I_IDX): Likewise. * math/test-float.h (ULP_IDX): Likewise. (ULP_I_IDX): Likewise. * math/test-float128.h (ULP_IDX): Likewise. (ULP_I_IDX): Likewise.
* Linux: Consolidate {RTLD_}SINGLE_THREAD_P definitionAdhemerval Zanella2017-10-1126-676/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current GLIBC has two ways to implement the single thread optimization on syscalls to avoid calling the cancellation path: either by using global variables (__{libc,pthread}_multiple_thread) or by accessing the TCB field (defined by TLS_MULTIPLE_THREADS_IN_TCB). Both the variables and the macros to acces its value are defined in the architecture sysdep-cancel.h header. This patch consolidates its definition on only one header, sysdeps/unix/sysv/linux/sysdep-cancel.h, and adds a new define (SINGLE_THREAD_BY_GLOBAL) which the architecture defines if it prefer to use the global variables instead of the TCB field. This is an optimization, so if the architecture does not define it, the TCB method will be used as default. Checked on x86_64-linux-gnu and on a build with major touched ABIs (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf, hppa-linux-gnu, i686-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips-linux-gnu, mips64-linux-gnu, powerpc-linux-gnu, powerpc64le-linux-gnu, s390-linux-gnu, s390x-linux-gnu, sh4-linux-gnu, sparcv9-linux-gnu, sparc64-linux-gnu, tilegx-linux-gnu). * sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h: Remove file. * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/mips/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/tile/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Define. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/arm/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (SINGLE_THREAD_BY_GLOBAL): Likewise.
* nscd: remove reference to libnslAndreas Schwab2017-10-117-17/+64
| | | | | This removes the dependency on libnsl from nscd. It only used __nis_hash, build its own copy under the name __nscd_hash.
* nss_files: Avoid large buffers with many host addresses [BZ #22078]Florian Weimer2017-10-114-96/+472
| | | | | The previous implementation had at least a quadratic space requirement in the number of host addresses and aliases.
* nss_files: Use struct scratch_buffer for gethostbyname [BZ #18023]Florian Weimer2017-10-112-156/+144
|
* Use generic alias macros in ldbl-opt.Joseph Myers2017-10-115-14/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes ldbl-opt code to use generic libm alias macros in preparation for getting _FloatN / _FloatNx aliases where appropriate. Four functions are affected, that undefine and redefine alias macros before including the implementations they wrap in such a way that _FloatN / _FloatNx aliases would not appear. s_clog10l.c undefines and redefined declare_mgen_alias, so just needs a libm_alias_ldouble_other call added. w_exp10l_compat.c undefines and redefines weak_alias, but in fact does not need to do so, since math/w_exp10l_compat.c uses libm_alias_ldouble and does not use weak_alias other than through that, so the undefines and redefines of weak_alias are removed. w_lgamma_compatl.c and w_remainderl_compat.c are made to use libm_alias_ldouble_other in conjunction with restoring the original definition of weak_alias so this is effective. Tested with build-many-glibcs.py. Installed stripped shared libraries are unchanged by this patch. * sysdeps/ieee754/ldbl-opt/s_clog10l.c: Use libm_alias_ldouble_other. * sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c (weak_alias): Do not undefine and redefine. [LIBM_SVID_COMPAT && !LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)] (exp10l): Do not define here. * sysdeps/ieee754/ldbl-opt/w_lgamma_compatl.c [BUILD_LGAMMA] (weak_alias): Undefine and redefine. [BUILD_LGAMMA]: Use libm_alias_ldouble_other. * sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c [LIBM_SVID_COMPAT] (weak_alias): Undefine and redefine here. [LIBM_SVID_COMPAT]: Use libm_alias_ldouble_other.
* Use libm_alias_* in soft-fp.Joseph Myers2017-10-114-8/+15
| | | | | | | | | | | | | | | This patch makes the soft-fp implementations of fma functions use the libm_alias_* macros. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * soft-fp/fmadf4.c: Include <libm-alias-double.h>. [!__fma] (fma): Define using libm_alias_double. * soft-fp/fmasf4.c: Include <libm-alias-float.h>. [!__fmaf] (fmaf): Define using libm_alias_float. * soft-fp/fmatf4.c: Include <libm-alias-ldouble.h>. (fmal): Define using libm_alias_ldouble.
* Add libm_alias_*_other_r macros.Joseph Myers2017-10-1020-7/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some libm functions are unable to use the generic alias macros such as libm_alias_double because they have special symbol versioning requirements for the main float, double or long double public names. To facilitate adding _FloatN / _FloatNx function aliases in future, it's still desirable to have generic macros those functions can use as far as possible. This patch adds macros such as libm_alias_double_other, which only define names for _FloatN / _FloatNx aliases, not for float / double / long double. As present, all these new macros do nothing, but they are called in the appropriate places in macros such as libm_alias_double. This patch also arranges for lgamma implementations, and the recently added optimized float function implementations, to use the new macros to make them ready for addition of _FloatN / _FloatNx aliases. Tested for x86_64, and tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. * sysdeps/generic/libm-alias-double.h (libm_alias_double_other_r): New macro. (libm_alias_double_other): Likewise. (libm_alias_double_r): Use libm_alias_double_other_r. * sysdeps/generic/libm-alias-float.h (libm_alias_float_other_r): New macro. (libm_alias_float_other): Likewise. (libm_alias_float_r): Use libm_alias_float_other_r. * sysdeps/generic/libm-alias-float128.h (libm_alias_float128_other_r): New macro. (libm_alias_float128_other): Likewise. (libm_alias_float128_r): Use libm_alias_float128_other_r. * sysdeps/generic/libm-alias-ldouble.h (libm_alias_ldouble_other_r): New macro. (libm_alias_ldouble_other): Likewise. (libm_alias_ldouble_r): Use libm_alias_ldouble_other_r. * sysdeps/ieee754/ldbl-opt/libm-alias-double.h (libm_alias_double_other_r): New macro. (libm_alias_double_other): Likewise. (libm_alias_double_r): Use libm_alias_double_other_r. * sysdeps/ieee754/ldbl-opt/libm-alias-ldouble.h (libm_alias_ldouble_other_r): New macro. (libm_alias_ldouble_other): Likewise. (libm_alias_ldouble_r): Use libm_alias_ldouble_other_r. * math/w_lgamma_main.c: Include <libm-alias-double.h>. [!USE_AS_COMPAT]: Use libm_alias_double_other. * math/w_lgammaf_main.c: Include <libm-alias-float.h>. [!USE_AS_COMPAT]: Use libm_alias_float_other. * math/w_lgammal_main.c: Include <libm-alias-ldouble.h>. [!USE_AS_COMPAT]: Use libm_alias_ldouble_other. * math/w_exp2f.c: Use libm_alias_float_other. * math/w_expf.c: Likewise. * math/w_log2f.c: Likewise. * math/w_logf.c: Likewise. * math/w_powf.c: Likewise. * sysdeps/ieee754/flt-32/e_exp2f.c: Include <libm-alias-float.h>. [!__exp2f]: Use libm_alias_float_other. * sysdeps/ieee754/flt-32/e_expf.c: Include <libm-alias-float.h>. [!__expf]: Use libm_alias_float_other. * sysdeps/ieee754/flt-32/e_log2f.c: Include <libm-alias-float.h>. [!__log2f]: Use libm_alias_float_other. * sysdeps/ieee754/flt-32/e_logf.c: Include <libm-alias-float.h>. [!__logf]: Use libm_alias_float_other. * sysdeps/ieee754/flt-32/e_powf.c: Include <libm-alias-float.h>. [!__powf]: Use libm_alias_float_other.
* nss_files: Refactor gethostbyname3 multi case into separate functionFlorian Weimer2017-10-102-193/+208
| | | | This is in preparation of further cleanup work.
* Use generic macros for lgamma_r function aliases.Joseph Myers2017-10-0912-34/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the use of generic macros for defining libm function aliases, in preparation for adding more _FloatN / _FloatNx function names, this patch makes the lgamma_r functions use such macros. declare_mgen_alias_r becomes a standard macro in math-type-macros.h instead of being locally defined in w_lgamma_r_templace.c. This in turn must be defined by each math-type-macros-<type>.h. Rather than providing an unused default in math-type-macros.h, that header is made to give an error if math-type-macros-<type>.h failed to define declare_mgen_alias or declare_mgen_alias_r. The compat lgamma_r wrappers are updated similarly. The ldbl-opt versions are removed as no longer needed. Tested for x86_64, and with build-many-glibcs.py. Installed stripped shared libraries are unchanged except for powerpc64le (where the usual issue applies that an ldbl-opt long double function previously used long_double_symbol unconditionally and now the symbol versions on powerpc64le mean weak_alias is used instead, resulting in the same symbol versions in the final shared library but still enough difference in the input objects for that library not to be byte-identical). * sysdeps/generic/math-type-macros.h [!declare_mgen_alias]: Give error. Remove default definition of declare_mgen_alias. [!declare_mgen_alias_r]: Likewise. * sysdeps/generic/math-type-macros-double.h [!declare_mgen_alias_r] (declare_mgen_alias_r): New macro. * sysdeps/generic/math-type-macros-float.h [!declare_mgen_alias_r] (declare_mgen_alias_r): Likewise. * sysdeps/generic/math-type-macros-float128.h [!declare_mgen_alias_r] (declare_mgen_alias_r): Likewise. * sysdeps/generic/math-type-macros-ldouble.h [!declare_mgen_alias_r] (declare_mgen_alias_r): Likewise. * math/w_lgamma_r_template.c (declare_mgen_alias_r_x): Remove macro. (declare_mgen_alias_r_s): Likewise. (declare_mgen_alias_r): Likewise. * math/w_lgamma_r_compat.c: Include <libm-alias-double.h>. (lgamma_r): Define using libm_alias_double_r. * math/w_lgammaf_r_compat.c: Include <libm-alias-float.h>. (lgammaf_r): Define using libm_alias_float_r. * math/w_lgammal_r_compat.c: Include <libm-alias-ldouble.h>. (lgammal_r): Define using libm_alias_ldouble_r. * sysdeps/ieee754/ldbl-opt/w_lgamma_r_compat.c: Remove file. * sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise.
* posix: remove glob internal bogus extern declAdhemerval Zanella2017-10-092-3/+5
| | | | | | | Sync with gnulib f586d709f07. Checked on x86_64-linux-gnu. * lib/glob.c (__glob_pattern_type): Remove now-spurious extern declaration.