Commit Graph

11488 Commits

Author SHA1 Message Date
Chris Metcalf
f18b8dc7d7 tilegx: work around vector insn bug in gcc
Avoid an issue in gcc where some of the vector (aka SIMD) ops will
sometimes end up getting wrongly optimized out.  We use these
instructions in many of the string implementations.  If/when we
have an upstreamed fix for this problem in gcc we can conditionalize
the use of the extended assembly workaround in glibc.
2017-12-05 10:24:56 -05:00
Florian Weimer
446d22e91d Linux: Implement interfaces for memory protection keys
This adds system call wrappers for pkey_alloc, pkey_free, pkey_mprotect,
and x86-64 implementations of pkey_get and pkey_set, which abstract over
the PKRU CPU register and hide the actual number of memory protection
keys supported by the CPU.  pkey_mprotect with a -1 key is implemented
using mprotect, so it will work even if the kernel does not support the
pkey_mprotect system call.

The system call wrapers use unsigned int instead of unsigned long for
parameters, so that no special treatment for x32 is needed.  The flags
argument is currently unused, and the access rights bit mask is limited
to two bits by the current PKRU register layout anyway.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-05 15:20:35 +01:00
Joseph Myers
216933b242 Use libm_alias_float for powerpc.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes powerpc libm function implementations use
libm_alias_float to define function aliases.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/fpu/s_cosf.c: Include <libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_fabs.S: Include <libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_fmaf.S: Include <libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_rintf.c: Include <libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_sinf.c: Include <libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
	* sysdeps/powerpc/power5+/fpu/s_modff.c: Include
	<libm-alias-float.h>.
	(modff): Define using libm_alias_float.
	* sysdeps/powerpc/power7/fpu/s_logbf.c: Include
	<libm-alias-float.h>.
	(logbf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_llrintf.c: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_llroundf.c: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_lround.S: Include
	<libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf.c:
	Include <libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c:
	Include <libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf.c:
	Include <libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf.c:
	Include <libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llroundf.c:
	Include <libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf.c:
	Include <libm-alias-float.h>.
	(logbf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrintf.c:
	Include <libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lroundf.c:
	Include <libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff.c:
	Include <libm-alias-float.h>.
	(modff): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf.c:
	Include <libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf.c:
	Include <libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Include
	<libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lround.S: Include
	<libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf.c: Include
	<libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf.c: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c: Include
	<libm-alias-float.h>.
	(logbf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c: Include
	<libm-alias-float.h>.
	(modff): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf.c: Include
	<libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Include
	<libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Include
	<libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
2017-12-05 00:26:26 +00:00
Chris Metcalf
2e49fed84c tile: update ca{cos,sin,tan}{,h} double ULPs 2017-12-04 12:31:20 -05:00
Joseph Myers
73895b499b Use __floor not floor in sinf.
The new sinf implementation introduced localplt failures for all
platforms where the compiler did not inline the calls to floor
(converted to trunc by machine-independent optimizations).  This patch
changes the calls to use __floor as normal in libm.

We can't use the public function names floor / floorf / floorl /
floorf128 in libm code in the absence of appropriate asms to redirect
floor/trunc calls, if not inlined, to use the internal names instead
(while avoiding breaking code building the floor functions themselves)
- while having such asms and then calling the public functions
unconditionally would be desirable for optimization (few architectures
have __floor inlines in math_private.h, and once the built-in function
is used you don't need them), using __floor is the minimum safe fix
for the present test regressions.

Tested with build-many-glibcs.py that this fixes the localplt test
failure for arm-linux-gnueabi.

	* sysdeps/ieee754/flt-32/s_sinf.c (SINF_FUNC): Use __floor instead
	of floor.
2017-12-04 16:58:08 +00:00
Siddhesh Poyarekar
4c1d801a59 aarch64: Avoid hidden symbols for memcpy/memmove into static binaries
The __GI_* symbol aliases for __memcpy_generic are unnecessary since
they're never used.  Add them only for libc.so to avoid PLT.  Maybe
some time in future we need to evaluate the relative cost of PLT vs
gains from multiarch memcpy implementations and take a call on whether
to drop this completely.

	* sysdeps/aarch64/multiarch/memcpy_generic.S (__GI_memcpy):
	Define only for libc.so.
2017-12-04 21:17:17 +05:30
Stefan Liebler
478593e637 S390: Fix backtrace in vdso functions.
On s390, GDB fails to show the complete backtrace from within vdso functions.
The macro INTERNAL_VSYSCALL_CALL saves the return address in r14 to r10
before branching to the vdso function. The branch-instruction updates r14
in order to let the vdso function return. Then the original address in r14 is
restored from r10. Unfortunately, there are no cfi-rules and GDB fails.

Furthermore the call of the vdso function does not comply with the s390 ABI
as no stack-frame for the vdso-function is generated.

This patch removes the s390 specific macro INTERNAL_VSYSCALL_CALL
and the common implementation in sysdeps/unix/sysv/linux/sysdep-vdso.h is used.
Then the vdso function is called via function-pointer and GCC generates a
new stack-frame and emits all needed cfi-rules.

The defines CLOBBER_[0-6] are removed as they  were only used in macro
INTERNAL_VSYSCALL_CALL.

The macro INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK is not used on s390.
The only user is power. Thus it is removed from s390 sysdep.h.

ChangeLog:

	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
	(INTERNAL_VSYSCALL_CALL, CLOBBER_0, CLOBBER_1, CLOBBER_2,
	 CLOBBER_3, CLOBBER_4, CLOBBER_5, CLOBBER_6,
	INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Remove.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
2017-12-04 16:40:13 +01:00
Rajalakshmi Srinivasaraghavan
7863a71181 New generic sinf
This implementation is based on optimized sinf assembly versions
of x86_64 and powerpc.
2017-12-04 10:12:10 +05:30
John David Anglin
b3f7fb12f5 Handle __gmon_start__ as undefined weak on hppa.
[BZ libc/19170]
	* sysdeps/hppa/crti.S: Declare PREINIT_FUNCTION weak_extern when
	PREINIT_FUNCTION_WEAK is nonzero.
	(gmon_initializer): New function.  Put procedure label for it in
	.init_array section.
	(_init): Don't call PREINIT_FUNCTION.
	* sysdeps/hppa/crtn.S (__gmon_start__): Remove.
	* sysdeps/hppa/dl-lookupcfg.h (DL_FIXUP_MAKE_VALUE): Create null fixup
	value when map argument is null.
2017-12-02 14:43:28 -05:00
John David Anglin
800a496acb Improve PIC pc-relative instruction sequences on hppa.
* sysdeps/hppa/dl-fptr.c (elf_machine_resolve): Remove unnecessary
	depi instruction from PIC pc-relative sequence.
	* sysdeps/hppa/dl-fptr.h (ELF_MACHINE_LOAD_ADDRESS): Likewise.
	* sysdeps/hppa/dl-machine.h (elf_machine_dynamic): Likewise.
	(elf_machine_load_address): Likewise.
	(elf_machine_runtime_setup): Likewise.
2017-12-02 11:04:16 -05:00
Joseph Myers
d17542d235 Use libm_alias_double for remaining powerpc functions.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes the remaining double powerpc functions use
libm_alias_double to define function aliases (with consequent removal
of the need for local compat symbol handling).  Previous cleanups
avoid this patch changing installed stripped shared libraries for any
build-many-glibcs.py configuration (there are still some functions in
this patch for which the order of double and float aliases changes
within an individual source file, but in this case this doesn't result
in changes to the final library).

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/power7/fpu/s_logb.c: Include
	<libm-alias-double.h>.
	(logb): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_llrint.c: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_llround.c: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_lround.S: Include
	<libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c:
	Include <libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint.c:
	Include <libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround.c:
	Include <libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb.c: Include
	<libm-alias-double.h>.
	(logb): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint.c:
	Include <libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround.c:
	Include <libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Include
	<libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lround.S: Include
	<libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c: Include
	<libm-alias-double.h>.
	(logb): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
2017-12-02 00:11:37 +00:00
Joseph Myers
0ddde474db Define powerpc64 lroundl compat symbol only once.
sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c defines the
lroundl compat symbol, version GLIBC_2_1, twice, once based on llround
and once based on __lround.  Those are aliases for each other (llround
weak, __lround strong), but defining it twice does not make sense.
This patch changes it to define the compat symbol once only, matching
how libm_alias_double defines it.

Tested with build-many-glibcs.py for its powerpc64 configurations.

	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c
	[LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)] (lroundl): Do not define
	compat symbol based on llround.
2017-12-01 23:58:05 +00:00
Joseph Myers
0d5ba561c1 Base powerpc logbl compat symbols on __logb not logb.
Some powerpc logb implementations define a compat symbol for logbl
based on logb, whereas libm_alias_double defines such a compat symbol
based on __logb instead.  This difference (logb is weak, __logb isn't)
is enough to result in different installed stripped shared libraries.
The difference in the installed libraries isn't significant, but first
changing the compat_symbol calls helps make it possible to validate a
subsequent change to use libm_alias_double by comparison of libraries,
so this patch does such a preliminary change.

Tested with build-many-glibcs.py for all its hard-float powerpc
configurations.

	* sysdeps/powerpc/power7/fpu/s_logb.c
	[LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (logbl): Define as compat
	symbol based on __logb, not on logb.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb.c
	[LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (logbl): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c
	[LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (logbl): Likewise.
2017-12-01 23:37:46 +00:00
Joseph Myers
51ea3b2042 Ues libm_alias_double for various powerpc functions.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch various powerpc functions use libm_alias_double to
define function aliases (with consequent removal of the need for local
compat symbol handling).  (The present patch excludes the changes to
some functions where such changes could result in differences in
installed stripped shared libraries because of changes to the exact
ordering or properties of symbols in individual .os files.)

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/fpu/s_rint.c: Include <libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/powerpc/power5+/fpu/s_modf.c: Include
	<libm-alias-double.h>.
	(modf): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil.c: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor.c:
	Include <libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf.c: Include
	<libm-alias-double.h>.
	(modf): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round.c:
	Include <libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc.c:
	Include <libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c: Include
	<libm-alias-double.h>.
	(modf): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
2017-12-01 23:09:47 +00:00
Joseph Myers
ec2cf3f444 Use libm_alias_double for powerpc fabs, fma.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes powerpc fabs and fma use libm_alias_double
to define function aliases.  This brings in automatic symbol
versioning compat handling, so the powerpc32 and powerpc64 wrappers
that added such handling to the generic sysdeps/powerpc/fpu versions
are removed as no longer required (there are no sysdeps directory
ordering issues that would necessitate keeping trivial wrappers
there).

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/fpu/s_fabs.S: Include <libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/powerpc/fpu/s_fma.S: Include <libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_fabs.S: Remove file.
	* sysdeps/powerpc/powerpc32/fpu/s_fma.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_fabs.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_fma.S: Likewise.
2017-12-01 22:23:28 +00:00
Gabriel F. T. Gomes
428fc49eaa powerpc: Regenerate ULPs
On POWER9, cbrtf128 fails by 1 ULP.

	* sysdeps/powerpc/fpu/libm-test-ulps: Regenerate.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
2017-12-01 17:23:09 -02:00
Adhemerval Zanella
0594b13f5d x32: Remove unused getcpu implementation
Checked on x86_64-linux-gnu-x32.

	* sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 15:48:40 -02:00
Adhemerval Zanella
dbdfcf3bba sparc: Remove ununsed ifunc assembly macros
Now that all SPARC ifunc converted to C implementation there is no need
for both C and assembly macros.  This patch removes the assembly ones.

Checked on sparcv9-linux-gnu and sparc64-linux-gnu.

	* sysdeps/sparc/sparc-ifunc.h (SPARC_ASM_IFUNC_DFLT,
	SPARC_ASM_IFUNC1, SPARC_ASM_IFUNC2, SET, SPARC_ASM_VIS2_IFUNC,
	SPARC_ASM_VIS3_IFUNC, SPARC_ASM_VIS3_VIS2_IFUNC): Remove macros.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 15:48:40 -02:00
Adhemerval Zanella
5b7bd9756c sparc: Fix sparv9 multiarch build
Fix build caused by 5b4e5e7869.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Fix build
	due redirect macro.
2017-12-01 15:47:23 -02:00
Adhemerval Zanella
2a14526bfa sparc: refactor cpu_relax to C
* sysdeps/sparc/sparc64/cpu_relax.c: New file.
	* sysdeps/sparc/sparc32/sparcv9/cpu_relax.c: Likewise.
	* sysdeps/sparc/sparc64/cpu_relax.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/cpu_relax.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:51:10 -02:00
Adhemerval Zanella
1c051a9b09 sparc: refactor sparc32 nearbyint{f} selector to C
This patch refactors the sparc32 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_nearbyint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_nearbyintf-generic and
	s_nearbyint-generic.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-generic.S:
	New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-generic.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.c:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S: Remove
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S:
	Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:51:08 -02:00
Adhemerval Zanella
dbeb74ef84 sparc: refactor sparc32 rint{f} selector to C
This patch refactors the sparc32 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_rint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_rintf-generic and s_rint-generic.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint-generic.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf-generic.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:49:36 -02:00
Adhemerval Zanella
fa7ded9612 sparc: refactor sparc32 llrint{f} selector to C
This patch refactors the sparc32 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_llrint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_llrintf-generic and s_llrint-generic.
	* sysdeps/sparc/sparcv9/fpu/multiarch/s_llrint-generic.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf-generic.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:49:19 -02:00
Adhemerval Zanella
e240cf0e0e sparc: refactor sparc32 fabs{f} selector to C
This patch refactors the sparc32 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_fabs{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_fabsf-generic and s_fabs-generic.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs-generic.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf-generic.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:48:58 -02:00
Adhemerval Zanella
5b4e5e7869 sparc: refactor sparc32 copysign selector to C
This patch refactors the sparc32 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_copysign{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	(sysdep_calls): New rule.
	(sysdep_routines): Use sysdep_calls as base.
	(libm-sysdep_routines): Add generic rule for symbols shared with
	libc.  Add s_copysign-generic and s_copysign-generic objects.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S:
	New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:48:39 -02:00
Joseph Myers
ff84a0e050 Use libm_alias_float for e500.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes an e500 libm function implementation use
libm_alias_float to define function aliases.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for its e500 configurations.

	* sysdeps/powerpc/powerpc32/e500/nofpu/s_fabsf.S: Include
	<libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
2017-12-01 01:12:42 +00:00
H.J. Lu
ef5d8b4342 mips: Don't use MIN in dl-machine.h
MIN is used, but param.h may not be included, so expand its single use
inline.

	* sysdeps/mips/dl-machine.h (elf_machine_reloc): Expand MIN.
2017-11-30 16:34:09 -08:00
Joseph Myers
f938b397dd Use libm_alias_float for coldfire.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes coldfire libm function implementations use
libm_alias_float to define function aliases.

Untested, given the currently broken state of GCC for coldfire.

	* sysdeps/m68k/coldfire/fpu/s_fabsf.c: Include
	<libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/m68k/coldfire/fpu/s_lrintf.c: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/m68k/coldfire/fpu/s_rintf.c: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
2017-11-30 23:52:35 +00:00
Joseph Myers
2251fad025 Use libm_alias_double for coldfire.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes coldfire libm function implementations use
libm_alias_double to define function aliases.

Untested, given the currently broken state of GCC for coldfire.

	* sysdeps/m68k/coldfire/fpu/s_fabs.c: Include
	<libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/m68k/coldfire/fpu/s_lrint.c: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/m68k/coldfire/fpu/s_rint.c: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
2017-11-30 23:47:18 +00:00
Joseph Myers
e53df1dee8 Rework m68k libm functions to use declare_mgen_alias.
Many m68k libm functions use their own system to share code between
different types and functions, involving defining macros before
including code for another function (for example, s_atan.c also acts
as a template that can define other functions).

Thes files serving as templates generate function aliases directly
with e.g. "weak_alias (__CONCATX(__,FUNC), FUNC)" in s_atan.c.  To be
prepared to generate _Float32, _Float64 and _Float32x function
aliases, this needs changing so that the libm_alias_* macros get used
instead.  As the macro to use varies depending on the type, that would
mean additional macros to define in several different places to get
the appropriate alias-generation macro used in each case.

Rather than adding to the m68k-specific mechanisms, this patch
converts the functions in question to use something closer to the
math/ type-generic template mechanism.  After this patch, these
functions have m68k-specific templates such as s_atan_template.c, but
those templates use all the same macros as in the math/ templates,
such as FLOAT, M_DECL_FUNC, M_SUF and declare_mgen_alias.  There is no
automatic generation of the files such as s_atan.c that include the
appropriate math-type-macros-*.h header and the template file (the
existing automatic generation logic is only applicable for the fixed
set of templates listed in math/ - and sysdeps sources always override
files generated that way), so those files are still checked in, but
they are all the obvious two-line files (with one additional
definition in the case of the expm1 implementations), rather than
making e.g. s_atan.c special.

Functions are only converted where they should have aliases for
_FloatN / _FloatNx types.  Those m68k functions that do not generate
public names (those that only generate __ieee754_*, with wrappers
generating the public names, and classification functions that only
exist once per format not once per type so don't get aliases) are
unchanged.  However, log1p (public names generated by wrapper) and
significand (not provided for new types so no new aliases needed)
needed changing because they previously included the atan
implementations.  Now, s_significand.c is the main implementation for
functions with that prototype and using the old implementation
approach, while log1p includes it in place of atan.

Any further cleanups in this area (which preserve the proper set of
functions getting aliases defined by libm_alias_float and
libm_alias_double) are of course welcome, just not needed for the
goals of this patch.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by the patch.

	* sysdeps/m68k/m680x0/fpu/s_atan_template.c: New file.
	* sysdeps/m68k/m680x0/fpu/s_ceil_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_cos_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_expm1_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_fabs_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_floor_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_frexp_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_lrint_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_modf_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_nearbyint_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_remquo_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_rint_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sin_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sincos_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tan_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanh_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_trunc_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_atan.c: Reimplement to use
	s_atan_template.c.
	* sysdeps/m68k/m680x0/fpu/s_atanf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_atanl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_ceil.c: Reimplement to use
	s_ceil_template.c.
	* sysdeps/m68k/m680x0/fpu/s_ceilf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_ceill.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_cos.c: Reimplement to use
	s_cos_template.c.
	* sysdeps/m68k/m680x0/fpu/s_cosf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_cosl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_expm1.c: Reimplement to use
	s_expm1_template.c.
	* sysdeps/m68k/m680x0/fpu/s_expm1f.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_expm1l.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_fabs.c: Reimplement to use
	s_fabs_template.c.
	* sysdeps/m68k/m680x0/fpu/s_fabsf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_fabsl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_floor.c: Reimplement to use
	s_floor_template.c.
	* sysdeps/m68k/m680x0/fpu/s_floorf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_floorl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_frexp.c: Reimplement to use
	s_frexp_template.c.
	* sysdeps/m68k/m680x0/fpu/s_frexpf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_lrint.c: Reimplement to use
	s_lrint_template.c.
	* sysdeps/m68k/m680x0/fpu/s_lrintf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_lrintl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_modf.c: Reimplement to use
	s_modf_template.c.
	* sysdeps/m68k/m680x0/fpu/s_modff.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_modfl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_nearbyint.c: Reimplement to use
	s_nearbyint_template.c.
	* sysdeps/m68k/m680x0/fpu/s_nearbyintf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_nearbyintl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_remquo.c: Reimplement to use
	s_remquo_template.c.
	* sysdeps/m68k/m680x0/fpu/s_remquof.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_remquol.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_rint.c: Reimplement to use
	s_rint_template.c.
	* sysdeps/m68k/m680x0/fpu/s_rintf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_rintl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sin.c: Reimplement to use
	s_sin_template.c.
	* sysdeps/m68k/m680x0/fpu/s_sinf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sinl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sincos.c: Reimplement to use
	s_sincos_template.c.
	* sysdeps/m68k/m680x0/fpu/s_sincosf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sincosl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tan.c: Reimplement to use
	s_tan_template.c.
	* sysdeps/m68k/m680x0/fpu/s_tanf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanh.c: Reimplement to use
	s_tanh_template.c.
	* sysdeps/m68k/m680x0/fpu/s_tanhf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanhl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_trunc.c: Reimplement to use
	s_trunc_template.c.
	* sysdeps/m68k/m680x0/fpu/s_truncf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_truncl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_significand.c: Reimplement based on
	s_atan.c instead of including s_atan.c.
	* sysdeps/m68k/m680x0/fpu/s_significandf.c: Reimplement based on
	s_atanf.c instead of including s_atanf.c.
	* sysdeps/m68k/m680x0/fpu/s_significandl.c: Reimplement based on
	s_atanl.c instead of including s_atanl.c.
	* sysdeps/m68k/m680x0/fpu/s_log1p.c: Include s_significand.c
	instead of s_atan.c.
	* sysdeps/m68k/m680x0/fpu/s_log1pf.c: Include s_significandf.c
	instead of s_atanf.c.
	* sysdeps/m68k/m680x0/fpu/s_log1pl.c: Include s_significandl.c
	instead of s_atanl.c.
2017-11-30 22:39:07 +00:00
Joseph Myers
bd6ea9edd1 Use libm_alias macros in m68k llrint functions.
Most m68k libm functions share code via sources for one function
including those for another function or type, in a way that will
require significant changes to create function aliases in a way
friendly to adding _FloatN / _FloatNx aliases.

The llrint function implementations, however, use a conventional
separate implementation for each floating-point type.  Thus preparing
them for _FloatN / _FloatNx aliases is just a matter of changing them
to include the appropriate headers and use the appropriate macros,
which this patch does.  The llrintl changes aren't strictly required,
since m68k long double does not meet the criteria for a _FloatN /
_FloatNx type, but are included anyway to keep consistency between the
implementations for the three types.

Tested with build-many-glibcs.py that installed stripped shared
libraries for m68k-linux-gnu are unchanged by the patch.

	* sysdeps/m68k/m680x0/fpu/s_llrint.c: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/m68k/m680x0/fpu/s_llrintf.c: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/m68k/m680x0/fpu/s_llrintl.c: Include
	<libm-alias-ldouble.h>.
	(llrintl): Define using libm_alias_ldouble.
2017-11-30 19:15:21 +00:00
Joseph Myers
faec63238f Use declare_mgen_alias in m68k templates.
Some m68k libm functions have their own templates replacing the
generic math/ ones but using the type-generic template machinery.
These currently define function aliases directly using weak_alias.  In
preparation for additional _FloatN / _FloatNx function aliases, this
patch changes them to use declare_mgen_alias for creating aliases
instead.

Tested with build-many-glibcs.py that installed stripped shared
libraries for m68k-linux-gnu are unchanged by the patch.

	* sysdeps/m68k/m680x0/fpu/s_ccosh_template.c (ccosh): Use
	declare_mgen_alias instead of weak_alias.
	* sysdeps/m68k/m680x0/fpu/s_cexp_template.c (cexp): Likewise.
	* sysdeps/m68k/m680x0/fpu/s_csin_template.c (csin): Likewise.
	* sysdeps/m68k/m680x0/fpu/s_csinh_template.c (csinh): Likewise.
2017-11-30 19:03:57 +00:00
Adhemerval Zanella
9e2279a0e9 sparc: refactor sparc64 __mpn_add_n selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
add_n-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
	Add add_n-generic.
	* sysdeps/sparc/sparc64/multiarch/add_n-generic.S: New file.
	* sysdeps/sparc/sparc64/multiarch/add_n.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/add_n.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-30 14:10:28 -02:00
Adhemerval Zanella
75f37c71db sparc: refactor sparc64 __mpn_submul_1 selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
submul_1-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
	Add submul_1-generic.
	* sysdeps/sparc/sparc64/multiarch/submul_1-generic.S: New file.
	* sysdeps/sparc/sparc64/multiarch/submul_1.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/submul_1.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-30 14:10:25 -02:00
Adhemerval Zanella
dda1d2e88b sparc: refactor sparc64 __mpn_addmul_1 selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
addmul_1-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
	Add addmul_1-generic.
	* sysdeps/sparc/sparc64/multiarch/addmul_1-generic.S: New file.
	* sysdeps/sparc/sparc64/multiarch/addmul_1.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/addmul_1.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-30 14:10:20 -02:00
Adhemerval Zanella
b70cbbfcc8 sparc: refactor sparc64 __mpn_sub_n selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
sub_n-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
	Add sub_n-generic.
	* sysdeps/sparc/sparc64/multiarch/sub_n-generic.S: New file.
	* sysdeps/sparc/sparc64/multiarch/sub_n.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/sub_n.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-30 14:10:16 -02:00
Adhemerval Zanella
023cade3b3 sparc: refactor sparc64 __mpn_mul_1 selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
mul_1-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
	Add mul_1-generic.
	* sysdeps/sparc/sparc64/multiarch/mul_1-generic.S: New file.
	* sysdeps/sparc/sparc64/multiarch/mul_1.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/mul_1.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-30 14:10:12 -02:00
H.J. Lu
f33632ccd1 x86: Make a space in jmpbuf for shadow stack pointer
To support Shadow Stack (SHSTK) in Intel Control-flow Enforcement
Technology (CET) in setjmp/longjmp, we need to save shadow stack
pointer in jmp_buf.  The __saved_mask field in jmp_buf has type
of __sigset_t.  On Linux, __sigset_t is defined as

 #define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
typedef struct
{
  unsigned long int __val[_SIGSET_NWORDS];
} __sigset_t;

which is much bigger than expected by the __sigprocmask system call,
which has

typedef struct {
        unsigned long sig[_NSIG_WORDS];
} sigset_t;

For Linux/x86, we can shrink __sigset_t used by __saved_mask in jmp_buf
to add paddings for shadow stack pointer.  As long as the new __sigset_t
is not smaller than sigset_t expected by the __sigprocmask system call,
it should work correctly.

This patch adds an internal header file, <setjmpP.h>, to define
__jmp_buf_sigset_t for __saved_mask in jmp_buf for Linux/x86 with a
space to store shadow stack pointer.  It verifies __jmp_buf_sigset_t has
the suitable size for the __sigprocmask system call.   A run-time test,
tst-saved_mask-1.c, is added to verify that size of __jmp_buf_sigset_t
is sufficient.  If its size is too small, the test fails with

rt_sigprocmask(SIG_SETMASK, strace: umoven: short read (4 < 8) @0x7fa8aa28effc
0x7fa8aa28effc, NULL, 8) = -1 EFAULT (Bad address)
rt_sigprocmask(SIG_SETMASK, strace: umoven: short read (4 < 8) @0x7fa8aa28effc
0x7fa8aa28effc, NULL, 8) = -1 EFAULT (Bad address)
rt_sigprocmask(SIG_SETMASK, NULL, 0x7fa8aa28effc, 8) = -1 EFAULT (Bad address)
exit_group(1)                           = ?

Tested with build-many-glibcs.py.

	* debug/longjmp_chk.c: Include <setjmpP.h> instead of
	<setjmp.h>.
	* setjmp/longjmp.c: Include <setjmpP.h> instead of <setjmp.h>.
	(__libc_siglongjmp): Cast &env[0].__saved_mask to "sigset_t *".
	* setjmp/sigjmp.c: Include <setjmpP.h> instead of <setjmp.h>.
	(__sigjmp_save): Cast &env[0].__saved_mask to "sigset_t *".
	* sysdeps/generic/setjmpP.h: New file.
	* sysdeps/unix/sysv/linux/x86/jmp_buf-ssp.sym: Likewise.
	* sysdeps/unix/sysv/linux/x86/setjmpP.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/tst-saved_mask-1.c: Likewise.
	* sysdeps/unix/sysv/linux/x86/Makefile (gen-as-const-headers):
	Add jmp_buf-ssp.sym.
	(tests): Add tst-saved_mask-1.
2017-11-30 04:58:01 -08:00
Joseph Myers
18305fba55 Remove SPARC lllrint aliases.
The sparc32/sparcv9/fpu/multiarch implementations of llrint / llrintf
have aliases lllrint / lllrintf.  No such function is exported from or
used in libm and these aliases should not be there; I expect they
arose accidentally in the course of converting a 64-bit implementation
(where lrint and llrint can be aliases) to a 32-bit llrint
implementation.  This patch removes those spurious aliases.

Tested (compilation only) with build-many-glibcs.py for
sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.S
	(__lllrint): Remove alias.
	(lllrint): Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.S
	(__lllrintf): Likewise.
	(lllrintf): Likewise.
2017-11-30 00:43:28 +00:00
Joseph Myers
3e5efdbdbe Use libm_alias_float for sparc.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes sparc libm function implementations use
libm_alias_float to define function aliases.

Tested with build-many-glibcs.py for all its sparc configurations that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/sparc/sparc32/fpu/s_copysignf.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/fpu/s_fabsf.S: Include
	<libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S:
	Include <libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.S: Include
	<libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c: Include
	<libm-alias-float.h>.
	(fdimf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf.c: Include
	<libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S:
	Include <libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_llrintf.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_lrintf.S: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c: Include
	<libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	(llrintf): Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.c: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.c: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/s_copysignf.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/s_fabsf.c: Include
	<libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/s_lrintf.S: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	(llrintf): Likewise.
	* sysdeps/sparc/sparc64/fpu/s_nearbyintf.S: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
2017-11-30 00:30:40 +00:00
Joseph Myers
875cd54855 Use libm_alias_double for sparc.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes sparc libm function implementations use
libm_alias_double to define function aliases (with consequent
simplification where compat symbol handling is now done by those
macros rather than locally in architecture-specific code).

Tested with build-many-glibcs.py for all its sparc configurations that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/sparc/sparc32/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/fpu/s_fabs.S: Include
	<libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S:
	Include <libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.S: Include
	<libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c: Include
	<libm-alias-double.h>.
	(fdim): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma.c: Include
	<libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S:
	Include <libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_fabs.S: Include
	<libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c: Include
	<libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	(llrint): Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.c: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint.c: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/s_fabs.c: Include
	<libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/s_lrint.S: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	(llrint): Likewise.
	* sysdeps/sparc/sparc64/fpu/s_nearbyint.S: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
2017-11-29 23:40:07 +00:00
Joseph Myers
cf4ebc27fe Fix missing sparcv9 --disable-multi-arch fabsl compat symbol (bug 22229).
The --disable-multi-arch case of sparcv9 libm is missing a fabsl
compat symbol for when long double had the same ABI as double.  This
patch adds the missing compat symbol to this implementation.  As my
fix for other instances of this missing compat symbol postdates the
last release, I'm considering this as being part of bug 22229 that was
missing from my previous fix rather than as a separate issue, and so
as not needing a new bug report in Bugzilla.

Tested (compilation only) with build-many-glibcs.py for
sparcv9-linux-gnu --disable-multi-arch.

	[BZ #22229]
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_fabs.S: Include
	<math_ldbl_opt.h>.
	(fabsl): Define as compat symbol at version GLIBC_2_0 for libm.
2017-11-29 23:09:03 +00:00
Joseph Myers
34bb10aabf Use libm_alias_float for x86_64.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes x86_64 libm function implementations use
libm_alias_float to define function aliases, or libm_alias_float_other
where the main name is defined with versioned_symbol.

Tested with the glibc testsuite for x86_64, and tested with
build-many-glibcs.py for all its x86_64 configurations that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/x86_64/fpu/multiarch/e_exp2f.c: Include
	<libm-alias-float.h>.
	(exp2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/x86_64/fpu/multiarch/e_expf.c: Include
	<libm-alias-float.h>.
	(exp2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/x86_64/fpu/multiarch/e_log2f.c: Include
	<libm-alias-float.h>.
	(exp2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/x86_64/fpu/multiarch/e_logf.c: Include
	<libm-alias-float.h>.
	(exp2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/x86_64/fpu/multiarch/e_powf.c: Include
	<libm-alias-float.h>.
	(exp2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/x86_64/fpu/multiarch/s_ceilf.c: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/multiarch/s_floorf.c: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/multiarch/s_fmaf.c: Include
	<libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/multiarch/s_rintf.c: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/multiarch/s_truncf.c: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_copysignf.S: Include <libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_cosf.S: Include <libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_fabsf.c: Include <libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_fmaxf.S: Include <libm-alias-float.h>.
	(fmaxf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_fminf.S: Include <libm-alias-float.h>.
	(fminf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_llrintf.S: Include <libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	[!__ILP32__] (lrintf): Likewise.
	* sysdeps/x86_64/fpu/s_sincosf.S: Include <libm-alias-float.h>.
	(sincosf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_sinf.S: Include <libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
	* sysdeps/x86_64/x32/fpu/s_lrintf.S: Include <libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
2017-11-29 21:25:41 +00:00
Joseph Myers
011fba7e48 Use libm_alias_double for x86_64.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes x86_64 libm function implementations use
libm_alias_double to define function aliases.

Tested with the glibc testsuite for x86_64, and tested with
build-many-glibcs.py for all its x86_64 configurations that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/x86_64/fpu/multiarch/s_atan.c: Include
	<libm-alias-double.h>.
	(atan): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_ceil.c: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_floor.c: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_fma.c: Include
	<libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_nearbyint.c: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_rint.c: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_sin.c: Include
	<libm-alias-double.h>.
	(sin): Define using libm_alias_double.
	(cos): Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_tan.c: Include
	<libm-alias-double.h>.
	(tan): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_trunc.c: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/s_copysign.S: Include <libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/s_fabs.c: Include <libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/s_fmax.S: Include <libm-alias-double.h>.
	(fmax): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/s_fmin.S: Include <libm-alias-double.h>.
	(fmin): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/s_llrint.S: Include <libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	[!__ILP32__] (lrint): Likewise.
	* sysdeps/x86_64/x32/fpu/s_lrint.S: Include <libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
2017-11-29 19:01:21 +00:00
Adhemerval Zanella
21bfcc3d24 sparc: refactor sparc64 rint{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_rint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_rintf-generic and s_rint-generic
	objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:21 -02:00
Adhemerval Zanella
522228ddea sparc: refactor sparc64 lrint{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_lrint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_lrint-generic and s_lrint-generic
	objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:21 -02:00
Adhemerval Zanella
2a6f4fab24 sparc: refactor sparc64 nearbyint{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_nearbyint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_nearbyint-generic and
	s_nearbyintf-generic objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:20 -02:00
Adhemerval Zanella
712b5b83e1 sparc: refactor sparc64 finite{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_finite{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
	Add s_finitef-generic and s_finite-generic objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:20 -02:00
Adhemerval Zanella
c96d3335a3 sparc: refactor sparc64 isinf{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_isinf{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
	Add isinff-generic and s_isinf-generic objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:20 -02:00
Adhemerval Zanella
c6862a2371 sparc: refactor sparc64 isnan{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
(s_isnan{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
	Add s_isnanf-generic and s_isnan-generic objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:15 -02:00