diff mbox

Avoid localplt issues from x86 fereaiseexcept inline

Message ID alpine.DEB.2.20.1706222314380.18518@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers June 22, 2017, 11:15 p.m. UTC
Building for x86_64 with float128 support, I get a localplt test
failure from lrintf128 calling feraiseexcept.

The problem is that an inline optimized version of feraiseexcept calls
__feraiseexcept_renamed in cases where it doesn't completely expand
inline, and that in turn is redirected to feraiseexcept for a library
call, so meaning the redirection of feraiseexcept to
__GI_feraiseexcept inside libm is lost for that call.

This patch fixes the problem by moving the redirect to an internal
header in the _LIBC case, with the internal header using
__GI_feraiseexcept where appropriate.  I'd welcome any comments on
whether this is the best approach for fixing this or if another way is

Tested for x86_64 (in conjunction with float128 patches).  Not yet 

2017-06-22  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/x86/fpu/bits/fenv.h [_LIBC] (__feraiseexcept_renamed):
	Do not declare.
	* sysdeps/x86/fpu/include/bits/fenv.h [_LIBC &&
	__USE_EXTERN_INLINES] (__feraiseexcept_renamed): Declare here,
	redirected to __GI_feraiseexcept if [SHARED && IS_IN (libm)].


Joseph Myers June 23, 2017, 8:05 p.m. UTC | #1
Now committed.
diff mbox


diff --git a/sysdeps/x86/fpu/bits/fenv.h b/sysdeps/x86/fpu/bits/fenv.h
index fd73279..e6fcf94 100644
--- a/sysdeps/x86/fpu/bits/fenv.h
+++ b/sysdeps/x86/fpu/bits/fenv.h
@@ -120,7 +120,9 @@  femode_t;
 /* Optimized versions.  */
+#ifndef _LIBC
 extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept);
 __extern_always_inline void
 __NTH (__feraiseexcept_invalid_divbyzero (int __excepts))
diff --git a/sysdeps/x86/fpu/include/bits/fenv.h b/sysdeps/x86/fpu/include/bits/fenv.h
index a39b6fa..aa61666 100644
--- a/sysdeps/x86/fpu/include/bits/fenv.h
+++ b/sysdeps/x86/fpu/include/bits/fenv.h
@@ -17,6 +17,15 @@ 
    <http://www.gnu.org/licenses/>.  */
 #ifndef _BITS_FENV_H
+#if defined _LIBC && defined __USE_EXTERN_INLINES
+# if defined SHARED && IS_IN (libm)
+extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), __GI_feraiseexcept);
+# else
+extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept);
+# endif
 #include_next <bits/fenv.h>
 # ifndef _ISOMAC