]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Fix up libstdc++ build against glibc 2.25 or older [PR107562]
authorJakub Jelinek <jakub@redhat.com>
Mon, 7 Nov 2022 23:35:09 +0000 (00:35 +0100)
committerJakub Jelinek <jakub@redhat.com>
Mon, 7 Nov 2022 23:35:09 +0000 (00:35 +0100)
commitb457b779427b0f7b3fbac447811c9c52db5bc79e
tree368fc5b5330363ee3f170a021f34fd349027ccce
parent93ab7d03dfbdd096c1d3c83e92d794bf4eed18df
libstdc++: Fix up libstdc++ build against glibc 2.25 or older [PR107562]

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:

2022-11-08  Jakub Jelinek  <jakub@redhat.com>

PR libstdc++/107562
* 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
libstdc++-v3/src/c++17/floating_to_chars.cc
This page took 0.056902 seconds and 5 git commands to generate.