public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Joseph Myers <joseph@codesourcery.com>,
	Patrick Palka <ppalka@redhat.com>,
	libstdc++@gcc.gnu.org,  gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libstdc++: Add _Float128 to_chars/from_chars support for x86, ia64 and ppc64le with glibc
Date: Mon, 7 Nov 2022 22:43:05 +0000	[thread overview]
Message-ID: <CACb0b4m9S=ncz8DLwz4GuJh5mE_Ym9kPKkSJd6=4HqOoMP9pRg@mail.gmail.com> (raw)
In-Reply-To: <Y2lY38NhE/8jaXg3@tucnak>

On Mon, 7 Nov 2022 at 19:13, Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Mon, Nov 07, 2022 at 05:48:42PM +0000, Jonathan Wakely wrote:
> > On Mon, 7 Nov 2022 at 16:11, Joseph Myers <joseph@codesourcery.com> wrote:
> > >
> > > On Wed, 2 Nov 2022, Jakub Jelinek via Gcc-patches wrote:
> > >
> > > > APIs.  So that one can build gcc against older glibc and then compile
> > > > user programs on newer glibc, the patch uses weak references unless
> > > > gcc is compiled against glibc 2.26+.  strfromf128 unfortunately can't
> > >
> > > This support for older glibc doesn't actually seem to be working, on an
> > > older system with glibc 2.19 I'm seeing
> > >
> > > /scratch/jmyers/fsf/gcc-mainline/libstdc++-v3/src/c++17/floating_to_chars.cc:52:3: error: expected initializer before '__asm'
> > >    52 |   __asm ("strfromf128");
> > >       |   ^~~~~
> > >
> > > and a series of subsequent errors.
> >
> > This seems to "fix" it (not sure if it's right though):
> >
> > #ifndef _GLIBCXX_HAVE_FLOAT128_MATH
> > extern "C" _Float128 __strtof128(const char*, char**)
> >  __attribute__((__weak__));
> > #endif
> > extern "C" _Float128 __strtof128(const char*, char**)
> >  __asm ("strtof128");
>
> It is, but floating_from_chars.cc has the same problem,
> and I think we can avoid the duplication, like this:

OK for trunk, thanks.

>
> 2022-11-07  Jakub Jelinek  <jakub@redhat.com>
>
>         * src/c++17/floating_from_chars.cc (__strtof128): Put __asm before
>         __attribute__.
>         * src/c++17/floating_to_chars.cc (__strfromf128): Likewise.
>
> --- libstdc++-v3/src/c++17/floating_from_chars.cc.jj    2022-11-07 15:15:42.928314819 +0100
> +++ libstdc++-v3/src/c++17/floating_from_chars.cc       2022-11-07 20:09:47.267983154 +0100
> @@ -63,10 +63,11 @@ extern "C" __ieee128 __strtoieee128(cons
>        && defined(__GLIBC_PREREQ)
>  #define USE_STRTOF128_FOR_FROM_CHARS 1
>  extern "C" _Float128 __strtof128(const char*, char**)
> +  __asm ("strtof128")
>  #ifndef _GLIBCXX_HAVE_FLOAT128_MATH
>    __attribute__((__weak__))
>  #endif
> -  __asm ("strtof128");
> +  ;
>  #endif
>
>  #if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 \
> --- libstdc++-v3/src/c++17/floating_to_chars.cc.jj      2022-11-07 15:15:42.929314805 +0100
> +++ libstdc++-v3/src/c++17/floating_to_chars.cc 2022-11-07 20:10:13.189627684 +0100
> @@ -46,10 +46,11 @@ extern "C" int __sprintfieee128(char*, c
>  #elif __FLT128_MANT_DIG__ == 113 && __LDBL_MANT_DIG__ != 113 \
>        && defined(__GLIBC_PREREQ)
>  extern "C" int __strfromf128(char*, size_t, const char*, _Float128)
> +  __asm ("strfromf128")
>  #ifndef _GLIBCXX_HAVE_FLOAT128_MATH
>    __attribute__((__weak__))
>  #endif
> -  __asm ("strfromf128");
> +  ;
>  #endif
>
>  // This implementation crucially assumes float/double have the
>
>
>         Jakub
>


  reply	other threads:[~2022-11-07 22:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02  9:25 Jakub Jelinek
2022-11-07 13:45 ` Jonathan Wakely
2022-11-07 16:11 ` Joseph Myers
2022-11-07 17:48   ` Jonathan Wakely
2022-11-07 17:52     ` Joseph Myers
2022-11-07 19:13     ` Jakub Jelinek
2022-11-07 22:43       ` Jonathan Wakely [this message]
2022-11-08  1:41         ` Joseph Myers
2022-11-08  8:43           ` Jakub Jelinek

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='CACb0b4m9S=ncz8DLwz4GuJh5mE_Ym9kPKkSJd6=4HqOoMP9pRg@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=ppalka@redhat.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).