about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Hide internal signal functions [BZ #18822]H.J. Lu2017-10-0110-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hide internal signal functions to allow direct access within libc.so and libc.a without using GOT nor PLT. __GI___kill and __GI___sigaltstack are defined when syscalls.list is used to generate them. Otherwise libc_hidden_def is needed explicitly. [BZ #18822] * include/signal.h (__kill): Add libc_hidden_proto. (__sigblock): Likewise. (__sigprocmask): Likewise. (__sigaltstack): Likewise. * signal/kill.c (__kill): Add libc_hidden_def. * signal/sigblock.c (__sigblock): Likewise. * signal/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/mach/hurd/kill.c (__kill): Likewise. * sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise. * sysdeps/mach/hurd/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/posix/sigblock.c (__sigblock): Likewise. * sysdeps/unix/sysv/linux/alpha/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/ia64/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask): Likewise. * /sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/x86_64/sigprocmask.c (__sigprocmask): Likewise.
* Hide internal __mremap function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | | | | | Hide internal __mremap function to allow direct access within libc.so and libc.a without using GOT nor PLT. __GI___mremap is defined when sysdeps/unix/syscalls.list is used to generate mremap. Otherwise libc_hidden_def is needed explicitly. [BZ #18822] * include/sys/mman.h (__mremap): Add libc_hidden_proto. * sysdeps/unix/sysv/linux/m68k/mremap.S (__mremap): Add libc_hidden_def.
* Hide internal __ioctl function [BZ #18822]H.J. Lu2017-10-015-0/+5
| | | | | | | | | | | | | | | | | | Hide internal __ioctl function to allow direct access within libc.so and libc.a without using GOT nor PLT. __GI___ioctl is defined when sysdeps/unix/syscalls.list is used to generate ioctl. Otherwise libc_hidden_def is needed explicitly. [BZ #18822] * include/sys/ioctl.h (__ioctl): Add libc_hidden_proto. * misc/ioctl.c (__ioctl): Add libc_hidden_def. * sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise. * sysdeps/unix/sysv/linux/aarch64/ioctl.S (__ioctl): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S (__ioctl): Likewise. * sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/ioctl.S (__ioctl): Likewise.
* Hide internal sysinfo functions [BZ #18822]H.J. Lu2017-10-012-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Hide internal sysinfo functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/sysinfo.h (__get_nprocs_conf): Add libc_hidden_proto. (__get_nprocs): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise. (__get_child_max): Add attribute_hidden. * misc/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def. (__get_nprocs): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise. * sysdeps/mach/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def. (__get_nprocs): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise. * sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Add libc_hidden_def. (__get_nprocs_conf): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise.
* Mark internal netlink functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-4/+6
| | | | | | | | | | | | Mark internal netlink functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * sysdeps/unix/sysv/linux/netlinkaccess.h (__netlink_open): Add attribute_hidden. (__netlink_close): Likewise. (__netlink_free_handle): Likewise. (__netlink_request): Likewise.
* Hide __readv and __writev [BZ #18822]H.J. Lu2017-10-014-0/+6
| | | | | | | | | | | | | | | | | Hide internal __readv and __writev functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/uio.h (__readv): Add libc_hidden_proto. (__writev): Likewise. * misc/readv.c (__readv): Add libc_hidden_def. * misc/writev.c (__writev): Likewise. * sysdeps/posix/readv.c (__readv): Likewise. * sysdeps/posix/writev.c (__writev): Likewise. * sysdeps/unix/sysv/linux/readv.c: Include <sys/uio.h>. (__readv): Likewise. * sysdeps/unix/sysv/linux/writev.c: Include <sys/uio.h>. (__writev): Likewise.
* Mark internal dirent functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-014-0/+4
| | | | | | | | | | | | | | | | | | | Mark internal dirent functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. __readdir64 is hidden with libc_hidden_proto and libc_hidden_def since the exported readdir64 is an alias of __readdir64. [BZ #18822] * include/dirent.h (__opendir): Always add attribute_hidden. (__fdopendir): Likewise. (__closedir): Likewise. (__readdir): Likewise. (__readdir64): Add libc_hidden_proto. * sysdeps/mach/hurd/readdir64.c (__readdir64): Add libc_hidden_def. * sysdeps/unix/sysv/linux/i386/readdir64.c (__readdir64): Likewise. * sysdeps/unix/sysv/linux/readdir64.c (__readdir64): Likewise. * sysdeps/unix/sysv/linux/wordsize-64/readdir.c (__GI___readdir64): New alias.
* Mark internal statfs functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-4/+8
| | | | | | | | | | | | | | | | Mark internal statfs functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/statfs.h (__fstatfs): Add attribute_hidden. (__statfs64): Likewise. (__fstatfs64): Likewise. * include/sys/statvfs.h (__statvfs64): Likewise. (__fstatvfs64): Likewise. * sysdeps/unix/sysv/linux/pathconf.h (__statfs_link_max): Likewise. (__statfs_filesize_max): Likewise. (__statfs_symlinks): Likewise. (__statfs_chown_restricted): Likewise.
* Mark ____wcsto*_l_internal functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-012-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark ____wcsto*_l_internal functions with attribute_hidden to allow direct access to them within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/wchar.h (____wcstof_l_internal): New prototype. (____wcstod_l_internal): Likewise. (____wcstold_l_internal): Likewise. (____wcstol_l_internal): Likewise. (____wcstoul_l_internal): Likewise. (____wcstoll_l_internal): Likewise. (____wcstoull_l_internal): Likewise. (____wcstof128_l_internal): Likewise. * sysdeps/ieee754/float128/wcstof128.c (____wcstof128_l_internal): Removed. * sysdeps/ieee754/float128/wcstof128_l.c (____wcstof128_l_internal): Likewise. * wcsmbs/wcstod.c (____wcstod_l_internal): Likewise. * wcsmbs/wcstod_l.c (____wcstod_l_internal): Likewise. * wcsmbs/wcstof.c (____wcstof_l_internal): Likewise. * wcsmbs/wcstof_l.c (____wcstof_l_internal): Likewise. * wcsmbs/wcstol_l.c (____wcstol_l_internal): Likewise. * wcsmbs/wcstold.c (____wcstold_l_internal): Likewise. * wcsmbs/wcstold_l.c (____wcstold_l_internal): Likewise. * wcsmbs/wcstoll_l.c (____wcstoll_l_internal): Likewise. * wcsmbs/wcstoul_l.c (____wcstoul_l_internal): Likewise. * wcsmbs/wcstoull_l.c (____wcstoull_l_internal): Likewise.
* Mark __internal_statvfs[64] with attribute_hidden [BZ #18822]H.J. Lu2017-10-016-23/+31
| | | | | | | | | | | | | | | | | | | | | | Mark __internal_statvfs[64] with attribute_hidden to allow direct access to them within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * sysdeps/unix/sysv/linux/fstatvfs.c: Include "internal_statvfs.h" instead of <sys/statvfs.h>. (__internal_statvfs): Removed. * sysdeps/unix/sysv/linux/fstatvfs64.c Include "internal_statvfs.h" instead of <sys/statvfs.h>. (__internal_statvfs64): Removed. * sysdeps/unix/sysv/linux/internal_statvfs.c: Include "internal_statvfs.h" instead of <sys/statvfs.h>. * sysdeps/unix/sysv/linux/internal_statvfs.h: New file. * sysdeps/unix/sysv/linux/statvfs.c Include "internal_statvfs.h" instead of <sys/statvfs.h>. (__internal_statvfs): Removed. * sysdeps/unix/sysv/linux/statvfs64.c Include "internal_statvfs.h" instead of <sys/statvfs.h>. (__internal_statvfs64): Removed.
* Mark internal functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-014-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark internal functions with attribute_hidden to allow direct access to internal functions within libc.so and libc.a without using GOT nor PLT. Size comparison of libc.so: On x86-64: text data bss dec hex Before: 1728577 20584 17088 1766249 1af369 After : 1728593 20584 17088 1766265 1af379 The only change is __gconv_release_shlib in iconv/gconv_dl.c is inlined since it is hidden, which increases the code size of gconv_dl.os by 18 bytes. On i686: text data bss dec hex Before: 1869039 11444 11112 1891595 1cdd0b After : 1868635 11444 11112 1891191 1cdb77 The code size is decreased by avoiding GOT/PLT for hidden functions. [BZ #18822] * iconv/gconv_int.h (__gconv_open): Add attribute_hidden. (__gconv_close): Likewise. (__gconv): Likewise. (__gconv_find_transform): Likewise. (__gconv_lookup_cache): Likewise. (__gconv_compare_alias_cache): Likewise. (__gconv_load_cache): Likewise. (__gconv_get_path): Likewise. (__gconv_close_transform): Likewise. (__gconv_release_cache): Likewise. (__gconv_find_shlib): Likewise. (__gconv_release_shlib): Likewise. (__gconv_get_builtin_trans): Likewise. (__gconv_compare_alias): Likewise. * include/dlfcn.h (_dlerror_run): Likewise. * include/stdio.h (__fortify_fail_abort): Likewise. * include/time.h (__tz_compute): Likewise. (__strptime_internal): Likewise. * intl/gettextP.h (_nl_find_domain): Likewise. (_nl_load_domain): Likewise. (_nl_find_msg): Likewise. * intl/plural-exp.h (FREE_EXPRESSION): Likewise. (EXTRACT_PLURAL_EXPRESSION): Likewise. * locale/coll-lookup.h (__collidx_table_lookup): Likewise. * resolv/gai_misc.h (__gai_enqueue_request): Likewise. (__gai_find_request): Likewise. (__gai_remove_request): Likewise. (__gai_notify): Likewise. (__gai_notify_only): Likewise. * sysdeps/generic/aio_misc.h (__aio_sigqueue): Likewise. * sysdeps/generic/ldsodefs.h (_dl_fini): Likewise. (_dl_non_dynamic_init): Likewise. (_dl_aux_init): Likewise. * sysdeps/i386/machine-gmon.h (mcount_internal): Likewise. * sysdeps/unix/sysv/linux/i386/olddirent.h (__old_getdents64): Likewise. * wcsmbs/wcsmbsload.h (__wcsmbs_load_conv): Likewise. (__wcsmbs_clone_conv): Likewise. (__wcsmbs_named_conv): Likewise.
* Fix return pointer save and PIC register restore in __getcontext andJohn David Anglin2017-10-012-1/+5
| | | | | | | | | __setcontext on hppa. * sysdeps/unix/sysv/linux/hppa/getcontext.S (__getcontext): Save return pointer in frame. * sysdeps/unix/sysv/linux/hppa/setcontext.S (__setcontext): Likewise. Correct offset used to restore PIC register.
* Fix hppa text relocations in libc.soJohn David Anglin2017-09-301-0/+5
| | | | | | [BZ libc/22165] * sysdeps/unix/sysv/linux/hppa/getcontext.S (__getcontext): Use PIC code to load address of __getcontext_ret when generating PIC code.
* Use libm_alias_double for some dbl-64 functions.Joseph Myers2017-09-2940-206/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the move of libm aliases to common macros that can create _FloatN / _FloatNx aliases in future, this patch converts some dbl-64 functions to using libm_alias_double, thereby eliminating the need for some ldbl-opt wrappers. This patch deliberately limits what functions are converted so that it can be verified by comparison of stipped binaries. Specifically, atan and tan are excluded because they first need converting to being weak aliases; fma is omitted as it has additional complications with versions in other directories (removing the ldbl-opt version can e.g. cause the ldbl-128 version to be used instead of dbl-64); and functions that have both dbl-64/wordsize-64 and ldbl-opt versions are excluded because ldbl-opt currently always wraps dbl-64 function versions, so changing those will result in platforms using both ldbl-opt and dbl-64/wordsize-64 (i.e. alpha) starting to use the dbl-64/wordsize-64 versions of those functions (which is good, as an optimization, but still best separated from the present patch to get better validation). Tested for x86_64, and tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/ieee754/dbl-64/s_asinh.c: Include <libm-alias-double.h>. (asinh): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_cbrt.c: Include <libm-alias-double.h>. (cbrt): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_copysign.c: Include <libm-alias-double.h>. (copysign): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_erf.c: Include <libm-alias-double.h>. (erf): Define using libm_alias_double. (erfc): Likewise. * sysdeps/ieee754/dbl-64/s_expm1.c: Include <libm-alias-double.h>. (expm1): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_fabs.c: Include <libm-alias-double.h>. (fabs): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_fromfp.c (fromfp): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_fromfp_main.c: Include <libm-alias-double.h>. * sysdeps/ieee754/dbl-64/s_fromfpx.c (fromfpx): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_getpayload.c: Include <libm-alias-double.h>. (getpayload): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_llrint.c: Include <libm-alias-double.h>. (llrint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_lrint.c: Include <libm-alias-double.h>. (lrint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_nextup.c: Include <libm-alias-double.h>. (nextup): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_roundeven.c: Include <libm-alias-double.h>. (roundeven): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_setpayload.c (setpayload): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_setpayload_main.c: Include <libm-alias-double.h>. * sysdeps/ieee754/dbl-64/s_setpayloadsig.c (setpayloadsig): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_sin.c: Include <libm-alias-double.h>. (cos): Define using libm_alias_double. (sin): Likewise. * sysdeps/ieee754/dbl-64/s_sincos.c: Include <libm-alias-double.h>. (sincos): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_tanh.c: Include <libm-alias-double.h>. (tanh): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_totalorder.c: Include <libm-alias-double.h>. (totalorder): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_totalordermag.c: Include <libm-alias-double.h>. (totalordermag): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_ufromfp.c (ufromfp): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_ufromfpx.c (ufromfpx): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c: Include <libm-alias-double.h>. (getpayload): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c: Include <libm-alias-double.h>. (roundeven): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c: Include <libm-alias-double.h>. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Include <libm-alias-double.h>. (totalorder): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Include <libm-alias-double.h>. (totalordermag): Define using libm_alias_double. * sysdeps/ieee754/ldbl-opt/s_copysign.c (copysignl): Only define libc compat symbol here. * sysdeps/ieee754/ldbl-opt/s_asinh.c: Remove file. * sysdeps/ieee754/ldbl-opt/s_cbrt.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_erf.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_expm1.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_fabs.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_llrint.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_lrint.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_sin.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_sincos.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_tanh.c: Likewise.
* arm: Update elf_machine_load_address for static PIEH.J. Lu2017-09-291-1/+11
| | | | | | | | | | When --enable-static-pie is used to configure glibc, we need to use _dl_relocate_static_pie to compute load address in static PIE. * sysdeps/arm/dl-machine.h (elf_machine_load_address): Use _dl_relocate_static_pie instead of _dl_start to compute load address in static PIE. Return 0 if _DYNAMIC is undefined for static executable.
* mips: Update elf_machine_load_address for static PIEH.J. Lu2017-09-291-0/+5
| | | | | | | | | mips uses a local label to compute load address, which works with static PIE. We just need to return 0 if _DYNAMIC is undefined for static executable. * sysdeps/mips/dl-machine.h (elf_machine_dynamic): Return 0 if _DYNAMIC is undefined for static executable.
* arm: Check PIC instead of SHARED in start.SH.J. Lu2017-09-291-2/+2
| | | | | | | Since start.o may be compiled as PIC, we should check PIC instead of SHARED. * sysdeps/arm/start.S (_start): Check PIC instead of SHARED.
* Update x86_64 libm-test-ulps.Joseph Myers2017-09-291-2/+2
| | | | * sysdeps/x86_64/fpu/libm-test-ulps: Update.
* Use fabs(f/l) rather than __fabsWilco Dijkstra2017-09-2912-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | A few math functions still use __fabs(f/l) rather than fabs, which means they won't be inlined. Rename them so they are inlined. Also add -fno-builtin-fabsl to nofpu powerpc makefile to work around BZ #29253. * sysdeps/ieee754/dbl-64/e_lgamma_r.c (__ieee754_lgamma_r): Use fabs rather than __fabs. * sysdeps/ieee754/dbl-64/e_log10.c (__ieee754_log10): Likewise. * sysdeps/ieee754/dbl-64/e_log2.c (__ieee754_log2): Likewise. * sysdeps/ieee754/flt-32/e_lgammaf_r.c (__ieee754_lgammaf_r): Use fabsf rather than __fabsf. * sysdeps/ieee754/flt-32/e_log10f.c (__ieee754_log10f): Likewise. * sysdeps/ieee754/flt-32/e_log2f.c (__ieee754_log2f): Likewise. * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r): Use fabsl rather than __fabsl. * sysdeps/ieee754/ldbl-128/e_log10l.c (__ieee754_log10l): Likewise. * sysdeps/ieee754/ldbl-128/e_log2l.c (__ieee754_log2l): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c (__ieee754_lgammal_r): Use fabsl rather than __fabsl. * sysdeps/ieee754/ldbl-128ibm/e_log10l.c (__ieee754_log10l): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_log2l.c (__ieee754_log2l): Likewise. * sysdeps/powerpc/nofpu/Makefile: Add -fno-builtin-fabsl for BZ #29253.
* New generic powfSzabolcs Nagy2017-09-296-199/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | without wrapper on aarch64: powf reciprocal-throughput: 4.2x faster powf latency: 2.6x faster old worst-case error: 1.11 ulp new worst-case error: 0.82 ulp aarch64 .text size: -780 bytes aarch64 .rodata size: +144 bytes powf(x,y) is implemented as exp2(y*log2(x)) with the same algorithms that are used in exp2f and log2f, except that the log2f polynomial is larger for extra precision and its output (and exp2f input) may be scaled by a power of 2 (POWF_SCALE) to simplify the argument reduction step of exp2 (possible when efficient round and convert toint operation is available). The special case handling tries to minimize the checks in the hot path. When the input of exp2_inline is checked, int arithmetics is used as that was faster on the tested aarch64 cores. * math/Makefile (type-float-routines): Add e_powf_log2_data. * sysdeps/ieee754/flt-32/e_powf.c: New implementation. * sysdeps/ieee754/flt-32/e_powf_log2_data.c: New file. * sysdeps/ieee754/flt-32/math_config.h (__powf_log2_data): Define. (issignalingf_inline): Likewise. (POWF_LOG2_TABLE_BITS): Likewise. (POWF_LOG2_POLY_ORDER): Likewise. (POWF_SCALE_BITS): Likewise. (POWF_SCALE): Likewise. * sysdeps/i386/fpu/e_powf_log2_data.c: New file. * sysdeps/ia64/fpu/e_powf_log2_data.c: New file. * sysdeps/m68k/m680x0/fpu/e_powf_log2_data.c: New file.
* New generic log2fSzabolcs Nagy2017-09-296-73/+133
| | | | | | | | | | | | | | | | | | | | | | | Similar to the new logf: double precision arithmetics and a small lookup table is used. The argument reduction step is the same as in the new logf. without wrapper on aarch64: log2f reciprocal-throughput: 2.3x faster log2f latency: 2.1x faster old worst case error: 1.72 ulp new worst case error: 0.75 ulp aarch64 .text size: -252 bytes aarch64 .rodata size: +244 bytes * math/Makefile (type-float-routines): Add e_log2f_data. * sysdeps/ieee754/flt-32/e_log2f.c: New implementation. * sysdeps/ieee754/flt-32/e_log2f_data.c: New file. * sysdeps/ieee754/flt-32/math_config.h (__log2f_data): Define. (LOG2F_TABLE_BITS, LOG2F_POLY_ORDER): Define. * sysdeps/i386/fpu/e_log2f_data.c: New file. * sysdeps/ia64/fpu/e_log2f_data.c: New file. * sysdeps/m68k/m680x0/fpu/e_log2f_data.c: New file.
* New generic logfSzabolcs Nagy2017-09-296-73/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | without wrapper on aarch64: logf reciprocal-throughput: 2.2x faster logf latency: 1.9x faster old worst case error: 0.89 ulp new worst case error: 0.82 ulp aarch64 .text size: -356 bytes aarch64 .rodata size: +240 bytes Uses double precision arithmetics and a lookup table to allow smaller polynomial and avoid the use of division. Data is in a separate translation unit with fixed layout to prevent the compiler generating suboptimal literal access. Errors are handled inline according to POSIX rules, but this patch keeps the wrapper with SVID compatible error handling. Needs libm-test-ulps adjustment for clogf in non-nearest rounding mode. * math/Makefile (type-float-routines): Add e_logf_data. * sysdeps/ieee754/flt-32/e_logf.c: New implementation. * sysdeps/ieee754/flt-32/e_logf_data.c: New file. * sysdeps/ieee754/flt-32/math_config.h (__logf_data): Define. (LOGF_TABLE_BITS, LOGF_POLY_ORDER): Define. * sysdeps/i386/fpu/e_logf_data.c: New file. * sysdeps/ia64/fpu/e_logf_data.c: New file. * sysdeps/m68k/m680x0/fpu/e_logf_data.c: New file.
* x86: Allow undefined _DYNAMIC in static executableH.J. Lu2017-09-282-4/+18
| | | | | | | | | | | | When --enable-static-pie is used to build static PIE, _DYNAMIC is used to compute the load address of static PIE. But _DYNAMIC is undefined when creating static executable. This patch makes _DYNAMIC weak in PIE libc.a so that it can be undefined. * sysdeps/i386/dl-machine.h (elf_machine_load_address): Allow undefined _DYNAMIC in PIE libc.a. * sysdeps/x86_64/dl-machine.h (elf_machine_load_address): Likewse.
* Remove ancient __signbit inlinesWilco Dijkstra2017-09-289-436/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Remove __signbit inlines from mathinline.h. Math.h already uses the builtin when supported, so additional inlines are only used on pre 4.0 GCCs. Similarly remove ancient copysign and fabs inlines. * sysdeps/alpha/fpu/bits/mathinline.h: Delete file. * sysdeps/ia64/fpu/bits/mathinline.h: Delete file. * sysdeps/m68k/coldfire/fpu/bits/mathinline.h: Delete file. * sysdeps/m68k/m680x0/fpu/bits/mathinline.h: (__signbitf): Remove. (__signbit): Remove. (__signbitl): Remove. * sysdeps/powerpc/bits/mathinline.h (__signbitf): Remove. (__signbit): Remove. (__signbitl): Remove. * sysdeps/s390/fpu/bits/mathinline.h: (__signbitf): Remove. (__signbit): Remove. (__signbitl): Remove * sysdeps/sparc/fpu/bits/mathinline.h (__signbitf): Remove. (__signbit): Remove. (__signbitl): Remove. * sysdeps/tile/bits/mathinline.h: Delete file. * sysdeps/x86/fpu/bits/mathinline.h (__signbitf): Remove. (__signbit): Remove. (__signbitl): Remove.
* Simplify C99 isgreater macrosWilco Dijkstra2017-09-285-286/+0
| | | | | | | | | | | | | | | | Simplify the C99 isgreater macros. Although some support was added in GCC 2.97, not all targets added support until GCC 3.1. Therefore only use the builtins in math.h from GCC 3.1 onwards, and defer to generic macros otherwise. Improve the generic isunordered macro to use compares rather than call fpclassify twice - this is not only faster but also correct for signaling NaNs. * math/math.h: Improve handling of C99 isgreater macros. * sysdeps/alpha/fpu/bits/mathinline.h: Remove isgreater macros. * sysdeps/m68k/m680x0/fpu/bits/mathinline.h: Likewise. * sysdeps/powerpc/bits/mathinline.h: Likewise. * sysdeps/sparc/fpu/bits/mathinline.h: Likewise. * sysdeps/x86/fpu/bits/mathinline.h: Likewise.
* AArch64: update libm-test-ulpsSzabolcs Nagy2017-09-281-2/+8
| | | | | | Update for new expf and logf. * sysdeps/aarch64/libm-test-ulps: Update.
* Fix nearbyint arithmetic moved before feholdexcept (bug 22225).Joseph Myers2017-09-284-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In <https://sourceware.org/ml/libc-alpha/2013-05/msg00722.html> I remarked on the possibility of arithmetic in various nearbyint implementations being scheduled before feholdexcept calls, resulting in spurious "inexact" exceptions. I'm now actually observing this occurring in glibc built for ARM with GCC 7 (in fact, both copies of the same addition/subtraction sequence being combined and moved out before the conditionals and feholdexcept/fesetenv pairs), resulting in test failures. This patch makes the nearbyint implementations with this particular feholdexcept / arithmetic / fesetenv pattern consistently use math_opt_barrier on the function argument when first used in arithmetic, and also consistently use math_force_eval before fesetenv (the latter was generally already done, but the dbl-64/wordsize-64 implementation used math_opt_barrier instead, and as math_opt_barrier's intended effect is through its output value being used, such a use that doesn't use the return value is suspect). Tested for x86_64 (--disable-multi-arch so more of these implementations get used), and for ARM in a configuration where I saw the problem scheduling. [BZ #22225] * sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Use math_opt_barrier on argument when doing arithmetic on it. * sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c (__nearbyint): Likewise. Use math_force_eval not math_opt_barrier after arithmetic. * sysdeps/ieee754/flt-32/s_nearbyintf.c (__nearbyintf): Use math_opt_barrier on argument when doing arithmetic on it. * sysdeps/ieee754/ldbl-128/s_nearbyintl.c (__nearbyintl): Likewise.
* Update sysdeps/unix/sysv/linux/ifaddrs.cH.J. Lu2017-09-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | Fix ../sysdeps/unix/sysv/linux/ifaddrs.c:835:27: error: ‘getifaddrs’ aliased to undefined symbol ‘__getifaddrs’ weak_alias (__getifaddrs, getifaddrs) ^ ../sysdeps/unix/sysv/linux/ifaddrs.c:844:28: error: ‘freeifaddrs’ aliased to undefined symbol ‘__freeifaddrs’ weak_alias (__freeifaddrs, freeifaddrs) caused by commit 4009ddc69225d571772aaea597615a0c032e14ab Author: Samuel Thibault <samuel.thibault@ens-lyon.org> Date: Thu Sep 28 00:19:18 2017 +0200 hurd: Fix `getifaddrs' and `freeifaddrs' symbol exposition * sysdeps/unix/sysv/linux/ifaddrs.c (__getifaddrs): Add libc_hidden_def. (__freeifaddrs): Likewise.
* hurd: Fix `getifaddrs' and `freeifaddrs' symbol expositionSamuel Thibault2017-09-281-0/+2
| | | | | | | | | | | | | | | from `freeaddrinfo'. `getifaddrs' and `freeifaddrs' are not in POSIX, they should not be exposed along `freeaddrinfo' (through `__check_pf') which is POSIX. * include/ifaddrs.h (__getifaddrs, __freeifaddrs): New declarations, and use libc_hidden_def on them. * inet/ifaddrs.c (__getifaddrs, __freeifaddrs): Use libc_hidden_def on them. * sysdeps/gnu/ifaddrs.c (__getifaddrs, __freeifaddrs): Likewise. * inet/check_pf.c (__check_pf): Use __getifaddrs and __freeifaddrs instead of getifaddrs and freeifaddrs.
* hurd: Fix `seekdir' symbol exposition from `rewinddir'Samuel Thibault2017-09-282-3/+4
| | | | | | | | | | | `seekdir' is MISC || XOPEN, it should not be exposed along `rewinddir' which is POSIX. * include/dirent.h (__seekdir): New declaration. * sysdeps/mach/hurd/seekdir.c (seekdir): Rename to __seekdir and redefine as weak alias. * sysdeps/mach/hurd/rewinddir.c (__rewinddir): Use __seekdir instead of seekdir.
* hurd: Fix `revoke' symbol exposition from `unlockpt'Samuel Thibault2017-09-282-2/+4
| | | | | | | | | | | | `revoke' is MISC only, it should not be exposed along `unlockpt' which is XOPEN. * include/unistd.h (__revoke): New declaration. * misc/revoke.c (revoke): Rename to __revoke, and redefine as weak alias. * sysdeps/mach/hurd/revoke.c (revoke): Likewise. * sysdeps/unix/bsd/unlockpt.c (unlockpt): Use __revoke instead of revoke.
* hurd: Fix dirfd symbol exposition from ftwSamuel Thibault2017-09-282-2/+6
| | | | | | | | | | | dirfd is XOPEN2K8 only, it should not be exposed along ftw which is earlier. * include/dirent.h (__dirfd): New declaration. * dirent/dirfd.c (dirfd): Rename to __dirfd, and redefine as weak alias. * sysdeps/posix/dirfd/dirfd.c (dirfd): Likewise. * sysdeps/mach/hurd/dirfd.c (dirfd): Likewise. * io/ftw.c (open_dir_stream, ftw_dir): Use __dirfd instead of dirfd.
* Fix make-syscalls.sh VDSO support for GCC 8.Joseph Myers2017-09-261-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | sysdeps/unix/make-syscalls.sh has support, used only by x32, for generating IFUNCs for kernel VDSO symbols. This support creates IFUNCs by setting symbol types manually, which is bad for debug info and does not work with current GCC mainline because it results in errors from the checks on types of function aliases. This patch fixes it to use the common __ifunc macro, which uses the ifunc attribute when available and so works with GCC mainline. Note however that the original error resulted from an indirect inclusion of a header declaring __gettimeofday from the generated sources, and using __ifunc now relies on such an indirect inclusion remaining as it means use of __typeof to determine the correct types. If glibc's headers change in such a way as to remove that indirect inclusion, it will become necessary to change the syscalls.list syntax for VDSO syscalls so the name of the header to include can be specified. Tested (compilation only) with build-many-glibcs.py that this fixes the build for x32 with GCC mainline. * sysdeps/unix/make-syscalls.sh: Use __ifunc to define symbols using VDSO.
* Use generic __ifunc for SPARC.Joseph Myers2017-09-261-8/+2
| | | | | | | | | | | | | | | | | | | | | glibc fails to build with GCC mainline for SPARC because of the use of manually-created IFUNCs, which fail the tests of compatibility of function alias types. This patch changes sparc-ifunc.h to use the generic __ifunc in defining sparc_libm_ifunc. The generic __ifunc can use the GCC ifunc attribute when available, so ensuring type-correctness as well as better debug info than when setting symbol types in asm statements. Note that for this to fix the build with GCC mainline the GCC patch <https://gcc.gnu.org/ml/gcc-patches/2017-09/msg01779.html>, or building GCC with --enable-gnu-indirect-function, is also needed. Tested (compilation only) with build-many-glibcs.py (sparc64-linux-gnu and sparcv9-linux-gnu, with GCC 8 with the above patch, and also with GCC 7). * sysdeps/sparc/sparc-ifunc.h [!__ASSEMBLER__] (sparc_libm_ifunc): Define using __ifunc.
* powerpc: Regenerate ULPs for expf() and exp2f()Tulio Magno Quites Machado Filho2017-09-261-8/+4
| | | | | | | Remove all entries for expf() and exp2f() and regenerate them. * sysdeps/powerpc/fpu/libm-test-ulps: Regenerate expf() and exp2f() values.
* Fix ia64 executable stack default (bug 22156).Joseph Myers2017-09-261-3/+2
| | | | | | | | | | | | | | | | | | As per https://gcc.gnu.org/ml/gcc-patches/2017-09/msg01220.html ia64 defaults to non-executable stacks in the Linux kernel (furthermore, the use of function descriptors means that trampolines for nested function pointers never need an executable stack). glibc however defines DEFAULT_STACK_PERMS to include PF_X for that architecture, meaning (a) elf/check-execstack fails and (b) (from code inspection, not tested, but this is why I think this is a user-visible bug) thread stacks are unnecessarily mapped with execute permission. This patch fixes the DEFAULT_STACK_PERMS definition in question. Tested (compilation only) with build-many-glibcs.py for ia64. This fixes the check-execstack failure. [BZ #22156] * sysdeps/ia64/stackinfo.h (DEFAULT_STACK_PERMS): Likewise.
* posix: Add compat glob symbol to not follow dangling symbolsAdhemerval Zanella2017-09-2537-35/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch follows commit 5554304f0 (posix: Allow glob to match dangling symlinks [BZ #866]) by adding a compat symbol that follow previous semantic of not following dangling symlinks and thus avoiding call gl_lstat with GLOB_ALTDIRFUNC. It avoids failure with old binaries that not set the alternate function pointer for lstat (GNUmake for instance). The following scenario, for instance, fails with current GNUmake because glibc will access unitialized memory when calling gl_lstat: $ cat src/t/t.c int main () { return 0; } $ cat Makefile SRC = $(wildcard src/*/t.c) OBJ = $(patsubst src/%.c, obj/%.o, $(SRC)) prog: $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJ) -o prog obj/%.o: src/%.c $(CC) $(CFLAGS) -c $< -o $@ $ make This works as expected with the patch applied. Since it is for generic ABI, default compat symbols are added with override for Linux due LFS. Now we have two compat symbols for glob on Linux: 1. sysdeps/unix/sysv/linux/oldglob.c which implements glob64 with the old dirent layout. For this implementation I also set it to not follow dangling symlinks (which is the safest path). 2. sysdeps/unix/sysv/linux/glob{64}-lstat-compat.c which implements the compat symbol for dangling symlinks. As for generic glob, the implementation uses XSTAT_IS_XSTAT64 to define whether both __glob_lstat_compat and __glob64_lstat_compat should be different implementations. For archictures that define XSTAT_IS_XSTAT64, __glob_lstat_compat is aliased to __glob64_lstat_compat. 3. sysdeps/unix/sysv/linux/alpha/oldglob.c with a different glob_t layout. As for 1. this patch changes it to not follow dangling symlinks. The patch also bumps _GNU_GLOB_INTERFACE_VERSION to 2 to advertise the new semantic. On GNUmake, for instance, it will force to it use its internal glob implementation instead and avoiding triggering the same failure on builds against newer GLIBCs. Checked on x86_64-linux-gnu and i686-linux-gnu. I also checked with a build against the major ABIs required to check for the abilist. The changes should also work on gnulib (I run gnulib-tool.py check glob and it shown no regressions). [BZ #22183] * include/gnu-versions.h (_GNU_GLOB_INTERFACE_VERSION): Increase version to 2. * posix/Makefile (routines): Add glob-lstat-compat and glob64-lstat-compat. * posix/Versions (GLIBC_2.27, glob, glob64): Add symbol version. * posix/glob-lstat-compat.c: New file. * posix/glob64-lstat-compat.c: Likewise. * posix/tst-glob_lstat_compat.c: Likewise. * sysdeps/unix/sysv/linux/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/glob64-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob.c: Remove file. * posix/glob.c (glob_lstat): New function. (glob): Rename to __glob and add versioned symbol to 2.27. (glob_in_dir): Use glob_lstat. * posix/glob64.c (glob64): Add GLOB_ATTRIBUTE. * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/glob.c (glob): Add versioned symbol for 2.27. * sysdeps/unix/sysv/linux/glob64.c (glob64): Likewise. * sysdeps/unix/sysv/linux/oldglob.c (GLOB_NO_LSTAT): Define. * sysdeps/unix/sysv/linux/alpha/oldglob.c (__old_glob): Do not use gl_lstat on glob call. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add GLIBC_2.27 glob and glob64 symbols. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* Fix typo in sincos32.h inclusion guard.Stefan Liebler2017-09-251-1/+1
| | | | | | | | | | This patch fixes a typo in inclusion guard in sincos32.h. ChangeLog: * sysdeps/ieee754/dbl-64/sincos32.h [SINCCOS32_H]: Remove define. [SINCOS32_H]: Define.
* New expf and exp2f version without SVID compat wrapperSzabolcs Nagy2017-09-2528-2/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the expf and exp2f error handling semantics to only set errno accoring to POSIX rules. New symbol version is introduced at GLIBC_2.27. The old wrappers are kept for compat symbols. Internal calls to __expf now get the new error semantics, this seems to only affect sysdeps/i386/fpu/s_expm1f.S where the errno-only behaviour should be correct. ia64 needed assembly change to have the new and compat versioned symbol map to the same function. All linux libm abilists are updated. * math/Versions (expf): New libm symbol at GLIBC_2.27. (exp2f): Likewise. * math/w_exp2f.c: New file. * math/w_expf.c: New file. * math/w_exp2f_compat.c (__exp2f_compat): For compat symbol only. * math/w_expf_compat.c (__expf_compat): Likewise. * sysdeps/ia64/fpu/e_exp2f.S: Add versioned symbols. * sysdeps/ia64/fpu/e_expf.S: Likewise. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Update. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Optimized generic expf and exp2f with wrappersSzabolcs Nagy2017-09-2513-566/+400
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on new expf and exp2f code from https://github.com/ARM-software/optimized-routines/ with wrapper on aarch64: expf reciprocal-throughput: 2.3x faster expf latency: 1.7x faster without wrapper on aarch64: expf reciprocal-throughput: 3.3x faster expf latency: 1.7x faster without wrapper on aarch64: exp2f reciprocal-throughput: 2.8x faster exp2f latency: 1.3x faster libm.so size on aarch64: .text size: -152 bytes .rodata size: -1740 bytes expf/exp2f worst case nearest rounding error: 0.502 ulp worst case non-nearest rounding error: 1 ulp Error checks are inline and errno setting is in separate tail called functions, but the wrappers are kept in this patch to handle the _LIB_VERSION==_SVID_ case. (So e.g. errno is set twice for expf calls and once for __expf_finite calls on targets where the new code is used.) Double precision arithmetics is used which is expected to be faster on most targets (including soft-float) than using single precision and it is easier to get good precision result with it. Const data is kept in a separate translation unit which complicates maintenance a bit, but is expected to give good code for literal loads on most targets and allows sharing data across expf, exp2f and powf. (This data is disabled on i386, m68k and ia64 which have their own expf, exp2f and powf code.) Some details may need target specific tweaks: - best convert and round to int operation in the arg reduction may be different across targets. - code was optimized on fma target, optimal polynomial eval may be different without fma. - gcc does not always generate good code for fp bit representation access via unions or it may be inherently slow on some targets. The libm-test-ulps will need adjustment because.. - The argument reduction ideally uses nearest rounded rint, but that is not efficient on most targets, so the polynomial can get evaluated on a wider interval in non-nearest rounding mode making 1 ulp errors common in that case. - The polynomial is evaluated such that it may have 1 ulp error on negative tiny inputs with upward rounding. * math/Makefile (type-float-routines): Add math_errf and e_exp2f_data. * sysdeps/aarch64/fpu/math_private.h (TOINT_INTRINSICS): Define. (roundtoint, converttoint): Likewise. * sysdeps/ieee754/flt-32/e_expf.c: New implementation. * sysdeps/ieee754/flt-32/e_exp2f.c: New implementation. * sysdeps/ieee754/flt-32/e_exp2f_data.c: New file. * sysdeps/ieee754/flt-32/math_config.h: New file. * sysdeps/ieee754/flt-32/math_errf.c: New file. * sysdeps/ieee754/flt-32/t_exp2f.h: Remove. * sysdeps/i386/fpu/e_exp2f_data.c: New file. * sysdeps/i386/fpu/math_errf.c: New file. * sysdeps/ia64/fpu/e_exp2f_data.c: New file. * sysdeps/ia64/fpu/math_errf.c: New file. * sysdeps/m68k/m680x0/fpu/e_exp2f_data.c: New file. * sysdeps/m68k/m680x0/fpu/math_errf.c: New file.
* hurd: Fix exposition of s/gettimeofday through timespec_s/getSamuel Thibault2017-09-252-3/+3
| | | | | | | | | | | | | conform/ISO11/time.h/linknamespace complains that using timespec_get exposes gettimeofday. conform/POSIX/time.h/linknamespace complains that using clock_settime exposes settimeofday. * sysdeps/unix/clock_gettime.c (realtime_gettime, __clock_gettime): Use __gettimeofday instead of gettimeofday. * sysdeps/unix/clock_settime.c (__clock_settime): Use __settimeofday instead of settimeofday.
* hurd: Fix bits/socket.h conformitySamuel Thibault2017-09-241-9/+16
| | | | | | | | | | | | | * sysdeps/mach/hurd/bits/socket.h: Include <bits/wordsize.h> instead of <limits.h> (__need_NULL): Do not define. (__ss_aligntype): Use __WORDSIZE instead of ULONG_MAX to determine alignment. [!__USE_MISC] (pseudo_AF_XTP, pseudo_AF_RTIP, pseudo_AF_PIP, CMGROUP_MAX, cmsgcred): Do not define. (CMSG_FIRSTHDR, __cmsg_nxthdr): Use (struct cmsghdr *) 0 instead of NULL. * bits/socket.h: Likewise.
* hurd: Make sure dl-sysdep.c defines proper symbol namesSamuel Thibault2017-09-241-7/+25
| | | | | | | | * sysdeps/mach/hurd/dl-sysdep.c (check_no_hidden): New macro. (__open, __close, __libc_read, __libc_write, __writev, __libc_lseek64, __mmap, __fxstat64, __xstat64, __access, __access_noerrno, __getpid, __getcwd, __sbrk, __strtoul_internal, _exit, abort): Use check_no_hidden to make sure that these symbols are defined.
* Use libm_alias_float in flt-32.Joseph Myers2017-09-2240-39/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes flt-32 libm functions use libm_alias_float to define public interfaces (in cases where _Float32 aliases of those interfaces would be appropriate, so not for finitef / isinff / isnanf). Tested for x86_64. Also tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/ieee754/flt-32/s_asinhf.c: Include <libm-alias-float.h>. (asinhf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_atanf.c: Include <libm-alias-float.h>. (atanf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_cbrtf.c: Include <libm-alias-float.h>. (cbrtf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_ceilf.c: Include <libm-alias-float.h>. (ceilf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_copysignf.c: Include <libm-alias-float.h>. (copysignf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_cosf.c: Include <libm-alias-float.h>. (cosf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_erff.c: Include <libm-alias-float.h>. (erff): Define using libm_alias_float. (erfcf): Likewise. * sysdeps/ieee754/flt-32/s_expm1f.c: Include <libm-alias-float.h>. (expm1f): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_fabsf.c: Include <libm-alias-float.h>. (fabsf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_floorf.c: Include <libm-alias-float.h>. (floorf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_frexpf.c: Include <libm-alias-float.h>. (frexpf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_fromfpf.c (fromfpf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_fromfpf_main.c: Include <libm-alias-float.h>. * sysdeps/ieee754/flt-32/s_fromfpxf.c (fromfpxf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_getpayloadf.c: Include <libm-alias-float.h>. (getpayloadf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_llrintf.c: Include <libm-alias-float.h>. (llrintf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_llroundf.c: Include <libm-alias-float.h>. (llroundf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_logbf.c: Include <libm-alias-float.h>. (logbf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_lrintf.c: Include <libm-alias-float.h>. (lrintf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_lroundf.c: Include <libm-alias-float.h>. (lroundf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_modff.c: Include <libm-alias-float.h>. (modff): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_nearbyintf.c: Include <libm-alias-float.h>. (nearbyintf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_nextafterf.c: Include <libm-alias-float.h>. (nextafterf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_nextupf.c: Include <libm-alias-float.h>. (nextupf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_remquof.c: Include <libm-alias-float.h>. (remquof): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_rintf.c: Include <libm-alias-float.h>. (rintf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_roundevenf.c: Include <libm-alias-float.h>. (roundevenf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_roundf.c: Include <libm-alias-float.h>. (roundf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_setpayloadf.c (setpayloadf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_setpayloadf_main.c: Include <libm-alias-float.h>. * sysdeps/ieee754/flt-32/s_setpayloadsigf.c (setpayloadsigf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_sincosf.c: Include <libm-alias-float.h>. (sincosf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_sinf.c: Include <libm-alias-float.h>. (sinf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_tanf.c: Include <libm-alias-float.h>. (tanf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_tanhf.c: Include <libm-alias-float.h>. (tanhf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_totalorderf.c: Include <libm-alias-float.h>. (totalorderf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_totalordermagf.c: Include <libm-alias-float.h>. (totalordermagf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_truncf.c: Include <libm-alias-float.h>. (truncf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_ufromfpf.c (ufromfpf): Define using libm_alias_float. * sysdeps/ieee754/flt-32/s_ufromfpxf.c (ufromfpxf): Define using libm_alias_float.
* Remove conditional on LDBL_MANT_DIG from e_lgammal_r.cGabriel F. T. Gomes2017-09-212-10/+2
| | | | | | | | | | | | | | | | The IEEE 754 implementation of lgammal in sysdeps/ieee754/ldbl-128/ used to be shared by IBM's implementation in sysdeps/ieee754/ldbl-128ibm/ (by an inclusion of the source file). In order for the algorithm to work for IBM's implementation, a check for LDBL_MANT_DIG was required. Since the source file is no longer shared, the requirement for the check is gone. This patch removes the conditionals. Tested for powerpc64le and s390x. * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r): Remove conditionals on LDBL_MANT_DIG. * sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c (__ieee754_lgammal_r): Likewise.
* ldbl-128ibm: Automatic replacing of _Float128 and L()Gabriel F. T. Gomes2017-09-216-2253/+2241
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ldbl-128ibm implementation of j0l, j1l, lgammal_r, and cbrtl, as well as the tables used by expl were copied from ldbl-128. However, the original files used _Float128 for the type and L() for the literal suffix. This patch uses the following sed command to rewrite _Float128 as long double and L(x) as xL (for e_expl.c, e_j0l.c, e_j1l.c, e_lgammal_r.c, and t_expl.h): sed -i <filename> \ -e "/^#define _Float128 long double/d" \ -e "/^#define L(x) x ## L/d" \ -e "/L(/s/)/L/" \ -e "/L(/s/L(//" \ -e "s/_Float128/long double/g" For sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c, this sed command incorrectly replaces a few occurrences of L(), so the following command is used instead: sed -i sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c \ -e "/^#define _Float128 long double/d" \ -e "/^#define L(x) x ## L/d" \ -e "s/L(0\.3\{40\})/0.3333333333333333333333333333333333333333L/" \ -e "s/L(3\.7568280825958912391243e-1)/3.7568280825958912391243e-1L/" \ -e "/L(/s/)/L/" \ -e "/L(/s/L(//" \ -e "s/_Float128/long double/g" Tested for powerpc64le with patched [1] and unpatched gcc. [1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html * sysdeps/ieee754/ldbl-128ibm/e_expl.c: Remove definitions of _Float128 and L(). * sysdeps/ieee754/ldbl-128ibm/e_j0l.c: Remove definitions of _Float128 and L(). Replace _Float128 with long double and L(x) with xL, throughout the file. * sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/t_expl.h: Likewise.
* ldbl-128ibm: Copy implementations from ldbl-128 instead of including themGabriel F. T. Gomes2017-09-216-12/+3814
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some files under sysdeps/ieee754/ldbl-128ibm/ are able to reuse the implementation in sysdeps/ieee754/ldbl-128/ by defining _Float128 to long double. This relied on compiler support for _Float128 being disabled. On powerpc, such support was disabled by default, however, it got enabled by default [1] in GCC 8. This patch copies the implementations from ldbl-128 to ldbl-128ibm. The uses of _Float128 and L() are kept intact in this patch and are replaced with a script in a subsequent patch. [1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html Tested for powerpc64 and powerpc64le. * sysdeps/ieee754/ldbl-128ibm/e_expl.c: Include tables from sysdeps/ieee754/ldbl-128ibm. * sysdeps/ieee754/ldbl-128ibm/e_j0l.c: Copy contents from the equivalent implementation in sysdeps/ieee754/ldbl-128/ instead of including it. Keep _Float128 and L() intact. These will be reviewed by a separate patch. * sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/t_expl.h: Likewise.
* powerpc: Add redirection for finitef128, isinf128, and isnanf128Gabriel F. T. Gomes2017-09-213-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On powerpc64le, compiler support for float128 is not enabled by default on gcc. To enable it, the flag -mfloat128 must be passed as a command line option to the compiler. This means that only the few files that actively have -mfloat128 passed as an argument get compiler support for float128, whereas all other files don't. When -mfloat128 becomes enabled by default on powerpc [1], all the files that do not currently have compiler support for float128 enabled during their compilation, will start to have it. This will lead to build errors in s_finite.c, s_isinf.c, and s_isnan.c. The errors are due to the unintended macro expansion of __finitef128 to __redirect_finitef128 in math/bits/mathcalls-helper-functions.h. In that header, __MATHDECL_1 takes '__finite' and 'f128' as arguments and concatenates them. However, since '__finite' has been redefined in s_finite.c, the function declaration becomes __redirect_finitef128: extern int __redirect___finitef128 (_Float128 __value) __attribute__ ((__nothrow__ )) __attribute__ ((__const__)); This declaration itself is OK. The problem arises when include/math.h creates the hidden prototype ('hidden_proto (__finitef128)'), which expands to: extern __typeof (__finitef128) __finitef128 __attribute__ ((visibility ("hidden"))); Since __finitef128 is not declared, __typeof fails. This effect was already true for the 'float' and 'long double' versions and is now true for float128. Likewise for isinsff128 and isnanf128. This patch defines __finitef128 as __redirect___finitef128 in sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c, similarly to what's done for the float and long double versions of these functions, to get rid of the build error. Likewise for isinff128 and isnanf128. [1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html Tested for powerpc64 and powerpc64le. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c (__finitef128): Define to __redirect___finitef128. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c (__isinff128): Define to __redirect___isinff128. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c (__isnanf128): Define to __redirect___isnanf128.
* powerpc64le: Add -mfloat128 to tst-strtod-nan-locale testcaseGabriel F. T. Gomes2017-09-211-0/+3
| | | | | | | | | | | | | | | | On powerpc64le, not all files can have the flag -mfloat128 passed as an option on the compile command, since that could conflict with other flags, such as -mno-vsx. Each file that needs the flag, gets it through a CFLAGS-filename variable on sysdeps/powerpc/powerpc64le/Makefile. The test cases tst-strtod-nan-locale and tst-wcstod-nan-locale are missing this flag. Tested for powerpc64le. * sysdeps/powerpc/powerpc64le/Makefile (CFLAGS-tst-strtod-nan-locale.c): New variable. (CFLAGS-tst-wcstod-nan-locale.c): New variable.
* Add SSE4.1 trunc, truncf (bug 20142).Joseph Myers2017-09-207-2/+116
| | | | | | | | | | | | | | | | | | | | This patch adds SSE4.1 versions of trunc and truncf, using the roundsd / roundss instructions, similar to the versions of ceil, floor, rint and nearbyint functions we already have. In my testing with the glibc benchtests these are about 30% faster than the C versions for double, 20% faster for float. Tested for x86_64. [BZ #20142] * sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_trunc-c, s_truncf-c, s_trunc-sse4_1 and s_truncf-sse4_1. * sysdeps/x86_64/fpu/multiarch/s_trunc-c.c: New file. * sysdeps/x86_64/fpu/multiarch/s_trunc-sse4_1.S: Likewise. * sysdeps/x86_64/fpu/multiarch/s_trunc.c: Likewise. * sysdeps/x86_64/fpu/multiarch/s_truncf-c.c: Likewise. * sysdeps/x86_64/fpu/multiarch/s_truncf-sse4_1.S: Likewise. * sysdeps/x86_64/fpu/multiarch/s_truncf.c: Likewise.