public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: Jakub Jelinek <jakub@redhat.com>,
	gcc-patches@gcc.gnu.org,
	"Joseph S. Myers" <joseph@codesourcery.com>,
	fortran@gcc.gnu.org
Subject: Re: [PATCH] fortran, libgfortran, v2: Avoid using libquadmath for glibc 2.26+
Date: Fri, 24 Jun 2022 23:06:50 +0200	[thread overview]
Message-ID: <e2f3bce7-1c27-71fc-7a68-24a3784dec00@gmx.de> (raw)
In-Reply-To: <YrWR/feBR28AlWlz@tucnak>

Hi Jakub,

Am 24.06.22 um 12:29 schrieb Jakub Jelinek via Gcc-patches:
> On Thu, Jun 23, 2022 at 11:17:50PM +0200, Jakub Jelinek via Gcc-patches wrote:
>> We currently use
>> %rename lib liborig
>> *lib: %{static-libgfortran:--as-needed} -lquadmath %{static-libgfortran:--no-as-needed} -lm %(libgcc) %(liborig)
>> in libgfortran.spec (on targets where we do configure in libquadmath).
>> So, I believe the patch as is is an ABI change for *.o files if they use
>> real(kind=16) math functions (one needs to recompile them), but not
>> for linked shared libraries or executables, because the above aranges
>> for them to be linked with -lquadmath or for -static-libgfortran with
>> --as-needed -lquadmath --no-as-needed.  The former adds libquadmath.so.0
>> automatically to anything gfortran links, the latter to anything that
>> actually needs it (i.e. has undefined math/complex *q symbols).
>>
>> Note, libgfortran.so.5 itself is ABI compatible, just no longer has
>> DT_NEEDED libquadmath.so.0 and uses the *f128 APIs + str{to,from}f128
>> instead of *q APIs + strtoflt128 and quadmath_snprintf.
>>
>> Now, what we could do if we'd want to also preserve *.o file compatibility,
>> would be for gcc configured on glibc 2.26+ change libgfortran.spec to
>> *lib: --as-needed -lquadmath --no-as-needed -lm %(libgcc) %(liborig)
>> so that we even without -static-libgfortran link in libquadmath.so.0
>> only if it is needed.  So, if there will be any gcc <= 12 compiled
>> *.o files or *.o files compiled by gcc 13 if it was configured against
>> glibc 2.25 or older, we'd link -lquadmath in, but if there are just
>> *.o files referencing *f128 symbols, we wouldn't.
>>
>>> Am I right in assuming that this also effectively fixes PR46539?
>>> (Add -static-libquadmath).
>>
>> That was one of the intents of the patch.
>> But sure, it doesn't introduce -static-libquadmath, nor arranges for
>> -static-libgfortran to link libquadmath statically, just in some cases
>> (gcc configured on glibc 2.26 or later) and when everything that calls
>> real(kind=16) math functions has been recompiled arranges for libquadmath
>> not to be used at all.
>
> Here is an updated patch that does that.

very good!

>>>> --- gcc/fortran/trans-intrinsic.cc.jj	2022-05-16 11:14:57.587427707 +0200
>>>> +++ gcc/fortran/trans-intrinsic.cc	2022-06-23 11:42:03.355899271 +0200
>>>> @@ -155,7 +155,7 @@ builtin_decl_for_precision (enum built_i
>>>>      else if (precision == TYPE_PRECISION (double_type_node))
>>>>        i = m->double_built_in;
>>>>      else if (precision == TYPE_PRECISION (long_double_type_node)
>>>> -	   && (!gfc_real16_is_float128
>>>> +	   && ((!gfc_real16_is_float128 & !gfc_real16_is__Float128)
>>>
>>> Shouldn't this be && instead of & ?
>>
>> You're right, will fix.
>
> And this too.
>
> So I believe it should now be fully ABI compatible.

Great, thanks!

Harald

  reply	other threads:[~2022-06-24 21:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 12:04 [PATCH] fortran, libgfortran: " Jakub Jelinek
2022-06-23 20:49 ` Harald Anlauf
2022-06-23 21:17   ` Jakub Jelinek
2022-06-24 10:29     ` [PATCH] fortran, libgfortran, v2: " Jakub Jelinek
2022-06-24 21:06       ` Harald Anlauf [this message]
2022-06-26 18:45       ` Mikael Morin
2022-06-27  7:54         ` Jakub Jelinek
2022-06-27 11:56           ` Mikael Morin
2022-06-27 13:30             ` [PATCH] fortran, libgfortran, v3: " Jakub Jelinek
2022-06-28  7:01               ` Jakub Jelinek
2022-06-28  8:35               ` Tobias Burnus
2022-06-28 10:57                 ` Jakub Jelinek
2022-06-27 20:54           ` [PATCH] fortran, libgfortran, v2: " Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2f3bce7-1c27-71fc-7a68-24a3784dec00@gmx.de \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).