about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-08-21 17:46:34 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-08-21 17:46:34 +0000
commit831bbd55271eacc0190a13954bd347f0a521b096 (patch)
treea46d925f2fca35cd930d73c6d0890ee005ba17fb /sysdeps/unix
parent813378e9fe17e029caf627cab76fe23eb46815fa (diff)
downloadglibc-831bbd55271eacc0190a13954bd347f0a521b096.tar.gz
glibc-831bbd55271eacc0190a13954bd347f0a521b096.tar.xz
glibc-831bbd55271eacc0190a13954bd347f0a521b096.zip
Remove SPARC sqrt wrappers (bug 21973).
This patch removes the SPARC-specific wrappers for sqrt and sqrtf.

These wrappers, by adding architecture-specific uses of _LIB_VERSION
and __kernel_standard, unnecessarily complicate cleanups of libm error
handling.  They also do not serve a useful optimization purpose.  GCC
knows about sqrt as a built-in function, and can generate direct calls
to a hardware square root instruction, either on its own, in the
-fno-math-errno case, or together with an inline check for the
argument being negative and a call to the out-of-line sqrt function
for error handling only in that case (and has been able to do so for a
long time).  Thus in practice the wrapper will only be called only in
the case of negative arguments, which is not a case it is useful to
optimize for.

The removal of the wrappers also uncovers, and fixes, an old bug.
32-bit SPARC libm used (checked with glibc 2.8 binaries) to have a
sqrtl compat symbol, version GLIBC_2.0, for old binaries when sqrtl
was an alias of sqrt (I don't have pre-glibc-2.4 binaries for SPARC to
hand to check for the sqrtl symbol in those).  This disappeared,
probably with:

commit 8847f0377003fbfe9cbe951ce9f8717d74f26247
Author: David S. Miller <davem@davemloft.net>
Date:   Tue Feb 28 22:37:58 2012 -0800

    Add sparc optimized sqrt{,f}.

Removing the wrappers brings back the generic ldbl-opt logic for
creating such compat symbols, and so restores the compat symbol that
should be there.  This could of course also be fixed in the wrappers -
but as noted above, the wrappers are optimizing a case it's not useful
to optimize, so the bug of the missing compat symbol serves to
illustrate the risks involved with the extra complexity of
architecture-specific function versions where not needed.

Tested with build-many-glibcs.py.

	[BZ #21973]
	* sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Remove file.
	* sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S : Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Add
	GLIBC_2.0 sqrtl symbol.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist1
1 files changed, 1 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
index f73af6f224..61042ba147 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
@@ -137,6 +137,7 @@ GLIBC_2.0 sinhl F
 GLIBC_2.0 sinl F
 GLIBC_2.0 sqrt F
 GLIBC_2.0 sqrtf F
+GLIBC_2.0 sqrtl F
 GLIBC_2.0 tan F
 GLIBC_2.0 tanf F
 GLIBC_2.0 tanh F