about summary refs log tree commit diff
path: root/sysdeps/i386
Commit message (Collapse)AuthorAgeFilesLines
...
* Move SNAN_TESTS_* out of math-tests.h.Joseph Myers2018-08-101-7/+19
| | | | | | | | | | | | | | | | | | | | | | | Continuing moving macros out of math-tests.h to smaller headers following typo-proof conventions instead of using #ifndef, this patch moves the SNAN_TESTS_* macros for individual types out to their own sysdeps header (while the type-generic SNAN_TESTS wrapper for those macros remains in math-tests.h). Tested for x86_64 and x86, and with build-many-glibcs.py. * sysdeps/generic/math-tests-snan.h: New file. * sysdeps/generic/math-tests.h: Include <math-tests-snan.h>. (SNAN_TESTS_float): Do not define here. (SNAN_TESTS_double): Likewise. (SNAN_TESTS_long_double): Likewise. (SNAN_TESTS_float128): Likewise. * sysdeps/i386/fpu/math-tests-snan.h: New file. * sysdeps/i386/fpu/math-tests.h: Remove file. * sysdeps/ia64/math-tests-snan.h: New file. * sysdeps/ia64/math-tests.h: Remove file. * sysdeps/x86/math-tests.h: Likewise. * sysdeps/x86_64/fpu/math-tests-snan.h: New file.
* Move __fentry__ version definition to sysdeps/{i386,x86_64}Ilya Leoshkevich2018-08-101-0/+3
| | | | | | | | | | | | | | __fentry__ symbol is currently not defined for other architectures. Attempts to introduce it cause abicheck to fail, because it will be available since 2.29 earliest, and not 2.13, which is the case for Intel. With the new code, abicheck passes for i686-linux-gnu, x86_64-linux-gnu and x86_64-linux-gnu32 triples. ChangeLog: * stdlib/Versions: Remove __fentry__. * sysdeps/i386/Versions: Add __fentry__. * sysdeps/x86_64/Versions: Add __fentry__.
* x86: Don't include <init-arch.h> in assembly codesH.J. Lu2018-08-031-1/+0
| | | | | | | | | | | | There is no need to include <init-arch.h> in assembly codes since all x86 IFUNC selector functions are written in C. Tested on i686 and x86-64. There is no code change in libc.so, ld.so and libmvec.so. * sysdeps/i386/i686/multiarch/bzero-ia32.S: Don't include <init-arch.h>. * sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core-avx2.S: Likewise. * sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core-avx2.S: Likewise. * sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S: Likewise.
* x86: Rename __glibc_reserved2 to ssp_base in tcbhead_tH.J. Lu2018-07-252-1/+3
| | | | | | | | | | | | | | | This will be used to record the current shadow stack base for shadow stack switching by getcontext, makecontext, setcontext and swapcontext. If the target shadow stack base is the same as the current shadow stack base, we unwind the shadow stack. Otherwise it is a stack switch and we look for a restore token to restore the target shadow stack. * sysdeps/i386/nptl/tcb-offsets.sym (SSP_BASE_OFFSET): New. * sysdeps/i386/nptl/tls.h (tcbhead_t): Replace __glibc_reserved2 with ssp_base. * sysdeps/x86_64/nptl/tcb-offsets.sym (SSP_BASE_OFFSET): New. * sysdeps/x86_64/nptl/tls.h (tcbhead_t): Replace __glibc_reserved2 with ssp_base.
* i386: Use _CET_NOTRACK in memset-sse2-rep.SH.J. Lu2018-07-181-2/+2
| | | | | | * sysdeps/i386/i686/multiarch/memset-sse2-rep.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
* i386: Use _CET_NOTRACK in strcat-sse2.SH.J. Lu2018-07-181-2/+2
| | | | | | * sysdeps/i386/i686/multiarch/strcat-sse2.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
* i386: Use _CET_NOTRACK in strcpy-sse2.SH.J. Lu2018-07-181-2/+2
| | | | | | * sysdeps/i386/i686/multiarch/strcpy-sse2.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
* i386: Use _CET_NOTRACK in memcpy-ssse3.SH.J. Lu2018-07-181-2/+2
| | | | | | * sysdeps/i386/i686/multiarch/memcpy-ssse3.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
* i386: Use _CET_NOTRACK in memcpy-ssse3-rep.SH.J. Lu2018-07-181-4/+4
| | | | | | | * sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table. (BRANCH_TO_JMPTBL_ENTRY_TAIL): Likewise.
* i386: Use _CET_NOTRACK in memcmp-sse4.SH.J. Lu2018-07-181-2/+2
| | | | | | * sysdeps/i386/i686/multiarch/memcmp-sse4.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
* i386: Use _CET_NOTRACK in memset-sse2.SH.J. Lu2018-07-181-2/+2
| | | | | | * sysdeps/i386/i686/multiarch/memset-sse2.S (BRANCH_TO_JMPTBL_ENTRY): Add _CET_NOTRACK before indirect jump to jump table.
* i386: Use _CET_NOTRACK in i686/memcmp.SH.J. Lu2018-07-181-2/+2
| | | | | * sysdeps/i386/i686/memcmp.S (memcmp): Add _CET_NOTRACK before indirect jump to jump table.
* i386: Add _CET_ENDBR to indirect jump targets in add_n.S/sub_n.SH.J. Lu2018-07-173-3/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | i386 add_n.S and sub_n.S use a trick to implment jump tables with LEA. We can't use conditional branches nor normal jump tables since jump table entries use EFLAGS set by jump table index. This patch adds _CET_ENDBR to indirect jump targets and adjust destination for _CET_ENDBR. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * sysdeps/i386/add_n.S: Include <sysdep.h>, instead of "sysdep.h". (__mpn_add_n): Save and restore %ebx if IBT is enabed. Add _CET_ENDBR to indirect jump targets and adjust jump destination for _CET_ENDBR. * sysdeps/i386/i686/add_n.S: Include <sysdep.h>, instead of "sysdep.h". (__mpn_add_n): Save and restore %ebx if IBT is enabed. Add _CET_ENDBR to indirect jump targets and adjust jump destination for _CET_ENDBR. * sysdeps/i386/sub_n.S: Include <sysdep.h>, instead of "sysdep.h". (__mpn_sub_n): Save and restore %ebx if IBT is enabed. Add _CET_ENDBR to indirect jump targets and adjust jump destination for _CET_ENDBR.
* x86: Add _CET_ENDBR to functions in dl-tlsdesc.SH.J. Lu2018-07-171-0/+7
| | | | | | | | | | | | | | | | | | | | | | | Add _CET_ENDBR to functions in dl-tlsdesc.S, which are called indirectly, to support IBT. Tested on i686 and x86-64. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * sysdeps/i386/dl-tlsdesc.S (_dl_tlsdesc_return): Add _CET_ENDBR. (_dl_tlsdesc_undefweak): Likewise. (_dl_tlsdesc_dynamic): Likewise. (_dl_tlsdesc_resolve_abs_plus_addend): Likewise. (_dl_tlsdesc_resolve_rel): Likewise. (_dl_tlsdesc_resolve_rela): Likewise. (_dl_tlsdesc_resolve_hold): Likewise. * sysdeps/x86_64/dl-tlsdesc.S (_dl_tlsdesc_return): Likewise. (_dl_tlsdesc_undefweak): Likewise. (_dl_tlsdesc_dynamic): Likewise. (_dl_tlsdesc_resolve_rela): Likewise. (_dl_tlsdesc_resolve_hold): Likewise.
* x86: Add _CET_ENDBR to functions in crti.SH.J. Lu2018-07-171-0/+2
| | | | | | | | | | | | | | Add _CET_ENDBR to functions in crti.S, which are called indirectly, to support IBT. Tested on i686 and x86-64. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * sysdeps/i386/crti.S (_init): Add _CET_ENDBR. (_fini): Likewise. * sysdeps/x86_64/crti.S (_init): Likewise. (_fini): Likewise.
* x86: Support IBT and SHSTK in Intel CET [BZ #21598]H.J. Lu2018-07-162-0/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intel Control-flow Enforcement Technology (CET) instructions: https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-en forcement-technology-preview.pdf includes Indirect Branch Tracking (IBT) and Shadow Stack (SHSTK). GNU_PROPERTY_X86_FEATURE_1_IBT is added to GNU program property to indicate that all executable sections are compatible with IBT when ENDBR instruction starts each valid target where an indirect branch instruction can land. Linker sets GNU_PROPERTY_X86_FEATURE_1_IBT on output only if it is set on all relocatable inputs. On an IBT capable processor, the following steps should be taken: 1. When loading an executable without an interpreter, enable IBT and lock IBT if GNU_PROPERTY_X86_FEATURE_1_IBT is set on the executable. 2. When loading an executable with an interpreter, enable IBT if GNU_PROPERTY_X86_FEATURE_1_IBT is set on the interpreter. a. If GNU_PROPERTY_X86_FEATURE_1_IBT isn't set on the executable, disable IBT. b. Lock IBT. 3. If IBT is enabled, when loading a shared object without GNU_PROPERTY_X86_FEATURE_1_IBT: a. If legacy interwork is allowed, then mark all pages in executable PT_LOAD segments in legacy code page bitmap. Failure of legacy code page bitmap allocation causes an error. b. If legacy interwork isn't allowed, it causes an error. GNU_PROPERTY_X86_FEATURE_1_SHSTK is added to GNU program property to indicate that all executable sections are compatible with SHSTK where return address popped from shadow stack always matches return address popped from normal stack. Linker sets GNU_PROPERTY_X86_FEATURE_1_SHSTK on output only if it is set on all relocatable inputs. On a SHSTK capable processor, the following steps should be taken: 1. When loading an executable without an interpreter, enable SHSTK if GNU_PROPERTY_X86_FEATURE_1_SHSTK is set on the executable. 2. When loading an executable with an interpreter, enable SHSTK if GNU_PROPERTY_X86_FEATURE_1_SHSTK is set on interpreter. a. If GNU_PROPERTY_X86_FEATURE_1_SHSTK isn't set on the executable or any shared objects loaded via the DT_NEEDED tag, disable SHSTK. b. Otherwise lock SHSTK. 3. After SHSTK is enabled, it is an error to load a shared object without GNU_PROPERTY_X86_FEATURE_1_SHSTK. To enable CET support in glibc, --enable-cet is required to configure glibc. When CET is enabled, both compiler and assembler must support CET. Otherwise, it is a configure-time error. To support CET run-time control, 1. _dl_x86_feature_1 is added to the writable ld.so namespace to indicate if IBT or SHSTK are enabled at run-time. It should be initialized by init_cpu_features. 2. For dynamic executables: a. A l_cet field is added to struct link_map to indicate if IBT or SHSTK is enabled in an ELF module. _dl_process_pt_note or _rtld_process_pt_note is called to process PT_NOTE segment for GNU program property and set l_cet. b. _dl_open_check is added to check IBT and SHSTK compatibilty when dlopening a shared object. 3. Replace i386 _dl_runtime_resolve and _dl_runtime_profile with _dl_runtime_resolve_shstk and _dl_runtime_profile_shstk, respectively if SHSTK is enabled. CET run-time control can be changed via GLIBC_TUNABLES with $ export GLIBC_TUNABLES=glibc.tune.x86_shstk=[permissive|on|off] $ export GLIBC_TUNABLES=glibc.tune.x86_ibt=[permissive|on|off] 1. permissive: SHSTK is disabled when dlopening a legacy ELF module. 2. on: IBT or SHSTK are always enabled, regardless if there are IBT or SHSTK bits in GNU program property. 3. off: IBT or SHSTK are always disabled, regardless if there are IBT or SHSTK bits in GNU program property. <cet.h> from CET-enabled GCC is automatically included by assembly codes to add GNU_PROPERTY_X86_FEATURE_1_IBT and GNU_PROPERTY_X86_FEATURE_1_SHSTK to GNU program property. _CET_ENDBR is added at the entrance of all assembly functions whose address may be taken. _CET_NOTRACK is used to insert NOTRACK prefix with indirect jump table to support IBT. It is defined as notrack when _CET_NOTRACK is defined in <cet.h>. [BZ #21598] * configure.ac: Add --enable-cet. * configure: Regenerated. * elf/Makefille (all-built-dso): Add a comment. * elf/dl-load.c (filebuf): Moved before "dynamic-link.h". Include <dl-prop.h>. (_dl_map_object_from_fd): Call _dl_process_pt_note on PT_NOTE segment. * elf/dl-open.c: Include <dl-prop.h>. (dl_open_worker): Call _dl_open_check. * elf/rtld.c: Include <dl-prop.h>. (dl_main): Call _rtld_process_pt_note on PT_NOTE segment. Call _rtld_main_check. * sysdeps/generic/dl-prop.h: New file. * sysdeps/i386/dl-cet.c: Likewise. * sysdeps/unix/sysv/linux/x86/cpu-features.c: Likewise. * sysdeps/unix/sysv/linux/x86/dl-cet.h: Likewise. * sysdeps/x86/cet-tunables.h: Likewise. * sysdeps/x86/check-cet.awk: Likewise. * sysdeps/x86/configure: Likewise. * sysdeps/x86/configure.ac: Likewise. * sysdeps/x86/dl-cet.c: Likewise. * sysdeps/x86/dl-procruntime.c: Likewise. * sysdeps/x86/dl-prop.h: Likewise. * sysdeps/x86/libc-start.h: Likewise. * sysdeps/x86/link_map.h: Likewise. * sysdeps/i386/dl-trampoline.S (_dl_runtime_resolve): Add _CET_ENDBR. (_dl_runtime_profile): Likewise. (_dl_runtime_resolve_shstk): New. (_dl_runtime_profile_shstk): Likewise. * sysdeps/linux/x86/Makefile (sysdep-dl-routines): Add dl-cet if CET is enabled. (CFLAGS-.o): Add -fcf-protection if CET is enabled. (CFLAGS-.os): Likewise. (CFLAGS-.op): Likewise. (CFLAGS-.oS): Likewise. (asm-CPPFLAGS): Add -fcf-protection -include cet.h if CET is enabled. (tests-special): Add $(objpfx)check-cet.out. (cet-built-dso): New. (+$(cet-built-dso:=.note)): Likewise. (common-generated): Add $(cet-built-dso:$(common-objpfx)%=%.note). ($(objpfx)check-cet.out): New. (generated): Add check-cet.out. * sysdeps/x86/cpu-features.c: Include <dl-cet.h> and <cet-tunables.h>. (TUNABLE_CALLBACK (set_x86_ibt)): New prototype. (TUNABLE_CALLBACK (set_x86_shstk)): Likewise. (init_cpu_features): Call get_cet_status to check CET status and update dl_x86_feature_1 with CET status. Call TUNABLE_CALLBACK (set_x86_ibt) and TUNABLE_CALLBACK (set_x86_shstk). Disable and lock CET in libc.a. * sysdeps/x86/cpu-tunables.c: Include <cet-tunables.h>. (TUNABLE_CALLBACK (set_x86_ibt)): New function. (TUNABLE_CALLBACK (set_x86_shstk)): Likewise. * sysdeps/x86/sysdep.h (_CET_NOTRACK): New. (_CET_ENDBR): Define if not defined. (ENTRY): Add _CET_ENDBR. * sysdeps/x86/dl-tunables.list (glibc.tune): Add x86_ibt and x86_shstk. * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Add _CET_ENDBR. (_dl_runtime_profile): Likewise.
* x86: Support shadow stack pointer in setjmp/longjmpH.J. Lu2018-07-144-0/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Save and restore shadow stack pointer in setjmp and longjmp to support shadow stack in Intel CET. Use feature_1 in tcbhead_t to check if shadow stack is enabled before saving and restoring shadow stack pointer. Reviewed-by: Carlos O'Donell <carlos@redhat.com> * sysdeps/i386/__longjmp.S: Include <jmp_buf-ssp.h>. (__longjmp): Restore shadow stack pointer if shadow stack is enabled, SHADOW_STACK_POINTER_OFFSET is defined and __longjmp isn't defined for __longjmp_cancel. * sysdeps/i386/bsd-_setjmp.S: Include <jmp_buf-ssp.h>. (_setjmp): Save shadow stack pointer if shadow stack is enabled and SHADOW_STACK_POINTER_OFFSET is defined. * sysdeps/i386/bsd-setjmp.S: Include <jmp_buf-ssp.h>. (setjmp): Save shadow stack pointer if shadow stack is enabled and SHADOW_STACK_POINTER_OFFSET is defined. * sysdeps/i386/setjmp.S: Include <jmp_buf-ssp.h>. (__sigsetjmp): Save shadow stack pointer if shadow stack is enabled and SHADOW_STACK_POINTER_OFFSET is defined. * sysdeps/unix/sysv/linux/i386/____longjmp_chk.S: Include <jmp_buf-ssp.h>. (____longjmp_chk): Restore shadow stack pointer if shadow stack is enabled and SHADOW_STACK_POINTER_OFFSET is defined. * sysdeps/unix/sysv/linux/x86/Makefile (gen-as-const-headers): Remove jmp_buf-ssp.sym. * sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: Include <jmp_buf-ssp.h>. (____longjmp_chk): Restore shadow stack pointer if shadow stack is enabled and SHADOW_STACK_POINTER_OFFSET is defined. * sysdeps/x86/Makefile (gen-as-const-headers): Add jmp_buf-ssp.sym. * sysdeps/x86/jmp_buf-ssp.sym: New dummy file. * sysdeps/x86_64/__longjmp.S: Include <jmp_buf-ssp.h>. (__longjmp): Restore shadow stack pointer if shadow stack is enabled, SHADOW_STACK_POINTER_OFFSET is defined and __longjmp isn't defined for __longjmp_cancel. * sysdeps/x86_64/setjmp.S: Include <jmp_buf-ssp.h>. (__sigsetjmp): Save shadow stack pointer if shadow stack is enabled and SHADOW_STACK_POINTER_OFFSET is defined.
* x86: Rename __glibc_reserved1 to feature_1 in tcbhead_t [BZ #22563]H.J. Lu2018-07-142-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | feature_1 has X86_FEATURE_1_IBT and X86_FEATURE_1_SHSTK bits for CET run-time control. CET_ENABLED, IBT_ENABLED and SHSTK_ENABLED are defined to 1 or 0 to indicate that if CET, IBT and SHSTK are enabled. <tls-setup.h> is added to set up thread-local data. Reviewed-by: Carlos O'Donell <carlos@redhat.com> [BZ #22563] * nptl/pthread_create.c: Include <tls-setup.h>. (__pthread_create_2_1): Call tls_setup_tcbhead. * sysdeps/generic/tls-setup.h: New file. * sysdeps/x86/nptl/tls-setup.h: Likewise. * sysdeps/i386/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): New. * sysdeps/x86_64/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): Likewise. * sysdeps/i386/nptl/tls.h (tcbhead_t): Rename __glibc_reserved1 to feature_1. * sysdeps/x86_64/nptl/tls.h (tcbhead_t): Likewise. * sysdeps/x86/sysdep.h (X86_FEATURE_1_IBT): New. (X86_FEATURE_1_SHSTK): Likewise. (CET_ENABLED): Likewise. (IBT_ENABLED): Likewise. (SHSTK_ENABLED): Likewise.
* math: Set 387 and SSE2 rounding mode for tgamma on i386 [BZ #23253]Florian Weimer2018-06-212-5/+21
| | | | | | Previously, only the SSE2 rounding mode was set, so the assembler implementations using 387 were not following the expecting rounding mode.
* i386: Change offset of __private_ss to 0x30 [BZ #23250]H.J. Lu2018-06-121-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sysdeps/i386/nptl/tls.h has typedef struct { void *tcb; /* Pointer to the TCB. Not necessarily the thread descriptor used by libpthread. */ dtv_t *dtv; void *self; /* Pointer to the thread descriptor. */ int multiple_threads; uintptr_t sysinfo; uintptr_t stack_guard; uintptr_t pointer_guard; int gscope_flag; int __glibc_reserved1; /* Reservation of some values for the TM ABI. */ void *__private_tm[4]; /* GCC split stack support. */ void *__private_ss; } tcbhead_t; The offset of __private_ss is 0x34. But GCC defines /* We steal the last transactional memory word. */ #define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30 and libgcc/config/i386/morestack.S has cmpl %gs:0x30,%eax # See if we have enough space. movl %eax,%gs:0x30 # Save the new stack boundary. movl %eax,%gs:0x30 # Save the new stack boundary. movl %ecx,%gs:0x30 # Save new stack boundary. movl %eax,%gs:0x30 movl %gs:0x30,%eax movl %eax,%gs:0x30 Since update TARGET_THREAD_SPLIT_STACK_OFFSET changes split stack ABI, this patch updates tcbhead_t to match GCC. [BZ #23250] [BZ #10686] * sysdeps/i386/nptl/tls.h (tcbhead_t): Change __private_tm[4] to _private_tm[3] and add __glibc_reserved2. Add _Static_assert of offset of __private_ss == 0x30. * sysdeps/x86_64/nptl/tls.h: Add _Static_assert of offset of __private_ss == 0x40 for ILP32 and == 0x70 for LP64.
* x86: Make strncmp usable from rtldFlorian Weimer2018-06-121-1/+1
| | | | | | | | | Due to the way the conditions were written, the rtld build of strncmp ended up with no definition of the strncmp symbol at all: The implementations were renamed for use within an IFUNC resolver, but the IFUNC resolver itself was missing (because rtld does not use IFUNCs). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Mark _init and _fini as hidden [BZ #23145]H.J. Lu2018-06-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _init and _fini are special functions provided by glibc for linker to define DT_INIT and DT_FINI in executable and shared library. They should never be put in dynamic symbol table. This patch marks them as hidden to remove them from dynamic symbol table. Tested with build-many-glibcs.py. [BZ #23145] * elf/Makefile (tests-special): Add $(objpfx)check-initfini.out. ($(all-built-dso:=.dynsym): New target. (common-generated): Add $(all-built-dso:$(common-objpfx)%=%.dynsym). ($(objpfx)check-initfini.out): New target. (generated): Add check-initfini.out. * scripts/check-initfini.awk: New file. * sysdeps/aarch64/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/alpha/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/arm/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/hppa/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/i386/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/ia64/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/m68k/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/microblaze/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/mips/mips32/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/mips/mips64/n32/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/mips/mips64/n64/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/nios2/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/powerpc/powerpc32/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/powerpc/powerpc64/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/s390/s390-32/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/s390/s390-64/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/sh/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/sparc/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/x86_64/crti.S (_init): Mark as hidden. (_fini): Likewise.
* math: Update i686 ulps (--disable-multi-arch configuration)Florian Weimer2018-06-011-278/+294
| | | | | | The results are from configuring with --disable-multi-arch, building with “-march=x86-64 -mtune=generic -mfpmath=sse” and running the testsuite on a Haswell-era CPU.
* math: Update i686 ulpsFlorian Weimer2018-06-011-270/+278
| | | | | The results are from building with “-march=x86-64 -mtune=generic -mfpmath=sse” and running the testsuite on a Haswell-era CPU.
* i386: Drop -mpreferred-stack-boundary=4Florian Weimer2018-05-222-43/+1
| | | | | The flag was a left-over from when the -mpreferred-stack-boundary=2 flag was removed in commit db290cf59207aff09d1794e666e2854a93775f32.
* nptl: Remove __ASSUME_PRIVATE_FUTEXH.J. Lu2018-05-172-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since __ASSUME_PRIVATE_FUTEX is always defined, this patch removes the !__ASSUME_PRIVATE_FUTEX paths. Tested with build-many-glibcs.py. * nptl/allocatestack.c (allocate_stack): Remove the !__ASSUME_PRIVATE_FUTEX paths. * nptl/descr.h (header): Remove the !__ASSUME_PRIVATE_FUTEX path. * nptl/nptl-init.c (__pthread_initialize_minimal_internal): Likewise. * sysdeps/i386/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Removed. * sysdeps/powerpc/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise. * sysdeps/sh/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise. * sysdeps/x86_64/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise. * sysdeps/i386/nptl/tls.h: (tcbhead_t): Remve the !__ASSUME_PRIVATE_FUTEX path. * sysdeps/s390/nptl/tls.h (tcbhead_t): Likewise. * sysdeps/sparc/nptl/tls.h (tcbhead_t): Likewise. * sysdeps/x86_64/nptl/tls.h (tcbhead_t): Likewise. * sysdeps/unix/sysv/linux/i386/lowlevellock.S: Remove the !__ASSUME_PRIVATE_FUTEX macros. * sysdeps/unix/sysv/linux/lowlevellock-futex.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/cancellation.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_PRIVATE_FUTEX): Removed.
* Add narrowing divide functions.Joseph Myers2018-05-171-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the narrowing divide functions from TS 18661-1 to glibc's libm: fdiv, fdivl, ddivl, f32divf64, f32divf32x, f32xdivf64 for all configurations; f32divf64x, f32divf128, f64divf64x, f64divf128, f32xdivf64x, f32xdivf128, f64xdivf128 for configurations with _Float64x and _Float128; __nldbl_ddivl for ldbl-opt. The changes are mostly essentially the same as for the other narrowing functions, so the description of those generally applies to this patch as well. Tested for x86_64, x86, mips64 (all three ABIs, both hard and soft float) and powerpc, and with build-many-glibcs.py. * math/Makefile (libm-narrow-fns): Add div. (libm-test-funcs-narrow): Likewise. * math/Versions (GLIBC_2.28): Add narrowing divide functions. * math/bits/mathcalls-narrow.h (div): Use __MATHCALL_NARROW. * math/gen-auto-libm-tests.c (test_functions): Add div. * math/math-narrow.h (CHECK_NARROW_DIV): New macro. (NARROW_DIV_ROUND_TO_ODD): Likewise. (NARROW_DIV_TRIVIAL): Likewise. * sysdeps/ieee754/float128/float128_private.h (__fdivl): New macro. (__ddivl): Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fdiv and ddiv. (CFLAGS-nldbl-ddiv.c): New variable. (CFLAGS-nldbl-fdiv.c): Likewise. * sysdeps/ieee754/ldbl-opt/Versions (GLIBC_2.28): Add __nldbl_ddivl. * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl_ddivl): New prototype. * manual/arith.texi (Misc FP Arithmetic): Document fdiv, fdivl, ddivl, fMdivfN, fMdivfNx, fMxdivfN and fMxdivfNx. * math/auto-libm-test-in: Add tests of div. * math/auto-libm-test-out-narrow-div: New generated file. * math/libm-test-narrow-div.inc: New file. * sysdeps/i386/fpu/s_f32xdivf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_f32xdivf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_fdiv.c: Likewise. * sysdeps/ieee754/float128/s_f32divf128.c: Likewise. * sysdeps/ieee754/float128/s_f64divf128.c: Likewise. * sysdeps/ieee754/float128/s_f64xdivf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_ddivl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_f64xdivf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fdivl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_ddivl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fdivl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_ddivl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fdivl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-ddiv.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-fdiv.c: Likewise. * sysdeps/ieee754/soft-fp/s_ddivl.c: Likewise. * sysdeps/ieee754/soft-fp/s_fdiv.c: Likewise. * sysdeps/ieee754/soft-fp/s_fdivl.c: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Update. * sysdeps/mach/hurd/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * 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/riscv/rv64/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/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Add narrowing multiply functions.Joseph Myers2018-05-161-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the narrowing multiply functions from TS 18661-1 to glibc's libm: fmul, fmull, dmull, f32mulf64, f32mulf32x, f32xmulf64 for all configurations; f32mulf64x, f32mulf128, f64mulf64x, f64mulf128, f32xmulf64x, f32xmulf128, f64xmulf128 for configurations with _Float64x and _Float128; __nldbl_dmull for ldbl-opt. The changes are mostly essentially the same as for the narrowing add functions, so the description of those generally applies to this patch as well. f32xmulf64 for i386 cannot use precision control as used for add and subtract, because that would result in double rounding for subnormal results, so that uses round-to-odd with long double intermediate result instead. The soft-fp support involves adding a new FP_TRUNC_COOKED since soft-fp multiplication uses cooked inputs and outputs. Tested for x86_64, x86, mips64 (all three ABIs, both hard and soft float) and powerpc, and with build-many-glibcs.py. * math/Makefile (libm-narrow-fns): Add mul. (libm-test-funcs-narrow): Likewise. * math/Versions (GLIBC_2.28): Add narrowing multiply functions. * math/bits/mathcalls-narrow.h (mul): Use __MATHCALL_NARROW. * math/gen-auto-libm-tests.c (test_functions): Add mul. * math/math-narrow.h (CHECK_NARROW_MUL): New macro. (NARROW_MUL_ROUND_TO_ODD): Likewise. (NARROW_MUL_TRIVIAL): Likewise. * soft-fp/op-common.h (FP_TRUNC_COOKED): Likewise. * sysdeps/ieee754/float128/float128_private.h (__fmull): New macro. (__dmull): Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fmul and dmul. (CFLAGS-nldbl-dmul.c): New variable. (CFLAGS-nldbl-fmul.c): Likewise. * sysdeps/ieee754/ldbl-opt/Versions (GLIBC_2.28): Add __nldbl_dmull. * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl_dmull): New prototype. * manual/arith.texi (Misc FP Arithmetic): Document fmul, fmull, dmull, fMmulfN, fMmulfNx, fMxmulfN and fMxmulfNx. * math/auto-libm-test-in: Add tests of mul. * math/auto-libm-test-out-narrow-mul: New generated file. * math/libm-test-narrow-mul.inc: New file. * sysdeps/i386/fpu/s_f32xmulf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_f32xmulf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_fmul.c: Likewise. * sysdeps/ieee754/float128/s_f32mulf128.c: Likewise. * sysdeps/ieee754/float128/s_f64mulf128.c: Likewise. * sysdeps/ieee754/float128/s_f64xmulf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_dmull.c: Likewise. * sysdeps/ieee754/ldbl-128/s_f64xmulf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fmull.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_dmull.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fmull.c: Likewise. * sysdeps/ieee754/ldbl-96/s_dmull.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fmull.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-dmul.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-fmul.c: Likewise. * sysdeps/ieee754/soft-fp/s_dmull.c: Likewise. * sysdeps/ieee754/soft-fp/s_fmul.c: Likewise. * sysdeps/ieee754/soft-fp/s_fmull.c: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Update. * sysdeps/mach/hurd/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * 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/riscv/rv64/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/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* i386: Replace PREINIT_FUNCTION@PLT with *%eax in callH.J. Lu2018-05-141-1/+1
| | | | | | | | | | Since we have loaded address of PREINIT_FUNCTION into %eax, we can avoid extra branch to PLT slot. * sysdeps/i386/crti.S (_init): Replace PREINIT_FUNCTION@PLT with *%eax in call. Acked-by: Christian Brauner (Ubuntu) <christian@brauner.io>
* x86: Add sysdeps/x86/ldsodefs.hH.J. Lu2018-05-141-41/+0
| | | | | | | | | | | | | | | | | Merge sysdeps/i386/ldsodefs.h and sysdeps/x86_64/ldsodefs.h into sysdeps/x86/ldsodefs.h. Tested on i686 and x86-64. * sysdeps/i386/ldsodefs.h: Removed. * sysdeps/x86_64/ldsodefs.h: Moved to ... * sysdeps/x86/ldsodefs.h: This. (La_i86_regs): New. (La_i86_retval): Likewise. (ARCH_PLTENTER_MEMBERS): Add i86_gnu_pltenter. (ARCH_PLTEXIT_MEMBERS): i86_gnu_pltexit. Acked-by: Christian Brauner (Ubuntu) christian@brauner.io
* Do not include math-barriers.h in math_private.h.Joseph Myers2018-05-113-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch continues the math_private.h cleanup by stopping math_private.h from including math-barriers.h and making the users of the barrier macros include the latter header directly. No attempt is made to remove any math_private.h includes that are now unused, except in strtod_l.c where that is done to avoid line number changes in assertions, so that installed stripped shared libraries can be compared before and after the patch. (I think the floating-point environment support in math_private.h should also move out - some architectures already have fenv_private.h as an architecture-internal header included from their math_private.h - and after moving that out might be a better time to identify unused math_private.h includes.) Tested for x86_64 and x86, and tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/generic/math_private.h: Do not include <math-barriers.h>. * stdlib/strtod_l.c: Include <math-barriers.h> instead of <math_private.h>. * math/fromfp.h: Include <math-barriers.h>. * math/math-narrow.h: Likewise. * math/s_nextafter.c: Likewise. * math/s_nexttowardf.c: Likewise. * sysdeps/aarch64/fpu/s_llrint.c: Likewise. * sysdeps/aarch64/fpu/s_llrintf.c: Likewise. * sysdeps/aarch64/fpu/s_lrint.c: Likewise. * sysdeps/aarch64/fpu/s_lrintf.c: Likewise. * sysdeps/i386/fpu/s_nextafterl.c: Likewise. * sysdeps/i386/fpu/s_nexttoward.c: Likewise. * sysdeps/i386/fpu/s_nexttowardf.c: Likewise. * sysdeps/ieee754/dbl-64/e_atan2.c: Likewise. * sysdeps/ieee754/dbl-64/e_atanh.c: Likewise. * sysdeps/ieee754/dbl-64/e_exp.c: Likewise. * sysdeps/ieee754/dbl-64/e_exp2.c: Likewise. * sysdeps/ieee754/dbl-64/e_j0.c: Likewise. * sysdeps/ieee754/dbl-64/e_sqrt.c: Likewise. * sysdeps/ieee754/dbl-64/s_expm1.c: Likewise. * sysdeps/ieee754/dbl-64/s_fma.c: Likewise. * sysdeps/ieee754/dbl-64/s_fmaf.c: Likewise. * sysdeps/ieee754/dbl-64/s_log1p.c: Likewise. * sysdeps/ieee754/dbl-64/s_nearbyint.c: Likewise. * sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c: Likewise. * sysdeps/ieee754/flt-32/e_atanhf.c: Likewise. * sysdeps/ieee754/flt-32/e_j0f.c: Likewise. * sysdeps/ieee754/flt-32/s_expm1f.c: Likewise. * sysdeps/ieee754/flt-32/s_log1pf.c: Likewise. * sysdeps/ieee754/flt-32/s_nearbyintf.c: Likewise. * sysdeps/ieee754/flt-32/s_nextafterf.c: Likewise. * sysdeps/ieee754/k_standardl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_asinl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_expl.c: Likewise. * sysdeps/ieee754/ldbl-128/e_powl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fmal.c: Likewise. * sysdeps/ieee754/ldbl-128/s_nearbyintl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_nextafterl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_nexttoward.c: Likewise. * sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/e_asinl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fmal.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise. * sysdeps/ieee754/ldbl-96/e_atanhl.c: Likewise. * sysdeps/ieee754/ldbl-96/e_j0l.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fma.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fmal.c: Likewise. * sysdeps/ieee754/ldbl-96/s_nexttoward.c: Likewise. * sysdeps/ieee754/ldbl-96/s_nexttowardf.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c: Likewise. * sysdeps/m68k/m680x0/fpu/s_nextafterl.c: Likewise.
* Move math_opt_barrier, math_force_eval to separate math-barriers.h.Joseph Myers2018-05-091-39/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch continues cleaning up math_private.h by moving the math_opt_barrier and math_force_eval macros to a separate header math-barriers.h. At present, those macros are inside a "#ifndef math_opt_barrier" in math_private.h to allow architectures to override them and then use a separate math-barriers.h header, no such #ifndef or #include_next is needed; architectures just have their own alternative version of math-barriers.h when providing their own optimized versions that avoid going through memory unnecessarily. The generic math-barriers.h has a comment added to document these two macros. In this patch, math_private.h is made to #include <math-barriers.h>, so files using these macros do not need updating yet. That is because of uses of math_force_eval in math_check_force_underflow and math_check_force_underflow_nonneg, which are still defined in math_private.h. Once those are moved out to a separate header, that separate header can be made to include <math-barriers.h>, as can the other files directly using these barrier macros, and then the include of <math-barriers.h> from math_private.h can be removed. Tested for x86_64 and x86. Also tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch. * sysdeps/generic/math-barriers.h: New file. * sysdeps/generic/math_private.h [!math_opt_barrier] (math_opt_barrier): Move to math-barriers.h. [!math_opt_barrier] (math_force_eval): Likewise. * sysdeps/aarch64/fpu/math-barriers.h: New file. * sysdeps/aarch64/fpu/math_private.h (math_opt_barrier): Move to math-barriers.h. (math_force_eval): Likewise. * sysdeps/alpha/fpu/math-barriers.h: New file. * sysdeps/alpha/fpu/math_private.h (math_opt_barrier): Move to math-barriers.h. (math_force_eval): Likewise. * sysdeps/x86/fpu/math-barriers.h: New file. * sysdeps/i386/fpu/fenv_private.h (math_opt_barrier): Move to math-barriers.h. (math_force_eval): Likewise. * sysdeps/m68k/m680x0/fpu/math_private.h: Move to.... * sysdeps/m68k/m680x0/fpu/math-barriers.h: ... here. Adjust multiple-include guard for rename. * sysdeps/powerpc/fpu/math-barriers.h: New file. * sysdeps/powerpc/fpu/math_private.h (math_opt_barrier): Move to math-barriers.h. (math_force_eval): Likewise.
* Move math_narrow_eval to separate math-narrow-eval.h.Joseph Myers2018-05-093-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch continues cleaning up the math_private.h header, which contains lots of different definitions many of which are only needed by a limited subset of files using that header (and some of which are overridden by architectures that only want to override selected parts of the header), by moving the math_narrow_eval macro out to a separate math-narrow-eval.h header, only included by those files that need it. That header is placed in include/ (since it's used in stdlib/, not just files built in math/, but no sysdeps variants are needed at present). Tested for x86_64, and with build-many-glibcs.py. (Installed stripped shared libraries change because of line numbers in assertions in strtod_l.c.) * include/math-narrow-eval.h: New file. Contents moved from .... * sysdeps/generic/math_private.h: ... here. (math_narrow_eval): Remove macro. Moved to math-narrow-eval.h. [FLT_EVAL_METHOD != 0] (excess_precision): Likewise. * math/s_fdim_template.c: Include <math-narrow-eval.h>. * stdlib/strtod_l.c: Likewise. * sysdeps/i386/fpu/s_f32xaddf64.c: Likewise. * sysdeps/i386/fpu/s_f32xsubf64.c: Likewise. * sysdeps/i386/fpu/s_fdim.c: Likewise. * sysdeps/ieee754/dbl-64/e_cosh.c: Likewise. * sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise. * sysdeps/ieee754/dbl-64/e_j1.c: Likewise. * sysdeps/ieee754/dbl-64/e_jn.c: Likewise. * sysdeps/ieee754/dbl-64/e_lgamma_r.c: Likewise. * sysdeps/ieee754/dbl-64/e_sinh.c: Likewise. * sysdeps/ieee754/dbl-64/gamma_productf.c: Likewise. * sysdeps/ieee754/dbl-64/k_rem_pio2.c: Likewise. * sysdeps/ieee754/dbl-64/lgamma_neg.c: Likewise. * sysdeps/ieee754/dbl-64/s_erf.c: Likewise. * sysdeps/ieee754/dbl-64/s_llrint.c: Likewise. * sysdeps/ieee754/dbl-64/s_lrint.c: Likewise. * sysdeps/ieee754/flt-32/e_coshf.c: Likewise. * sysdeps/ieee754/flt-32/e_exp2f.c: Likewise. * sysdeps/ieee754/flt-32/e_expf.c: Likewise. * sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise. * sysdeps/ieee754/flt-32/e_j1f.c: Likewise. * sysdeps/ieee754/flt-32/e_jnf.c: Likewise. * sysdeps/ieee754/flt-32/e_lgammaf_r.c: Likewise. * sysdeps/ieee754/flt-32/e_sinhf.c: Likewise. * sysdeps/ieee754/flt-32/k_rem_pio2f.c: Likewise. * sysdeps/ieee754/flt-32/lgamma_negf.c: Likewise. * sysdeps/ieee754/flt-32/s_erff.c: Likewise. * sysdeps/ieee754/flt-32/s_llrintf.c: Likewise. * sysdeps/ieee754/flt-32/s_lrintf.c: Likewise. * sysdeps/ieee754/ldbl-96/gamma_product.c: Likewise.
* Drop fpregset unused symbol expositionSamuel Thibault2018-04-201-1/+1
| | | | | | | | | * sysdeps/arm/sys/ucontext.h: Remove fpregset struct name, unused and non-compliant. * sysdeps/i386/sys/ucontext.h: Likewise. * sysdeps/m68k/sys/ucontext.h: Likewise. * sysdeps/mips/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Likewise.
* Update i386 libm-test-ulps.Adhemerval Zanella2018-04-061-4/+10
| | | | | | | | Updated ulps after recent commit "[PATCH 1/7] sin/cos slow paths: avoid slow paths for small inputs" (19a8b9a300f2f1f0012aff0f2b70b09430f50d9e). * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Update.
* elf: Unify symbol address run-time calculation [BZ #19818]Maciej W. Rozycki2018-04-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wrap symbol address run-time calculation into a macro and use it throughout, replacing inline calculations. There are a couple of variants, most of them different in a functionally insignificant way. Most calculations are right following RESOLVE_MAP, at which point either the map or the symbol returned can be checked for validity as the macro sets either both or neither. In some places both the symbol and the map has to be checked however. My initial implementation therefore always checked both, however that resulted in code larger by as much as 0.3%, as many places know from elsewhere that no check is needed. I have decided the size growth was unacceptable. Having looked closer I realized that it's the map that is the culprit. Therefore I have modified LOOKUP_VALUE_ADDRESS to accept an additional boolean argument telling it to access the map without checking it for validity. This in turn has brought quite nice results, with new code actually being smaller for i686, and MIPS o32, n32 and little-endian n64 targets, unchanged in size for x86-64 and, unusually, marginally larger for big-endian MIPS n64, as follows: i686: text data bss dec hex filename 152255 4052 192 156499 26353 ld-2.27.9000-base.so 152159 4052 192 156403 262f3 ld-2.27.9000-elf-symbol-value.so MIPS/o32/el: text data bss dec hex filename 142906 4396 260 147562 2406a ld-2.27.9000-base.so 142890 4396 260 147546 2405a ld-2.27.9000-elf-symbol-value.so MIPS/n32/el: text data bss dec hex filename 142267 4404 260 146931 23df3 ld-2.27.9000-base.so 142171 4404 260 146835 23d93 ld-2.27.9000-elf-symbol-value.so MIPS/n64/el: text data bss dec hex filename 149835 7376 408 157619 267b3 ld-2.27.9000-base.so 149787 7376 408 157571 26783 ld-2.27.9000-elf-symbol-value.so MIPS/o32/eb: text data bss dec hex filename 142870 4396 260 147526 24046 ld-2.27.9000-base.so 142854 4396 260 147510 24036 ld-2.27.9000-elf-symbol-value.so MIPS/n32/eb: text data bss dec hex filename 142019 4404 260 146683 23cfb ld-2.27.9000-base.so 141923 4404 260 146587 23c9b ld-2.27.9000-elf-symbol-value.so MIPS/n64/eb: text data bss dec hex filename 149763 7376 408 157547 2676b ld-2.27.9000-base.so 149779 7376 408 157563 2677b ld-2.27.9000-elf-symbol-value.so x86-64: text data bss dec hex filename 148462 6452 400 155314 25eb2 ld-2.27.9000-base.so 148462 6452 400 155314 25eb2 ld-2.27.9000-elf-symbol-value.so [BZ #19818] * sysdeps/generic/ldsodefs.h (LOOKUP_VALUE_ADDRESS): Add `set' parameter. (SYMBOL_ADDRESS): New macro. [!ELF_FUNCTION_PTR_IS_SPECIAL] (DL_SYMBOL_ADDRESS): Use SYMBOL_ADDRESS for symbol address calculation. * elf/dl-runtime.c (_dl_fixup): Likewise. (_dl_profile_fixup): Likewise. * elf/dl-symaddr.c (_dl_symbol_address): Likewise. * elf/rtld.c (dl_main): Likewise. * sysdeps/aarch64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/alpha/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/arm/dl-machine.h (elf_machine_rel): Likewise. (elf_machine_rela): Likewise. * sysdeps/hppa/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Likewise. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. (elf_machine_rela): Likewise. * sysdeps/ia64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/m68k/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/microblaze/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/mips/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC): Likewise. (elf_machine_reloc): Likewise. (elf_machine_got_rel): Likewise. * sysdeps/mips/dl-trampoline.c (__dl_runtime_resolve): Likewise. * sysdeps/nios2/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/riscv/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/s390/s390-64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/sh/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/tile/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* hurd: Bump remaining LGPL2+ htl licences to LGPL 2.1+Samuel Thibault2018-04-021-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * htl/Makefile: Bump licence to LGPL 2.1+. * htl/alloca_cutoff.c: Likewise. * htl/cthreads-compat.c: Likewise. * htl/lockfile.c: Likewise. * htl/pt-alloc.c: Likewise. * htl/pt-cancel.c: Likewise. * htl/pt-cleanup.c: Likewise. * htl/pt-create.c: Likewise. * htl/pt-dealloc.c: Likewise. * htl/pt-detach.c: Likewise. * htl/pt-exit.c: Likewise. * htl/pt-getattr.c: Likewise. * htl/pt-initialize.c: Likewise. * htl/pt-internal.h: Likewise. * htl/pt-join.c: Likewise. * htl/pt-self.c: Likewise. * htl/pt-setcancelstate.c: Likewise. * htl/pt-setcanceltype.c: Likewise. * htl/pt-sigmask.c: Likewise. * htl/pt-spin-inlines.c: Likewise. * htl/pt-testcancel.c: Likewise. * htl/pt-yield.c: Likewise. * htl/tests/test-1.c: Likewise. * htl/tests/test-10.c: Likewise. * htl/tests/test-11.c: Likewise. * htl/tests/test-12.c: Likewise. * htl/tests/test-13.c: Likewise. * htl/tests/test-14.c: Likewise. * htl/tests/test-15.c: Likewise. * htl/tests/test-16.c: Likewise. * htl/tests/test-17.c: Likewise. * htl/tests/test-2.c: Likewise. * htl/tests/test-3.c: Likewise. * htl/tests/test-4.c: Likewise. * htl/tests/test-5.c: Likewise. * htl/tests/test-6.c: Likewise. * htl/tests/test-7.c: Likewise. * htl/tests/test-8.c: Likewise. * htl/tests/test-9.c: Likewise. * htl/tests/test-__pthread_destroy_specific-skip.c: Likewise. * sysdeps/htl/bits/cancelation.h: Likewise. * sysdeps/htl/bits/pthread-np.h: Likewise. * sysdeps/htl/bits/pthread.h: Likewise. * sysdeps/htl/bits/pthreadtypes.h: Likewise. * sysdeps/htl/bits/semaphore.h: Likewise. * sysdeps/htl/bits/types/__pthread_key.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_attr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_barrier.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_barrierattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_cond.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_condattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_mutex.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_mutexattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_once.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_rwlock.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_rwlockattr.h: Likewise. * sysdeps/htl/old_pt-atfork.c: Likewise. * sysdeps/htl/pt-atfork.c: Likewise. * sysdeps/htl/pt-attr-destroy.c: Likewise. * sysdeps/htl/pt-attr-getdetachstate.c: Likewise. * sysdeps/htl/pt-attr-getguardsize.c: Likewise. * sysdeps/htl/pt-attr-getinheritsched.c: Likewise. * sysdeps/htl/pt-attr-getschedparam.c: Likewise. * sysdeps/htl/pt-attr-getschedpolicy.c: Likewise. * sysdeps/htl/pt-attr-getscope.c: Likewise. * sysdeps/htl/pt-attr-getstack.c: Likewise. * sysdeps/htl/pt-attr-getstackaddr.c: Likewise. * sysdeps/htl/pt-attr-getstacksize.c: Likewise. * sysdeps/htl/pt-attr-init.c: Likewise. * sysdeps/htl/pt-attr-setdetachstate.c: Likewise. * sysdeps/htl/pt-attr-setguardsize.c: Likewise. * sysdeps/htl/pt-attr-setinheritsched.c: Likewise. * sysdeps/htl/pt-attr-setschedparam.c: Likewise. * sysdeps/htl/pt-attr-setschedpolicy.c: Likewise. * sysdeps/htl/pt-attr-setscope.c: Likewise. * sysdeps/htl/pt-attr-setstack.c: Likewise. * sysdeps/htl/pt-attr-setstackaddr.c: Likewise. * sysdeps/htl/pt-attr-setstacksize.c: Likewise. * sysdeps/htl/pt-attr.c: Likewise. * sysdeps/htl/pt-barrier-destroy.c: Likewise. * sysdeps/htl/pt-barrier-init.c: Likewise. * sysdeps/htl/pt-barrier-wait.c: Likewise. * sysdeps/htl/pt-barrier.c: Likewise. * sysdeps/htl/pt-barrierattr-destroy.c: Likewise. * sysdeps/htl/pt-barrierattr-getpshared.c: Likewise. * sysdeps/htl/pt-barrierattr-init.c: Likewise. * sysdeps/htl/pt-barrierattr-setpshared.c: Likewise. * sysdeps/htl/pt-cond-brdcast.c: Likewise. * sysdeps/htl/pt-cond-destroy.c: Likewise. * sysdeps/htl/pt-cond-init.c: Likewise. * sysdeps/htl/pt-cond-signal.c: Likewise. * sysdeps/htl/pt-cond-timedwait.c: Likewise. * sysdeps/htl/pt-cond-wait.c: Likewise. * sysdeps/htl/pt-cond.c: Likewise. * sysdeps/htl/pt-condattr-destroy.c: Likewise. * sysdeps/htl/pt-condattr-getclock.c: Likewise. * sysdeps/htl/pt-condattr-getpshared.c: Likewise. * sysdeps/htl/pt-condattr-init.c: Likewise. * sysdeps/htl/pt-condattr-setclock.c: Likewise. * sysdeps/htl/pt-condattr-setpshared.c: Likewise. * sysdeps/htl/pt-destroy-specific.c: Likewise. * sysdeps/htl/pt-equal.c: Likewise. * sysdeps/htl/pt-getconcurrency.c: Likewise. * sysdeps/htl/pt-getcpuclockid.c: Likewise. * sysdeps/htl/pt-getschedparam.c: Likewise. * sysdeps/htl/pt-getspecific.c: Likewise. * sysdeps/htl/pt-init-specific.c: Likewise. * sysdeps/htl/pt-key-create.c: Likewise. * sysdeps/htl/pt-key-delete.c: Likewise. * sysdeps/htl/pt-key.h: Likewise. * sysdeps/htl/pt-mutex-destroy.c: Likewise. * sysdeps/htl/pt-mutex-getprioceiling.c: Likewise. * sysdeps/htl/pt-mutex-init.c: Likewise. * sysdeps/htl/pt-mutex-lock.c: Likewise. * sysdeps/htl/pt-mutex-setprioceiling.c: Likewise. * sysdeps/htl/pt-mutex-timedlock.c: Likewise. * sysdeps/htl/pt-mutex-trylock.c: Likewise. * sysdeps/htl/pt-mutex-unlock.c: Likewise. * sysdeps/htl/pt-mutexattr-destroy.c: Likewise. * sysdeps/htl/pt-mutexattr-getprioceiling.c: Likewise. * sysdeps/htl/pt-mutexattr-getprotocol.c: Likewise. * sysdeps/htl/pt-mutexattr-getpshared.c: Likewise. * sysdeps/htl/pt-mutexattr-gettype.c: Likewise. * sysdeps/htl/pt-mutexattr-init.c: Likewise. * sysdeps/htl/pt-mutexattr-setprioceiling.c: Likewise. * sysdeps/htl/pt-mutexattr-setprotocol.c: Likewise. * sysdeps/htl/pt-mutexattr-setpshared.c: Likewise. * sysdeps/htl/pt-mutexattr-settype.c: Likewise. * sysdeps/htl/pt-mutexattr.c: Likewise. * sysdeps/htl/pt-once.c: Likewise. * sysdeps/htl/pt-rwlock-attr.c: Likewise. * sysdeps/htl/pt-rwlock-destroy.c: Likewise. * sysdeps/htl/pt-rwlock-init.c: Likewise. * sysdeps/htl/pt-rwlock-rdlock.c: Likewise. * sysdeps/htl/pt-rwlock-timedrdlock.c: Likewise. * sysdeps/htl/pt-rwlock-timedwrlock.c: Likewise. * sysdeps/htl/pt-rwlock-tryrdlock.c: Likewise. * sysdeps/htl/pt-rwlock-trywrlock.c: Likewise. * sysdeps/htl/pt-rwlock-unlock.c: Likewise. * sysdeps/htl/pt-rwlock-wrlock.c: Likewise. * sysdeps/htl/pt-rwlockattr-destroy.c: Likewise. * sysdeps/htl/pt-rwlockattr-getpshared.c: Likewise. * sysdeps/htl/pt-rwlockattr-init.c: Likewise. * sysdeps/htl/pt-rwlockattr-setpshared.c: Likewise. * sysdeps/htl/pt-setconcurrency.c: Likewise. * sysdeps/htl/pt-setschedparam.c: Likewise. * sysdeps/htl/pt-setschedprio.c: Likewise. * sysdeps/htl/pt-setspecific.c: Likewise. * sysdeps/htl/pt-spin.c: Likewise. * sysdeps/htl/pt-startup.c: Likewise. * sysdeps/htl/pthread.h: Likewise. * sysdeps/htl/sem-close.c: Likewise. * sysdeps/htl/sem-destroy.c: Likewise. * sysdeps/htl/sem-getvalue.c: Likewise. * sysdeps/htl/sem-init.c: Likewise. * sysdeps/htl/sem-open.c: Likewise. * sysdeps/htl/sem-post.c: Likewise. * sysdeps/htl/sem-timedwait.c: Likewise. * sysdeps/htl/sem-trywait.c: Likewise. * sysdeps/htl/sem-unlink.c: Likewise. * sysdeps/htl/sem-wait.c: Likewise. * sysdeps/hurd/htl/pt-kill.c: Likewise. * sysdeps/i386/htl/pt-machdep.h: Likewise. * sysdeps/mach/htl/pt-block.c: Likewise. * sysdeps/mach/htl/pt-spin.c: Likewise. * sysdeps/mach/htl/pt-stack-alloc.c: Likewise. * sysdeps/mach/htl/pt-thread-alloc.c: Likewise. * sysdeps/mach/htl/pt-thread-start.c: Likewise. * sysdeps/mach/htl/pt-thread-terminate.c: Likewise. * sysdeps/mach/htl/pt-timedblock.c: Likewise. * sysdeps/mach/htl/pt-wakeup.c: Likewise. * sysdeps/mach/hurd/htl/bits/pthread-np.h: Likewise. * sysdeps/mach/hurd/htl/bits/types/struct___pthread_mutex.h: Likewise. * sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c: Likewise. * sysdeps/mach/hurd/htl/pt-attr-setstacksize.c: Likewise. * sysdeps/mach/hurd/htl/pt-docancel.c: Likewise. * sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c: Likewise. * sysdeps/mach/hurd/htl/pt-hurd-cond-wait.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-consistent.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-getprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-lock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-setprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-timedlock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-trylock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-unlock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex.h: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getprotocol.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getpshared.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getrobust.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-gettype.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setprotocol.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setpshared.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setrobust.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-settype.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate.c: Likewise. * sysdeps/mach/hurd/htl/pt-sysdep.c: Likewise. * sysdeps/mach/hurd/htl/pt-sysdep.h: Likewise. * sysdeps/mach/hurd/i386/htl/pt-machdep.c: Likewise. * sysdeps/mach/hurd/i386/htl/pt-setup.c: Likewise.
* hurd: Add hurd thread librarySamuel Thibault2018-04-023-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Contributed by Agustina Arzille <avarzille@riseup.net> Amos Jeffries <squid3@treenet.co.nz> David Michael <fedora.dm0@gmail.com> Marco Gerards <marco@gnu.org> Marcus Brinkmann <marcus@gnu.org> Neal H. Walfield <neal@gnu.org> Pino Toscano <toscano.pino@tiscali.it> Richard Braun <rbraun@sceen.net> Roland McGrath <roland@gnu.org> Samuel Thibault <samuel.thibault@ens-lyon.org> Thomas DiModica <ricinwich@yahoo.com> Thomas Schwinge <tschwinge@gnu.org> * htl: New directory. * sysdeps/htl: New directory. * sysdeps/hurd/htl: New directory. * sysdeps/i386/htl: New directory. * sysdeps/mach/htl: New directory. * sysdeps/mach/hurd/htl: New directory. * sysdeps/mach/hurd/i386/htl: New directory. * nscd/Depend, resolv/Depend, rt/Depend: Add htl dependency. * sysdeps/mach/hurd/i386/Implies: Add mach/hurd/i386/htl imply. * sysdeps/mach/hurd/i386/libpthread.abilist: New file.
* Fix i386 memmove issue (bug 22644).Andrew Senkevich2018-03-231-6/+6
| | | | | | | [BZ #22644] * sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Fixed branch conditions. * string/test-memmove.c (do_test2): New testcase.
* Add narrowing subtract functions.Joseph Myers2018-03-201-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the narrowing subtract functions from TS 18661-1 to glibc's libm: fsub, fsubl, dsubl, f32subf64, f32subf32x, f32xsubf64 for all configurations; f32subf64x, f32subf128, f64subf64x, f64subf128, f32xsubf64x, f32xsubf128, f64xsubf128 for configurations with _Float64x and _Float128; __nldbl_dsubl for ldbl-opt. The changes are essentially the same as for the narrowing add functions, so the description of those generally applies to this patch as well. Tested for x86_64, x86, mips64 (all three ABIs, both hard and soft float) and powerpc, and with build-many-glibcs.py. * math/Makefile (libm-narrow-fns): Add sub. (libm-test-funcs-narrow): Likewise. * math/Versions (GLIBC_2.28): Add narrowing subtract functions. * math/bits/mathcalls-narrow.h (sub): Use __MATHCALL_NARROW. * math/gen-auto-libm-tests.c (test_functions): Add sub. * math/math-narrow.h (CHECK_NARROW_SUB): New macro. (NARROW_SUB_ROUND_TO_ODD): Likewise. (NARROW_SUB_TRIVIAL): Likewise. * sysdeps/ieee754/float128/float128_private.h (__fsubl): New macro. (__dsubl): Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fsub and dsub. (CFLAGS-nldbl-dsub.c): New variable. (CFLAGS-nldbl-fsub.c): Likewise. * sysdeps/ieee754/ldbl-opt/Versions (GLIBC_2.28): Add __nldbl_dsubl. * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl_dsubl): New prototype. * manual/arith.texi (Misc FP Arithmetic): Document fsub, fsubl, dsubl, fMsubfN, fMsubfNx, fMxsubfN and fMxsubfNx. * math/auto-libm-test-in: Add tests of sub. * math/auto-libm-test-out-narrow-sub: New generated file. * math/libm-test-narrow-sub.inc: New file. * sysdeps/i386/fpu/s_f32xsubf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_f32xsubf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_fsub.c: Likewise. * sysdeps/ieee754/float128/s_f32subf128.c: Likewise. * sysdeps/ieee754/float128/s_f64subf128.c: Likewise. * sysdeps/ieee754/float128/s_f64xsubf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_dsubl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_f64xsubf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_fsubl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_dsubl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_fsubl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_dsubl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_fsubl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-dsub.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-fsub.c: Likewise. * sysdeps/ieee754/soft-fp/s_dsubl.c: Likewise. * sysdeps/ieee754/soft-fp/s_fsub.c: Likewise. * sysdeps/ieee754/soft-fp/s_fsubl.c: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Update. * sysdeps/mach/hurd/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * 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/riscv/rv64/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/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Update i386 libm-test-ulps.Joseph Myers2018-03-162-24/+24
| | | | | | | | | I found the i386 libm-test-ulps files needed updating (probably the sqrt changes perturbed exactly when excess precision was used by the compiler). * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
* Add support for sqrt asm redirectsWilco Dijkstra2018-03-152-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch series cleans up the many uses of __ieee754_sqrt(f/l) in GLIBC. The goal is to enable GCC to do the inlining, and if this fails call the __ieee754_sqrt function. This is done by internally declaring sqrt with asm redirects. The compat symbols and sqrt wrappers need to disable the redirect. The redirect is also disabled if there are already redirects defined when using -ffinite-math-only. All math functions (but not math tests, non-library code and libnldbl) are built with -fno-math-errno which means GCC will typically inline sqrt as a single instruction. This means targets are no longer forced to add a special inline for sqrt. * include/math.h (sqrt): Declare with asm redirect. (sqrtf): Likewise. (sqrtl): Likewise. (sqrtf128): Likewise. * Makeconfig: Add -fno-math-errno for libc/libm, but build testsuite, nonlib and libnldbl with -fmath-errno. * math/w_sqrt_compat.c: Define NO_MATH_REDIRECT. * math/w_sqrt_template.c: Likewise. * math/w_sqrtf_compat.c: Likewise. * math/w_sqrtl_compat.c: Likewise. * sysdeps/i386/fpu/w_sqrt.c: Likewise. * sysdeps/i386/fpu/w_sqrt_compat.c: Likewise. * sysdeps/generic/math-type-macros-float128.h: Remove math.h and complex.h.
* hurd: add gscope supportSamuel Thibault2018-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * elf/dl-support.c [!THREAD_GSCOPE_IN_TCB] (_dl_thread_gscope_count): Define variable. * sysdeps/generic/ldsodefs.h [!THREAD_GSCOPE_IN_TCB] (struct rtld_global): Add _dl_thread_gscope_count member. * sysdeps/mach/hurd/tls.h: Include <atomic.h>. [!defined __ASSEMBLER__] (THREAD_GSCOPE_GLOBAL, THREAD_GSCOPE_SET_FLAG, THREAD_GSCOPE_RESET_FLAG, THREAD_GSCOPE_WAIT): Define macros. * sysdeps/generic/tls.h: Document THREAD_GSCOPE_IN_TCB. * sysdeps/aarch64/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/alpha/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/arm/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/hppa/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/i386/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/ia64/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/m68k/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/microblaze/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/mips/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/nios2/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/powerpc/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/riscv/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/s390/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/sh/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/sparc/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/tile/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1. * sysdeps/x86_64/nptl/tls.h: Define THREAD_GSCOPE_IN_TCB to 1.
* Fix i386 fenv_private.h float128 for 32-bit --with-fpmath=sse (bug 22902).Joseph Myers2018-02-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in bug 22902, the i386 fenv_private.h implementation has problems for float128 for the case of 32-bit glibc built with libgcc from GCC configured using --with-fpmath=sse. The optimized floating-point state handling in fenv_private.h needs to know which floating-point state - x87 or SSE - is used for each floating-point type, so that only one state needs updating / testing for libm code using that state internally. On 32-bit x86, the x87 rounding mode is always used for float128, but the x87 exception flags are only used when libgcc is built using x87 floating-point arithmetic; if libgcc is built for SSE arithmetic, the SSE exception flags are used. The choice of arithmetic with which libgcc is built is independent of that with which glibc is built. Thus, since glibc cannot tell the choice used in libgcc, the default implementations of libc_feholdexcept_setroundf128 and libc_feupdateenv_testf128 (which use the <fenv.h> functions, thus using both x87 and SSE state on processors that have both) need to be used; this patch updates the code accordingly. Tested for 32-bit x86; HJ reports testing in the --with-fpmath=sse case. [BZ #22902] * sysdeps/i386/fpu/fenv_private.h [!__x86_64__] (libc_feholdexcept_setroundf128): New macro. [!__x86_64__] (libc_feupdateenv_testf128): Likewise.
* Remove mplog and mpexpWilco Dijkstra2018-02-152-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Remove the now unused mplog and mpexp files. * math/Makefile: Remove mpexp.c and mplog.c * sysdeps/i386/fpu/mpexp.c: Delete file. * sysdeps/i386/fpu/mplog.c: Likewise. * sysdeps/ia64/fpu/mpexp.c: Likewise. * sysdeps/ia64/fpu/mplog.c: Likewise. * sysdeps/ieee754/dbl-64/e_exp.c: Remove mention of mpexp and mplog. * sysdeps/ieee754/dbl-64/mpa.h (__pow_mp): Remove unused function. * sysdeps/ieee754/dbl-64/mpexp.c: Delete file. * sysdeps/ieee754/dbl-64/mplog.c: Likewise. * sysdeps/m68k/m680x0/fpu/mpexp.c: Likewise. * sysdeps/m68k/m680x0/fpu/mplog.c: Likewise. * sysdeps/x86_64/fpu/multiarch/Makefile: Remove mpexp* and mplog*. * sysdeps/x86_64/fpu/multiarch/e_log-avx.c: Remove unused defines. * sysdeps/x86_64/fpu/multiarch/e_log-fma.c: Likewise. * sysdeps/x86_64/fpu/multiarch/e_log-fma4.c: Likewise. * sysdeps/x86_64/fpu/multiarch/mpexp-avx.c: Delete file. * sysdeps/x86_64/fpu/multiarch/mpexp-fma.c: Likewise. * sysdeps/x86_64/fpu/multiarch/mpexp-fma4.c: Likewise. * sysdeps/x86_64/fpu/multiarch/mplog-avx.c: Likewise. * sysdeps/x86_64/fpu/multiarch/mplog-fma.c: Likewise. * sysdeps/x86_64/fpu/multiarch/mplog-fma4.c: Likewise.
* Remove slow paths from expSzabolcs Nagy2018-02-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Remove the __slowexp code, so exp is no longer correctly rounded. The result is computed to about 70 bits precision so the worst case ulp error is about 0.500007 in nearest rounding mode. * manual/probes.texi: Remove slowexp probes. * math/Makefile: Remove slowexp. * sysdeps/generic/math_private.h (__slowexp): Remove. * sysdeps/ieee754/dbl-64/e_exp.c (__ieee754_exp): Remove __slowexp and document error bounds. * sysdeps/i386/fpu/slowexp.c: Remove. * sysdeps/ia64/fpu/slowexp.c: Remove. * sysdeps/ieee754/dbl-64/slowexp.c: Remove. * sysdeps/ieee754/dbl-64/uexp.h (err_0): Remove. * sysdeps/m68k/m680x0/fpu/slowexp.c: Remove. * sysdeps/powerpc/power4/fpu/Makefile (CPPFLAGS-slowexp.c): Remove. * sysdeps/x86_64/fpu/multiarch/Makefile: Remove slowexp-fma. * sysdeps/x86_64/fpu/multiarch/e_exp-avx.c (__slowexp): Remove. * sysdeps/x86_64/fpu/multiarch/e_exp-fma.c (__slowexp): Remove. * sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c (__slowexp): Remove. * sysdeps/x86_64/fpu/multiarch/slowexp-avx.c: Remove. * sysdeps/x86_64/fpu/multiarch/slowexp-fma.c: Remove. * sysdeps/x86_64/fpu/multiarch/slowexp-fma4.c: Remove.
* Remove slow paths from powWilco Dijkstra2018-02-122-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the slow paths from pow. Like several other double precision math functions, pow is exactly rounded. This is not required from math functions and causes major overheads as it requires multiple fallbacks using higher precision arithmetic if a result is close to 0.5ULP. Ridiculous slowdowns of up to 100000x have been reported when the highest precision path triggers. All GLIBC math tests pass on AArch64 and x64 (with ULP of pow set to 1). The worst case error is ~0.506ULP. A simple test over a few hundred million values shows pow is 10% faster on average. This fixes BZ #13932. [BZ #13932] * sysdeps/ieee754/dbl-64/uexp.h (err_1): Remove. * benchtests/pow-inputs: Update comment for slow path cases. * manual/probes.texi (slowpow_p10): Delete removed probe. (slowpow_p10): Likewise. * math/Makefile: Remove halfulp.c and slowpow.c. * sysdeps/aarch64/libm-test-ulps: Set ULP of pow to 1. * sysdeps/generic/math_private.h (__exp1): Remove error argument. (__halfulp): Remove. (__slowpow): Remove. * sysdeps/i386/fpu/halfulp.c: Delete file. * sysdeps/i386/fpu/slowpow.c: Likewise. * sysdeps/ia64/fpu/halfulp.c: Likewise. * sysdeps/ia64/fpu/slowpow.c: Likewise. * sysdeps/ieee754/dbl-64/e_exp.c (__exp1): Remove error argument, improve comments and add error analysis. * sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Add error analysis. (power1): Remove function: (log1): Remove error argument, add error analysis. (my_log2): Remove function. * sysdeps/ieee754/dbl-64/halfulp.c: Delete file. * sysdeps/ieee754/dbl-64/slowpow.c: Likewise. * sysdeps/m68k/m680x0/fpu/halfulp.c: Likewise. * sysdeps/m68k/m680x0/fpu/slowpow.c: Likewise. * sysdeps/powerpc/power4/fpu/Makefile: Remove CPPFLAGS-slowpow.c. * sysdeps/x86_64/fpu/libm-test-ulps: Set ULP of pow to 1. * sysdeps/x86_64/fpu/multiarch/Makefile: Remove slowpow-fma.c, slowpow-fma4.c, halfulp-fma.c, halfulp-fma4.c. * sysdeps/x86_64/fpu/multiarch/e_pow-fma.c (__slowpow): Remove define. * sysdeps/x86_64/fpu/multiarch/e_pow-fma4.c (__slowpow): Likewise. * sysdeps/x86_64/fpu/multiarch/halfulp-fma.c: Delete file. * sysdeps/x86_64/fpu/multiarch/halfulp-fma4.c: Likewise. * sysdeps/x86_64/fpu/multiarch/slowpow-fma.c: Likewise. * sysdeps/x86_64/fpu/multiarch/slowpow-fma4.c: Likewise.
* Add narrowing add functions.Joseph Myers2018-02-101-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the narrowing add functions from TS 18661-1 to glibc's libm: fadd, faddl, daddl, f32addf64, f32addf32x, f32xaddf64 for all configurations; f32addf64x, f32addf128, f64addf64x, f64addf128, f32xaddf64x, f32xaddf128, f64xaddf128 for configurations with _Float64x and _Float128; __nldbl_daddl for ldbl-opt. As discussed for the build infrastructure patch, tgmath.h support is deliberately deferred, and FP_FAST_* macros are not applicable without optimized function implementations. Function implementations are added for all relevant pairs of formats (including certain cases of a format and itself where more than one type has that format). The main implementations use round-to-odd, or a trivial computation in the case where both formats are the same or where the wider format is IBM long double (in which case we don't attempt to be correctly rounding). The sysdeps/ieee754/soft-fp implementations use soft-fp, and are used automatically for configurations without exceptions and rounding modes by virtue of existing Implies files. As previously discussed, optimized versions for particular architectures are possible, but not included. i386 gets a special version of f32xaddf64 to avoid problems with double rounding (similar to the existing fdim version), since this function must round just once without an intermediate rounding to long double. (No such special version is needed for any other function, because the nontrivial functions use round-to-odd, which does the intermediate computation with the rounding mode set to round-to-zero, and double rounding is OK except in round-to-nearest mode, so is OK for that intermediate round-to-zero computation.) mul and div will need slightly different special versions for i386 (using round-to-odd on long double instead of precision control) because of the possibility of inexact intermediate results in the subnormal range for double. To reduce duplication among the different function implementations, math-narrow.h gets macros CHECK_NARROW_ADD, NARROW_ADD_ROUND_TO_ODD and NARROW_ADD_TRIVIAL. In the trivial cases and for any architecture-specific optimized implementations, the overhead of the errno setting might be significant, but I think that's best handled through compiler built-in functions rather than providing separate no-errno versions in glibc (and likewise there are no __*_finite entry points for these function provided, __*_finite effectively being no-errno versions at present in most cases). Tested for x86_64 and x86, with both GCC 6 and GCC 7. Tested for mips64 (all three ABIs, both hard and soft float) and powerpc with GCC 7. Tested with build-many-glibcs.py with both GCC 6 and GCC 7. * math/Makefile (libm-narrow-fns): Add add. (libm-test-funcs-narrow): Likewise. * math/Versions (GLIBC_2.28): Add narrowing add functions. * math/bits/mathcalls-narrow.h (add): Use __MATHCALL_NARROW . * math/gen-auto-libm-tests.c (test_functions): Add add. * math/math-narrow.h (CHECK_NARROW_ADD): New macro. (NARROW_ADD_ROUND_TO_ODD): Likewise. (NARROW_ADD_TRIVIAL): Likewise. * sysdeps/ieee754/float128/float128_private.h (__faddl): New macro. (__daddl): Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fadd and dadd. (CFLAGS-nldbl-dadd.c): New variable. (CFLAGS-nldbl-fadd.c): Likewise. * sysdeps/ieee754/ldbl-opt/Versions (GLIBC_2.28): Add __nldbl_daddl. * sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl_daddl): New prototype. * manual/arith.texi (Misc FP Arithmetic): Document fadd, faddl, daddl, fMaddfN, fMaddfNx, fMxaddfN and fMxaddfNx. * math/auto-libm-test-in: Add tests of add. * math/auto-libm-test-out-narrow-add: New generated file. * math/libm-test-narrow-add.inc: New file. * sysdeps/i386/fpu/s_f32xaddf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_f32xaddf64.c: Likewise. * sysdeps/ieee754/dbl-64/s_fadd.c: Likewise. * sysdeps/ieee754/float128/s_f32addf128.c: Likewise. * sysdeps/ieee754/float128/s_f64addf128.c: Likewise. * sysdeps/ieee754/float128/s_f64xaddf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_daddl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_f64xaddf128.c: Likewise. * sysdeps/ieee754/ldbl-128/s_faddl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_daddl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_faddl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_daddl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_faddl.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-dadd.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-fadd.c: Likewise. * sysdeps/ieee754/soft-fp/s_daddl.c: Likewise. * sysdeps/ieee754/soft-fp/s_fadd.c: Likewise. * sysdeps/ieee754/soft-fp/s_faddl.c: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Update. * sysdeps/mach/hurd/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * 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/riscv/rv64/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/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* Add build infrastructure for narrowing libm functions.Joseph Myers2018-02-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TS 18661-1 defines libm functions that carry out an operation (+ - * / sqrt fma) on their arguments and return a result rounded to a (usually) narrower type, as if the original result were computed to infinite precision and then rounded directly to the result type without any intermediate rounding to the argument type. For example, fadd, faddl and daddl for addition. These are the last remaining TS 18661-1 functions left to be added to glibc. TS 18661-3 extends this to corresponding functions for _FloatN and _FloatNx types. As functions parametrized by two rather than one varying floating-point types, these functions require infrastructure in glibc that was not required for previous libm functions. This patch provides such infrastructure - excluding test support, and actual function implementations, which will be in subsequent patches. Declaring the functions uses a header bits/mathcalls-narrow.h, which is included many times, for each relevant pair of types. This will end up containing macro calls of the form __MATHCALL_NARROW (__MATHCALL_NAME (add), __MATHCALL_REDIR_NAME (add), 2); for each family of narrowing functions. (The structure of this macro call, with the calls to __MATHCALL_NAME and __MATHCALL_REDIR_NAME there rather than in the definition of __MATHCALL_NARROW, arises from the names such as "add" *not* themselves being reserved identifiers - meaning it's necessary to avoid any indirection that would result in a user-defined "add" macro being expanded.) Whereas for existing functions declaring long double functions is disabled if _LIBC in the case where they alias double functions, to facilitate defining the long double functions as aliases of the double ones, there is no such logic for the narrowing functions in this patch. Rather, the files defining such functions are expected to use #define to hide the original declarations of the alias names, to avoid errors about defining aliases with incompatible types. math/Makefile support is added for building the functions (listed in libm-narrow-fns, currently empty) for all relevant pairs of types. An internal header math-narrow.h is added for macros shared between multiple function implementations - currently a ROUND_TO_ODD macro to facilitate writing functions using the round-to-odd implementation approach, and alias macros to create all the required function aliases. libc_feholdexcept_setroundf128 and libc_feupdateenv_testf128 are added for use when required (only for x86_64). float128_private.h support is added for ldbl-128 narrowing functions to be used for _Float128. Certain things are specifically omitted from this patch and the immediate followups. tgmath.h support is deferred; there remain unresolved questions about how the type-generic macros for these functions are supposed to work, especially in the case of arguments of integer type. The math.h / bits/mathcalls-narrow.h logic, and the logic for determining what functions / aliases to define, will need some adjustments to support the sqrt and fma functions, where e.g. f32xsqrtf64 can just be an alias for sqrt rather than a separate function. TS 18661-1 defines FP_FAST_* macros but no support is included for defining them (they won't in general be true without architecture-specific optimized function versions). For each of the function groups (add sub mul div sqrt fma) there are always six functions present (e.g. fadd, faddl, daddl, f32addf64, f32addf32x, f32xaddf64). When _Float64x and _Float128 are supported, there are seven more (e.g. f32addf64x, f32addf128, f64addf64x, f64addf128, f32xaddf64x, f32xaddf128, f64xaddf128). In addition, in the ldbl-opt case there are function names such as __nldbl_daddl (an alias for f32xaddf64, which is not a reserved name in TS 18661-1, only in TS 18661-3), for calls to daddl to be mapped to in the -mlong-double-64 case. (Calls to faddl just get mapped to fadd, and for sqrt and fma there won't be __nldbl_* functions because dsqrtl and dfmal can just be mapped to sqrt and fma with -mlong-double-64.) While there are six or thirteen functions present in each group (plus __nldbl_* names only as an ABI, not an API), not all are distinct; they fall in various groups of aliases. There are two distinct versions built if long double has the same format as double; four if they have distinct formats but there is no _Float64x or _Float128 support; five if long double has binary128 format; seven when _Float128 is distinct from long double. Architecture-specific optimized versions are possible, but not included in my patches. For example, IA64 generally supports narrowing the result of most floating-point instructions; Power ISA 2.07 (POWER8) supports double values as arguments to float instructions, with the results narrowed as expected; Power ISA 3 (POWER9) supports round-to-odd for float128 instructions, so meaning that approach can be used without needing to set and restore the rounding mode and test "inexact". I intend to leave any such optimized versions to the architecture maintainers. Generally in such cases it would also make sense for calls to these functions to be expanded inline (given -fno-math-errno); I put a suggestion for TS 18661-1 built-in functions at <https://gcc.gnu.org/wiki/SummerOfCode>. Tested for x86_64 (this patch in isolation, as well as testing for various configurations in conjunction with further patches). * math/bits/mathcalls-narrow.h: New file. * include/bits/mathcalls-narrow.h: Likewise. * math/math-narrow.h: Likewise. * math/math.h (__MATHCALL_NARROW_ARGS_1): New macro. (__MATHCALL_NARROW_ARGS_2): Likewise. (__MATHCALL_NARROW_ARGS_3): Likewise. (__MATHCALL_NARROW_NORMAL): Likewise. (__MATHCALL_NARROW_REDIR): Likewise. (__MATHCALL_NARROW): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)]: Repeatedly include <bits/mathcalls-narrow.h> with _Mret_, _Marg_ and __MATHCALL_NAME defined. [__GLIBC_USE (IEC_60559_TYPES_EXT)]: Likewise. * math/Makefile (headers): Add bits/mathcalls-narrow.h. (libm-narrow-fns): New variable. (libm-narrow-types-basic): Likewise. (libm-narrow-types-ldouble-yes): Likewise. (libm-narrow-types-float128-yes): Likewise. (libm-narrow-types-float128-alias-yes): Likewise. (libm-narrow-types): Likewise. (libm-routines): Add narrowing functions. * sysdeps/i386/fpu/fenv_private.h [__x86_64__] (libc_feholdexcept_setroundf128): New macro. [__x86_64__] (libc_feupdateenv_testf128): Likewise. * sysdeps/ieee754/float128/float128_private.h: Include <math/math-narrow.h>. [libc_feholdexcept_setroundf128] (libc_feholdexcept_setroundl): Undefine and redefine. [libc_feupdateenv_testf128] (libc_feupdateenv_testl): Likewise. (libm_alias_float_ldouble): Undefine and redefine. (libm_alias_double_ldouble): Likewise.
* i386: Use __glibc_likely/__glibc_likely in dl-machine.hH.J. Lu2018-02-051-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The differences in elf/dl-reloc.os are --- before 2018-02-05 03:53:31.970492246 -0800 +++ after 2018-02-05 03:53:49.719902340 -0800 @@ -1202,9 +1202,9 @@ _dl_relocate_object: movl -60(%ebp), %eax testl %eax, %eax je .L249 - movl 8(%eax), %eax - movl 8(%ebx), %esi - cmpl %esi, %eax + movl 8(%eax), %esi + movl 8(%ebx), %eax + cmpl %eax, %esi ja .L284 jb .L707 .L285: @@ -2255,7 +2255,7 @@ _dl_relocate_object: cmpl $6, %edi movl $4, %edx je .L132 - cmpl %ecx, %eax + cmpl %eax, %ecx je .L350 cmpl $7, %edi je .L419 @@ -2735,7 +2735,7 @@ _dl_relocate_object: je .L120 .L121: movl -96(%ebp), %edx - movl $640, 8(%esp) + movl $639, 8(%esp) leal __PRETTY_FUNCTION__.9431@GOTOFF(%edx), %eax movl %eax, 12(%esp) leal .LC9@GOTOFF(%edx), %eax @@ -3454,10 +3454,10 @@ _dl_relocate_object: movl -152(%ebp), %eax movl %eax, 4(%esp) call _dl_dprintf - movl -60(%ebp), %eax - movl 8(%ebx), %esi + movl 8(%ebx), %eax + movl -60(%ebp), %ebx movl -112(%ebp), %edx - movl 8(%eax), %eax + movl 8(%ebx), %esi jmp .L285 .L713: movl %esi, (%esp) * sysdeps/i386/dl-machine.h (elf_machine_rel): Replace __builtin_expect with __glibc_likely and __glibc_unlikely. (elf_machine_rela): Likewise. (elf_machine_lazy_rel): Likewise.