Patchwork [28/31] Avoid compat symbols for totalorder in powerpc64le IEEE long double

login
register
mail settings
Submitter Gabriel F. T. Gomes
Date Oct. 15, 2019, 7:05 p.m.
Message ID <20191015190529.11559-29-gabriel@inconstante.net.br>
Download mbox | patch
Permalink /patch/35017/
State New
Headers show

Comments

Gabriel F. T. Gomes - Oct. 15, 2019, 7:05 p.m.
From: "Gabriel F. T. Gomes" <gabrielftg@linux.ibm.com>

On powerpc64le, the libm_alias_float128_other_r_ldbl macro is
used to create an alias between totalorderf128 and __totalorderlieee128,
as well as between the totalordermagf128 and __totalordermaglieee128.

However, the totalorder* and totalordermag* functions changed their
parameter type since commit ID 42760d764649 and got compat symbols for
their old versions.  With this change, the aforementioned macro would
create two conflicting aliases for __totalorderlieee128 and
__totalordermaglieee128.

This patch avoids the creation of the alias between the IEEE long double
symbols (__totalorderl*ieee128) and the compat symbols, because the IEEE
long double functions have never been exported thus don't need such
compat symbol.
---
 sysdeps/ieee754/ldbl-128/s_totalorderl.c    | 2 ++
 sysdeps/ieee754/ldbl-128/s_totalordermagl.c | 2 ++
 2 files changed, 4 insertions(+)
Joseph Myers - Oct. 15, 2019, 9:08 p.m.
On Tue, 15 Oct 2019, Gabriel F. T. Gomes wrote:

> From: "Gabriel F. T. Gomes" <gabrielftg@linux.ibm.com>
> 
> On powerpc64le, the libm_alias_float128_other_r_ldbl macro is
> used to create an alias between totalorderf128 and __totalorderlieee128,
> as well as between the totalordermagf128 and __totalordermaglieee128.
> 
> However, the totalorder* and totalordermag* functions changed their
> parameter type since commit ID 42760d764649 and got compat symbols for
> their old versions.  With this change, the aforementioned macro would
> create two conflicting aliases for __totalorderlieee128 and
> __totalordermaglieee128.
> 
> This patch avoids the creation of the alias between the IEEE long double
> symbols (__totalorderl*ieee128) and the compat symbols, because the IEEE
> long double functions have never been exported thus don't need such
> compat symbol.

This needs more explanation (in a comment in the relevant files).  Are you 
saying that libm_alias_float128_other_r_ldbl is presently either unused, 
or used but expanding to empty, in all existing configurations using these 
files (so it's not needed to create any existing compat aliases in any 
configuration that has these functions either for long double or for 
_Float128)?
Gabriel F. T. Gomes - Oct. 21, 2019, 1:49 a.m.
Hi, Joseph,

On Tue, 15 Oct 2019, Joseph Myers wrote:

>This needs more explanation (in a comment in the relevant files).

How about the following paragraph?

  /* On platforms that reuse the _Float128 implementation for IEEE long
     double (powerpc64le), the libm_alias_float128_other_r_ldbl macro
     (which is called by the libm_alias_ldouble macro) is used to create
     aliases between *f128 (_Float128 API) and __*ieee128 functions.
     However, this compat version of totalorderl is older than the
     availability of __ieee*128 symbols, thus, the compat alias is not
     required, nor desired.  */
  #undef libm_alias_float128_other_r_ldbl
  #define libm_alias_float128_other_r_ldbl(from, to, r)

Likewise for totalordermagl.

>Are you 
>saying that libm_alias_float128_other_r_ldbl is presently either unused, 
>or used but expanding to empty, in all existing configurations using these 
>files (so it's not needed to create any existing compat aliases in any 
>configuration that has these functions either for long double or for 
>_Float128)?

Currently, these macros are not used, because they are only defined on
sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h, but
ldbl-128ibm-compat is not yet on the Implies files for powerpc64le.

No other platform has ldbl-128ibm-compat on their Implies files, so this
macro is not needed to create the existing compat aliases you mentioned
above (between parentheses), anywhere.  Also, on powerpc64le, the _Float128
aliases for the compat functions are still provided, even after this patch
and after adding ldbl-128ibm-compat to their Implies...  The _Float128
aliases get created by the libm_alias_float128_r macro, before it expands
libm_alias_float128_other_r_ldbl, whereas the __*ieee128 aliases get
created by libm_alias_float128_other_r_ldbl itself.

(it was a bit hard to find the words to write this answer and to
streamline it, let me know if it's confusing (or wrong, of course)).
Joseph Myers - Oct. 21, 2019, 2:59 p.m.
On Sun, 20 Oct 2019, Gabriel F. T. Gomes wrote:

> Hi, Joseph,
> 
> On Tue, 15 Oct 2019, Joseph Myers wrote:
> 
> >This needs more explanation (in a comment in the relevant files).
> 
> How about the following paragraph?
> 
>   /* On platforms that reuse the _Float128 implementation for IEEE long
>      double (powerpc64le), the libm_alias_float128_other_r_ldbl macro
>      (which is called by the libm_alias_ldouble macro) is used to create
>      aliases between *f128 (_Float128 API) and __*ieee128 functions.
>      However, this compat version of totalorderl is older than the
>      availability of __ieee*128 symbols, thus, the compat alias is not
>      required, nor desired.  */
>   #undef libm_alias_float128_other_r_ldbl
>   #define libm_alias_float128_other_r_ldbl(from, to, r)

Yes, that seems reasonable.

Patch

diff --git a/sysdeps/ieee754/ldbl-128/s_totalorderl.c b/sysdeps/ieee754/ldbl-128/s_totalorderl.c
index 098bd2bcab..7ed24e0928 100644
--- a/sysdeps/ieee754/ldbl-128/s_totalorderl.c
+++ b/sysdeps/ieee754/ldbl-128/s_totalorderl.c
@@ -74,6 +74,8 @@  __totalorder_compatl (_Float128 x, _Float128 y)
 {
   return __totalorderl (&x, &y);
 }
+#undef libm_alias_float128_other_r_ldbl
+#define libm_alias_float128_other_r_ldbl(from, to, r)
 #undef do_symbol
 #define do_symbol(orig_name, name, aliasname)			\
   strong_alias (orig_name, name)				\
diff --git a/sysdeps/ieee754/ldbl-128/s_totalordermagl.c b/sysdeps/ieee754/ldbl-128/s_totalordermagl.c
index b31788c77c..0afa178fcf 100644
--- a/sysdeps/ieee754/ldbl-128/s_totalordermagl.c
+++ b/sysdeps/ieee754/ldbl-128/s_totalordermagl.c
@@ -68,6 +68,8 @@  __totalordermag_compatl (_Float128 x, _Float128 y)
 {
   return __totalordermagl (&x, &y);
 }
+#undef libm_alias_float128_other_r_ldbl
+#define libm_alias_float128_other_r_ldbl(from, to, r)
 #undef do_symbol
 #define do_symbol(orig_name, name, aliasname)			\
   strong_alias (orig_name, name)				\