* [RFC] BZ 15666: alpha: Add __sqrt*_finite definitions @ 2013-06-24 17:07 Richard Henderson 2013-06-24 20:24 ` Joseph S. Myers ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Richard Henderson @ 2013-06-24 17:07 UTC (permalink / raw) To: libc-ports; +Cc: roland, joseph With compatibility for ev6 and non-ev6 builds, as the non-ev6 did manage to get definitions emitted for the float and double functions. This doesn't quite work. The __sqrtl_finite version gets emitted to the wrong version. I had thought that adding symbols to the Versions file at a later version would override earlier symbols in the more generic Versions file, but it appears that isn't so? Must I solve this with an explicit versioned_symbol macro, or is there a better way? r~ * sysdeps/alpha/Versions (GLIBC_2.18): Add __sqrt_finite, __sqrtf_finite, and __sqrtl_finite. * sysdeps/alpha/alphaev6/fpu/e_sqrt.S: Add __sqrt_finite. * sysdeps/alpha/alphaev6/fpu/e_sqrtf.S: Add __sqrtf_finite. * sysdeps/alpha/fpu/e_sqrt.c: Add __sqrt_finite compatibility. * sysdeps/alpha/fpu/e_sqrtf.c: New file. * sysdeps/alpha/soft-fp/e_sqrtl.c: Add __sqrtl_finite. --- ports/sysdeps/alpha/Versions | 4 ++++ ports/sysdeps/alpha/alphaev6/fpu/e_sqrt.S | 9 +++++++++ ports/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S | 9 +++++++++ ports/sysdeps/alpha/fpu/e_sqrt.c | 22 ++++++++++++++++++++++ ports/sysdeps/alpha/fpu/e_sqrtf.c | 14 ++++++++++++++ ports/sysdeps/alpha/soft-fp/e_sqrtl.c | 2 ++ 6 files changed, 60 insertions(+) create mode 100644 ports/sysdeps/alpha/fpu/e_sqrtf.c diff --git a/ports/sysdeps/alpha/Versions b/ports/sysdeps/alpha/Versions index 76b67a6..ae8fde7 100644 --- a/ports/sysdeps/alpha/Versions +++ b/ports/sysdeps/alpha/Versions @@ -10,4 +10,8 @@ libm { # used in inline functions. __atan2; } + GLIBC_2.18 { + # forgotten when the symbols were added to glibc 2.15 for other targets + __sqrt_finite; __sqrtf_finite; __sqrtl_finite; + } } diff --git a/ports/sysdeps/alpha/alphaev6/fpu/e_sqrt.S b/ports/sysdeps/alpha/alphaev6/fpu/e_sqrt.S index 66be65e..2aac3d3 100644 --- a/ports/sysdeps/alpha/alphaev6/fpu/e_sqrt.S +++ b/ports/sysdeps/alpha/alphaev6/fpu/e_sqrt.S @@ -16,6 +16,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <shlib-compat.h> .arch ev6 .set noreorder @@ -42,3 +43,11 @@ ENTRY(__ieee754_sqrt) nop END(__ieee754_sqrt) + +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +strong_alias(__ieee754_sqrt, __sqrt_finite1) +compat_symbol(libm, __sqrt_finite1, __sqrt_finite, GLIBC_2_15) +versioned_symbol(libm, __ieee754_sqrt, __sqrt_finite, GLIBC_2_18) +#else +strong_alias(__ieee754_sqrt, __sqrt_finite) +#endif diff --git a/ports/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S b/ports/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S index ad89786..5aeafca 100644 --- a/ports/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S +++ b/ports/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S @@ -16,6 +16,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <shlib-compat.h> .arch ev6 .set noreorder @@ -42,3 +43,11 @@ ENTRY(__ieee754_sqrtf) nop END(__ieee754_sqrtf) + +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +strong_alias(__ieee754_sqrtf, __sqrtf_finite1) +compat_symbol(libm, __sqrtf_finite1, __sqrtf_finite, GLIBC_2_15) +versioned_symbol(libm, __ieee754_sqrtf, __sqrtf_finite, GLIBC_2_18) +#else +strong_alias(__ieee754_sqrtf, __sqrtf_finite) +#endif diff --git a/ports/sysdeps/alpha/fpu/e_sqrt.c b/ports/sysdeps/alpha/fpu/e_sqrt.c index 538ff1d..6abca08 100644 --- a/ports/sysdeps/alpha/fpu/e_sqrt.c +++ b/ports/sysdeps/alpha/fpu/e_sqrt.c @@ -18,6 +18,7 @@ #include <math.h> #include <math_private.h> +#include <shlib-compat.h> #if !defined(_IEEE_FP_INEXACT) @@ -157,9 +158,30 @@ $fixup: \n\ \n\ .end __ieee754_sqrt"); +/* Avoid the __sqrt_finite alias that dbl-64/e_sqrt.c would give... */ +#undef strong_alias +#define strong_alias(a,b) + +/* ... defining our own. */ +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +asm (".global __sqrt_finite1; __sqrt_finite1 = __ieee754_sqrt"); +#else +asm (".global __sqrt_finite; __sqrt_finite = __ieee754_sqrt"); +#endif + static double __full_ieee754_sqrt(double) __attribute_used__; #define __ieee754_sqrt __full_ieee754_sqrt +#elif SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +# define __sqrt_finite __sqrt_finite1 #endif /* _IEEE_FP_INEXACT */ #include <sysdeps/ieee754/dbl-64/e_sqrt.c> + +/* Work around forgotten symbol in alphaev6 build. */ +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +# undef __sqrt_finite +# undef __ieee754_sqrt +compat_symbol (libm, __sqrt_finite1, __sqrt_finite, GLIBC_2_15); +versioned_symbol (libm, __ieee754_sqrt, __sqrt_finite, GLIBC_2_18); +#endif diff --git a/ports/sysdeps/alpha/fpu/e_sqrtf.c b/ports/sysdeps/alpha/fpu/e_sqrtf.c new file mode 100644 index 0000000..ad523f5 --- /dev/null +++ b/ports/sysdeps/alpha/fpu/e_sqrtf.c @@ -0,0 +1,14 @@ +#include <shlib-compat.h> + +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +# define __sqrtf_finite __sqrtf_finite1 +#endif + +#include <sysdeps/ieee754/flt-32/e_sqrtf.c> + +/* Work around forgotten symbol in alphaev6 build. */ +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +# undef __sqrtf_finite +compat_symbol (libm, __sqrtf_finite1, __sqrtf_finite, GLIBC_2_15); +versioned_symbol (libm, __ieee754_sqrtf, __sqrtf_finite, GLIBC_2_18); +#endif diff --git a/ports/sysdeps/alpha/soft-fp/e_sqrtl.c b/ports/sysdeps/alpha/soft-fp/e_sqrtl.c index 40e97b8..2dc152f 100644 --- a/ports/sysdeps/alpha/soft-fp/e_sqrtl.c +++ b/ports/sysdeps/alpha/soft-fp/e_sqrtl.c @@ -37,3 +37,5 @@ __ieee754_sqrtl (const long double a) FP_HANDLE_EXCEPTIONS; return c; } + +strong_alias(__ieee754_sqrtl, __sqrtl_finite) -- 1.8.1.4 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] BZ 15666: alpha: Add __sqrt*_finite definitions 2013-06-24 17:07 [RFC] BZ 15666: alpha: Add __sqrt*_finite definitions Richard Henderson @ 2013-06-24 20:24 ` Joseph S. Myers 2013-06-24 21:57 ` Roland McGrath 2013-06-25 2:01 ` Richard Henderson 2 siblings, 0 replies; 6+ messages in thread From: Joseph S. Myers @ 2013-06-24 20:24 UTC (permalink / raw) To: Richard Henderson; +Cc: libc-ports, roland On Mon, 24 Jun 2013, Richard Henderson wrote: > Must I solve this with an explicit versioned_symbol macro, or is there > a better way? I don't have an answer to that question, but presume the complete patch will also update sysdeps/unix/sysv/linux/alpha/nptl/libm.abilist to add the new symbols to the expectations for the relevant symbol versions? -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] BZ 15666: alpha: Add __sqrt*_finite definitions 2013-06-24 17:07 [RFC] BZ 15666: alpha: Add __sqrt*_finite definitions Richard Henderson 2013-06-24 20:24 ` Joseph S. Myers @ 2013-06-24 21:57 ` Roland McGrath 2013-06-25 0:10 ` Richard Henderson 2013-06-25 2:01 ` Richard Henderson 2 siblings, 1 reply; 6+ messages in thread From: Roland McGrath @ 2013-06-24 21:57 UTC (permalink / raw) To: Richard Henderson; +Cc: libc-ports, joseph > This doesn't quite work. The __sqrtl_finite version gets emitted to > the wrong version. I had thought that adding symbols to the Versions > file at a later version would override earlier symbols in the more > generic Versions file, but it appears that isn't so? Nope. Our machinery just pastes them together, so libm.map lists both. The linker chooses the earliest one. > Must I solve this with an explicit versioned_symbol macro, or is there > a better way? Without touching non-alpha files, you must. Without affecting any other configuration, you could add something like '%ifdef __alpha__' to math/Versions (but you'd be shot). Without touching infrastructure, you could move __sqrtl_finite out of the shared math/Versions and put it into machine-specific sysdeps/.../Versions files so that it appears only once in libm.map and always in the right set for each machine. But that is a bit of a nightmare of duplication and a recipe for maintenance hell if we try to make everybody do everything this way from the start (at least as everything else stands today). Finally, we could rethink our whole infrastructure for producing the version maps and rejigger things to make these cases easier to handle. Thoughtful suggestions welcome. This is probably what we should be doing, but obviously not this week. Thanks, Roland ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] BZ 15666: alpha: Add __sqrt*_finite definitions 2013-06-24 21:57 ` Roland McGrath @ 2013-06-25 0:10 ` Richard Henderson 0 siblings, 0 replies; 6+ messages in thread From: Richard Henderson @ 2013-06-25 0:10 UTC (permalink / raw) To: Roland McGrath; +Cc: libc-ports, joseph On 06/24/2013 02:57 PM, Roland McGrath wrote: >> This doesn't quite work. The __sqrtl_finite version gets emitted to >> the wrong version. I had thought that adding symbols to the Versions >> file at a later version would override earlier symbols in the more >> generic Versions file, but it appears that isn't so? > > Nope. Our machinery just pastes them together, so libm.map lists > both. The linker chooses the earliest one. Ok. That's what I'll do for the 2.18 release. I'll post a revised patch including the tested abi files later tonight. r~ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] BZ 15666: alpha: Add __sqrt*_finite definitions 2013-06-24 17:07 [RFC] BZ 15666: alpha: Add __sqrt*_finite definitions Richard Henderson 2013-06-24 20:24 ` Joseph S. Myers 2013-06-24 21:57 ` Roland McGrath @ 2013-06-25 2:01 ` Richard Henderson 2013-06-25 13:35 ` Joseph S. Myers 2 siblings, 1 reply; 6+ messages in thread From: Richard Henderson @ 2013-06-25 2:01 UTC (permalink / raw) To: libc-ports; +Cc: roland, joseph [-- Attachment #1: Type: text/plain, Size: 41 bytes --] Here's the final patch I committed. r~ [-- Attachment #2: z --] [-- Type: text/plain, Size: 6610 bytes --] diff --git a/NEWS b/NEWS index f0ff975..4326e01 100644 --- a/NEWS +++ b/NEWS @@ -21,7 +21,7 @@ Version 2.18 15406, 15409, 15416, 15418, 15419, 15423, 15424, 15426, 15429, 15431, 15432, 15441, 15442, 15448, 15465, 15480, 15485, 15488, 15490, 15492, 15493, 15497, 15506, 15529, 15536, 15553, 15577, 15583, 15618, 15627, - 15631, 15654, 15655, 15667. + 15631, 15654, 15655, 15666, 15667. * CVE-2013-0242 Buffer overrun in regexp matcher has been fixed (Bugzilla #15078). diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha index d2e4813..59e78d1 100644 --- a/ports/ChangeLog.alpha +++ b/ports/ChangeLog.alpha @@ -1,3 +1,15 @@ +2013-06-24 Richard Henderson <rth@redhat.com> + + [BZ #15666] + * sysdeps/alpha/Versions (GLIBC_2.18): Add __sqrt_finite, + __sqrtf_finite, and __sqrtl_finite. + * sysdeps/unix/sysv/linux/alpha/nptl/libm.abilist: Likewise. + * sysdeps/alpha/alphaev6/fpu/e_sqrt.S: Add __sqrt_finite. + * sysdeps/alpha/alphaev6/fpu/e_sqrtf.S: Add __sqrtf_finite. + * sysdeps/alpha/fpu/e_sqrt.c: Add __sqrt_finite compatibility. + * sysdeps/alpha/fpu/e_sqrtf.c: New file. + * sysdeps/alpha/soft-fp/e_sqrtl.c: Add __sqrtl_finite. + 2013-06-23 Richard Henderson <rth@redhat.com> * sysdeps/alpha/fpu/libm-test-ulps: Update. diff --git a/ports/sysdeps/alpha/Versions b/ports/sysdeps/alpha/Versions index 76b67a6..ae8fde7 100644 --- a/ports/sysdeps/alpha/Versions +++ b/ports/sysdeps/alpha/Versions @@ -10,4 +10,8 @@ libm { # used in inline functions. __atan2; } + GLIBC_2.18 { + # forgotten when the symbols were added to glibc 2.15 for other targets + __sqrt_finite; __sqrtf_finite; __sqrtl_finite; + } } diff --git a/ports/sysdeps/alpha/alphaev6/fpu/e_sqrt.S b/ports/sysdeps/alpha/alphaev6/fpu/e_sqrt.S index 66be65e..2aac3d3 100644 --- a/ports/sysdeps/alpha/alphaev6/fpu/e_sqrt.S +++ b/ports/sysdeps/alpha/alphaev6/fpu/e_sqrt.S @@ -16,6 +16,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <shlib-compat.h> .arch ev6 .set noreorder @@ -42,3 +43,11 @@ ENTRY(__ieee754_sqrt) nop END(__ieee754_sqrt) + +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +strong_alias(__ieee754_sqrt, __sqrt_finite1) +compat_symbol(libm, __sqrt_finite1, __sqrt_finite, GLIBC_2_15) +versioned_symbol(libm, __ieee754_sqrt, __sqrt_finite, GLIBC_2_18) +#else +strong_alias(__ieee754_sqrt, __sqrt_finite) +#endif diff --git a/ports/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S b/ports/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S index ad89786..5aeafca 100644 --- a/ports/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S +++ b/ports/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S @@ -16,6 +16,7 @@ <http://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <shlib-compat.h> .arch ev6 .set noreorder @@ -42,3 +43,11 @@ ENTRY(__ieee754_sqrtf) nop END(__ieee754_sqrtf) + +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +strong_alias(__ieee754_sqrtf, __sqrtf_finite1) +compat_symbol(libm, __sqrtf_finite1, __sqrtf_finite, GLIBC_2_15) +versioned_symbol(libm, __ieee754_sqrtf, __sqrtf_finite, GLIBC_2_18) +#else +strong_alias(__ieee754_sqrtf, __sqrtf_finite) +#endif diff --git a/ports/sysdeps/alpha/fpu/e_sqrt.c b/ports/sysdeps/alpha/fpu/e_sqrt.c index 538ff1d..6abca08 100644 --- a/ports/sysdeps/alpha/fpu/e_sqrt.c +++ b/ports/sysdeps/alpha/fpu/e_sqrt.c @@ -18,6 +18,7 @@ #include <math.h> #include <math_private.h> +#include <shlib-compat.h> #if !defined(_IEEE_FP_INEXACT) @@ -157,9 +158,30 @@ $fixup: \n\ \n\ .end __ieee754_sqrt"); +/* Avoid the __sqrt_finite alias that dbl-64/e_sqrt.c would give... */ +#undef strong_alias +#define strong_alias(a,b) + +/* ... defining our own. */ +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +asm (".global __sqrt_finite1; __sqrt_finite1 = __ieee754_sqrt"); +#else +asm (".global __sqrt_finite; __sqrt_finite = __ieee754_sqrt"); +#endif + static double __full_ieee754_sqrt(double) __attribute_used__; #define __ieee754_sqrt __full_ieee754_sqrt +#elif SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +# define __sqrt_finite __sqrt_finite1 #endif /* _IEEE_FP_INEXACT */ #include <sysdeps/ieee754/dbl-64/e_sqrt.c> + +/* Work around forgotten symbol in alphaev6 build. */ +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +# undef __sqrt_finite +# undef __ieee754_sqrt +compat_symbol (libm, __sqrt_finite1, __sqrt_finite, GLIBC_2_15); +versioned_symbol (libm, __ieee754_sqrt, __sqrt_finite, GLIBC_2_18); +#endif diff --git a/ports/sysdeps/alpha/fpu/e_sqrtf.c b/ports/sysdeps/alpha/fpu/e_sqrtf.c new file mode 100644 index 0000000..ad523f5 --- /dev/null +++ b/ports/sysdeps/alpha/fpu/e_sqrtf.c @@ -0,0 +1,14 @@ +#include <shlib-compat.h> + +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +# define __sqrtf_finite __sqrtf_finite1 +#endif + +#include <sysdeps/ieee754/flt-32/e_sqrtf.c> + +/* Work around forgotten symbol in alphaev6 build. */ +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +# undef __sqrtf_finite +compat_symbol (libm, __sqrtf_finite1, __sqrtf_finite, GLIBC_2_15); +versioned_symbol (libm, __ieee754_sqrtf, __sqrtf_finite, GLIBC_2_18); +#endif diff --git a/ports/sysdeps/alpha/soft-fp/e_sqrtl.c b/ports/sysdeps/alpha/soft-fp/e_sqrtl.c index 40e97b8..2cb076e 100644 --- a/ports/sysdeps/alpha/soft-fp/e_sqrtl.c +++ b/ports/sysdeps/alpha/soft-fp/e_sqrtl.c @@ -21,6 +21,7 @@ #include <stdlib.h> #include <soft-fp.h> #include <quad.h> +#include <shlib-compat.h> long double __ieee754_sqrtl (const long double a) @@ -37,3 +38,12 @@ __ieee754_sqrtl (const long double a) FP_HANDLE_EXCEPTIONS; return c; } + +/* ??? We forgot to add this symbol in 2.15. Getting this into 2.18 isn't as + straight-forward as just adding the alias, since a generic Versions file + includes the 2.15 version and the linker uses the first one it sees. */ +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) +versioned_symbol (libm, __ieee754_sqrtl, __sqrtl_finite, GLIBC_2_18); +#else +strong_alias(__ieee754_sqrtl, __sqrtl_finite) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/libm.abilist b/ports/sysdeps/unix/sysv/linux/alpha/nptl/libm.abilist index 400a851..d9b44b5 100644 --- a/ports/sysdeps/unix/sysv/linux/alpha/nptl/libm.abilist +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/libm.abilist @@ -382,6 +382,8 @@ GLIBC_2.15 __sinh_finite F __sinhf_finite F __sinhl_finite F + __sqrt_finite F + __sqrtf_finite F __y0_finite F __y0f_finite F __y0l_finite F @@ -396,6 +398,9 @@ GLIBC_2.18 __issignaling F __issignalingf F __issignalingl F + __sqrt_finite F + __sqrtf_finite F + __sqrtl_finite F GLIBC_2.2 GLIBC_2.2 A feclearexcept F ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] BZ 15666: alpha: Add __sqrt*_finite definitions 2013-06-25 2:01 ` Richard Henderson @ 2013-06-25 13:35 ` Joseph S. Myers 0 siblings, 0 replies; 6+ messages in thread From: Joseph S. Myers @ 2013-06-25 13:35 UTC (permalink / raw) To: Richard Henderson; +Cc: libc-ports, roland Remember when checking in a fix for a bug to mark that bug fixed in Bugzilla.... -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-25 13:35 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-06-24 17:07 [RFC] BZ 15666: alpha: Add __sqrt*_finite definitions Richard Henderson 2013-06-24 20:24 ` Joseph S. Myers 2013-06-24 21:57 ` Roland McGrath 2013-06-25 0:10 ` Richard Henderson 2013-06-25 2:01 ` Richard Henderson 2013-06-25 13:35 ` Joseph S. Myers
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).