public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* libgfortran.so SONAME and powerpc64le-linux ABI changes
@ 2021-10-04 10:07 Jakub Jelinek
  2021-10-04 11:24 ` Richard Biener
                   ` (6 more replies)
  0 siblings, 7 replies; 77+ messages in thread
From: Jakub Jelinek @ 2021-10-04 10:07 UTC (permalink / raw)
  To: fortran, gcc
  Cc: Tobias Burnus, Segher Boessenkool, Michael Meissner, David Edelsohn

Hi!

On powerpc64le-linux target, one can select between two incompatible
long double formats (both of them are 16-byte), __ibm128 which is
a sum of two doubles, and __float128 (note, not implemented through
libquadmath), which is IEEE754 quad format.  The default for
long double can be selected with --with-long-double-format={ieee,ibm}
configure options.
AFAIK no distributions switched to --with-long-double-format=ieee
yet (correct me if I'm wrong), but the goal is that eventually all
distros switch to that (like they've switched from the --with-long-double-64
default to --with-long-double-128 on powerpc64-linux, s390*-linux etc. years
ago).

libstdc++ has been changed already last year, so that the same
libstdc++.so.6 is ABI compatible with both configurations, in C++ the
IEEE quad long double mangles differently from IBM double double long
double and so it is possible (with quite some work) to achieve that.
Other C++ libraries not shipped as part of gcc are either lucky and don't
use long double on any of its public APIs, then they are compatible with
both, or developers can go the same painful way and support both ABIs in
the same shared library, or they are simply ABI incompatible.

But, I believe --with-long-double-format={ieee,ibm} configure time choice
doesn't change just the meaning of long double, but also of real(kind=16)
and complex(kind=32), but Fortran name mangling just appends _ and doesn't
encode types.
So, the choices for libgfortran.so.5 are either don't do anything, then
we have from GCC the same SONAME but based on what --with-long-double-format={ieee,ibm}
distributions choose ABI incompatible libraries, or bump libgfortran
SONAME in GCC 12 on all targets (the problem is that it unnecessarily
changes the SONAME even on targets that don't really need it - unless
there are important ABI changes in the queue for GCC 12 already), but
that to be effective would basically require that all distros change to
--with-long-double-format=ieee together with GCC 12, or change the
SONAME only on powerpc64le somehow (still the problem that all distros
have to change at once), or add some kind=16 suffix letter into the SONAME
if configured --with-long-double-format=ieee (so we'd have
libgfortran.so.5ieee or whatever, and when we'd bump to libgfortran.so.6
on all arches libgfortran.so.6ieee etc.).

Or the last option would be to try to make libgfortran.so.5 ABI compatible
with both choices on powerpc64le-linux.  From quick skimming of libgfortran,
we have lots of generated functions, which use HAVE_GFC_REAL_16 and
GFC_REAL_16 etc. macros.  So, we could perhaps arrange for the compiler
to use r16i or r17 instead of r16 in the names when real(kind=16) is the
IEEE quad on powerpc64le and keep using r16 for the IBM double double.
For the *.F90 generated files, one could achieve it by making sure
the *r16* files are compiled with -mabi=ibmlongdouble, for
*r16i* or *r17* with -mabi=ieeelongdouble and otherwise use kind=16 in
those, for *.c generated files the *GFC_* macros could just ensure that
it doesn't use long double but __ibm128 or __float128 depending on which one
is needed.
But then I see e.g. the io routines to just pass in kind and so
switch (kind) // or len
  {
  case ...:
    *(GFC_REAL_*) = ...;
  }
etc.  Could we just pretend in the compiler to libgfortran ABI that
powerpc64le-linux real(kind=16) is kind 17 and make sure that if anything
would actually think it is 17 bytes it uses 16 instead (though, kind=10
on x86-64 or i686 also isn't 10 bytes but 16 or 12, right?).

Your thoughts on this?

	Jakub


^ permalink raw reply	[flat|nested] 77+ messages in thread

end of thread, other threads:[~2021-11-02 15:40 UTC | newest]

Thread overview: 77+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-04 10:07 libgfortran.so SONAME and powerpc64le-linux ABI changes Jakub Jelinek
2021-10-04 11:24 ` Richard Biener
2021-10-04 11:36   ` Jakub Jelinek
2021-10-04 12:31     ` Jakub Jelinek
2021-10-04 14:14 ` Jakub Jelinek
2021-10-04 16:47   ` Joseph Myers
2021-10-04 18:33   ` Segher Boessenkool
2021-10-04 19:24     ` Joseph Myers
2021-10-05 17:43       ` Segher Boessenkool
2021-10-14 19:39         ` Bill Schmidt
2021-10-15  0:26           ` Segher Boessenkool
2021-10-05 20:16   ` Thomas Koenig
2021-10-05 21:54     ` Segher Boessenkool
2021-10-06  6:59       ` Thomas Koenig
2021-10-06 15:17         ` Segher Boessenkool
2021-10-06 15:41           ` Jakub Jelinek
2021-10-06 16:07             ` Segher Boessenkool
2021-10-06 16:34               ` Jakub Jelinek
2021-10-06 16:59                 ` Segher Boessenkool
2021-10-06 17:07                   ` Jakub Jelinek
2021-10-06 17:50                     ` Segher Boessenkool
2021-10-06 19:30                       ` Peter Bergner
2021-10-06 17:13                 ` Joseph Myers
2021-10-06 18:39                   ` Segher Boessenkool
2021-10-06 19:42                     ` Joseph Myers
2021-10-06 20:57                       ` Segher Boessenkool
2021-10-06 21:55                         ` Joseph Myers
2021-10-06 22:03                         ` Joseph Myers
2021-10-08 17:53                           ` Segher Boessenkool
2021-10-11 20:11                             ` Joseph Myers
2021-10-15  0:16                               ` Segher Boessenkool
2021-10-06 15:42           ` David Edelsohn
2021-10-06 16:19             ` Segher Boessenkool
2021-10-06 17:38               ` David Edelsohn
2021-10-07  3:42           ` Michael Meissner
2021-10-08 21:10             ` Segher Boessenkool
2021-10-07  9:48         ` Alastair McKinstry
2021-10-07  9:56           ` Andreas Schwab
2021-10-07 10:01             ` Jakub Jelinek
2021-10-07 12:43               ` Alastair McKinstry
2021-10-05 21:53   ` Jonathan Wakely
2021-10-07  3:35 ` Michael Meissner
2021-10-07  6:08   ` Thomas Koenig
2021-10-07  9:40     ` Jakub Jelinek
2021-10-07 15:24     ` Michael Meissner
2021-10-07 15:33       ` Jakub Jelinek
2021-10-08  6:35         ` Thomas Koenig
2021-10-08  7:20           ` Iain Sandoe
2021-10-08 16:26             ` Thomas Koenig
2021-10-08 19:11               ` Iain Sandoe
2021-10-08 22:55                 ` Thomas Koenig
2021-10-08 23:18                   ` Iain Sandoe
2021-10-09  9:11                     ` Thomas Koenig
2021-10-09  9:19                       ` Iain Sandoe
2021-10-09  9:25                       ` Jakub Jelinek
2021-10-09  7:44                   ` Andreas Schwab
2021-10-10 16:14                     ` Florian Weimer
2021-10-15 13:50 ` Bill Schmidt
2021-10-15 14:20   ` Jakub Jelinek
2021-10-15 18:05     ` Thomas Koenig
2021-10-15 18:11       ` Jakub Jelinek
2021-10-15 18:58         ` Thomas Koenig
2021-10-15 22:24     ` Segher Boessenkool
2021-10-15 22:36   ` Segher Boessenkool
2021-10-18 19:02   ` Joseph Myers
2021-10-28  3:10 ` Michael Meissner
2021-10-29  3:36 ` libgfortran.so SONAME and powerpc64le-linux ABI changes (work in progress patches) Michael Meissner
2021-10-29 19:07   ` Thomas Koenig
2021-10-29 21:06     ` Michael Meissner
2021-11-01 15:56       ` Bill Schmidt
2021-11-02 15:40         ` Michael Meissner
2021-10-29 21:21   ` Bernhard Reutner-Fischer
2021-10-29 22:23     ` Michael Meissner
2021-10-30  0:16 ` libgfortran.so SONAME and powerpc64le-linux ABI changes (2nd patch) Michael Meissner
2021-10-30  9:30   ` Thomas Koenig
2021-10-30 10:03     ` Jakub Jelinek
2021-10-30 10:31       ` Thomas Koenig

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).