public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Janne Blomqvist <blomqvist.janne@gmail.com>
To: FX Coudert <fxcoudert@gmail.com>
Cc: Steve Kargl <sgk@troutmask.apl.washington.edu>,
	fortran <fortran@gcc.gnu.org>,
	 gcc-patches@gcc.gnu.org
Subject: Re: [Fortran] half-cycle trig functions and atan[d] fixes
Date: Wed, 24 Jan 2024 11:13:05 +0200	[thread overview]
Message-ID: <CAO9iq9Ft3X=80Hvh8+UGTkqcWeyJE9ye3v5j2aJRczPZ_g7Kzw@mail.gmail.com> (raw)
In-Reply-To: <0840023D-FF1D-47B5-B75F-806913399880@gmail.com>

On Wed, Jan 24, 2024 at 10:28 AM FX Coudert <fxcoudert@gmail.com> wrote:
> > Now, if
> > the OS adds cospi() to libm and it's in libm's symbol map, then the
> > cospi() used by gfortran depends on the search order of the loaded
> > libraries.
>
> We only include the fallback math functions in libgfortran when they are not available on the system. configure detects what is present in the libc being targeted, and conditionally compiles the necessary fallback functions (and only them).

Exactly. However, there is the (corner?) case when libgfortran has
been compiled, and cospi() not found and thus the fallback
implementation is included, and then later libc is updated to a
version that does provide cospi(). I believe in that case which
version gets used is down to the library search order (i.e. the order
that "ldd /path/to/binary" prints the libs), it will use the first
symbol it finds.  Also, it's not necessary to do some ifdef tricks
with gfortran.map, if a symbol listed there isn't found in the library
it's just ignored. So the *pi() trig functions can be unconditionally
added there, and then depending on whether the target libm includes
those or not they are then included in the exported symbol list.

It's possible to override this to look for specific symbol versions
etc., but that probably goes deep into the weeds of target-specific
stuff (e.g. are we looking for cospi@FBSD_1.7, cospi@GLIBC_X.Y.Z, or
something else?). I'm sure you don't wanna go there.


-- 
Janne Blomqvist

  reply	other threads:[~2024-01-24  9:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-20 20:10 Steve Kargl
2024-01-23  9:08 ` FX Coudert
2024-01-23 11:37   ` Janne Blomqvist
2024-01-23 17:30     ` Steve Kargl
2024-01-24  6:21     ` Steve Kargl
2024-01-24  8:28       ` FX Coudert
2024-01-24  9:13         ` Janne Blomqvist [this message]
2024-01-24 17:23           ` Harald Anlauf
2024-01-24 19:28           ` Steve Kargl
2024-01-23 14:40   ` Steve Kargl
2024-01-23 17:21     ` Steve Kargl

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='CAO9iq9Ft3X=80Hvh8+UGTkqcWeyJE9ye3v5j2aJRczPZ_g7Kzw@mail.gmail.com' \
    --to=blomqvist.janne@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=fxcoudert@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=sgk@troutmask.apl.washington.edu \
    /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).