From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 28E2E3858C3A for ; Mon, 7 Nov 2022 22:43:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 28E2E3858C3A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667860999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ECR4P4kK+8g5RVqxvszaweTCcLmGnTBqv89pNRvYqM8=; b=SKJ90IU9MPx1j3UDte5bABoiPxb7IaBxWE4VoAhuRPPm6Dx4LfOAcogeAEJAPHyE6YpM8N eiWLz5kQ8vBSz9MOLhV1+bNsgy4DMYpjC1RkySTvq6yd/zKEuLaMo5VtUWPxSPcpOjZlU8 L6/l/EVPgD2KHrvL3ojvXq7ccQzXIfw= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-445-pEijp1MBMFil7vhhgtue_w-1; Mon, 07 Nov 2022 17:43:17 -0500 X-MC-Unique: pEijp1MBMFil7vhhgtue_w-1 Received: by mail-ed1-f69.google.com with SMTP id x18-20020a05640226d200b00461e027f704so9180466edd.7 for ; Mon, 07 Nov 2022 14:43:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ECR4P4kK+8g5RVqxvszaweTCcLmGnTBqv89pNRvYqM8=; b=edLS7zALqhkNFA6cgbWz+nSMrY/8k2CB95XKWIdq+hdTAQIUE6HgN/OpRaO5hQuJ3R ktonewxvi1BLqBYyWq6YsdtIdwQqGqj3m/izkMMr+6N37v36zFOvoX829htKgTST/GG3 mABy6343hmNamUfNnZCPBasz89XPQzraMdtCgubeX+I+e/I/Pw0LyZzgGsVQHo/38JsM cNiEnqpWQrN3CdEWYDiRQNyryCCbzYvOsMOfZ2b0KbynSTB3hLjztbHCAmfH5HpPIGX/ EQT8Nsl0O3bNLwfShDMUPjywQ2ZJgKjy15XtKWUJhzFyGc3d/95cUAHOLGs907jpLIUk jd8Q== X-Gm-Message-State: ACrzQf3iOc2NNrgDRfujJDbRE9dWnNDAIpMnol/PlpXohFYEOb3ARs8b 5wfFmx3PzmHWfPeQqYzG+agrqLQ+cya+jRn79lgj/xi6rrL4se8XQsxqS5oOadkntJejL7QkeFw yGuJpUvCgNDvufmy0FxcUOQrT96NLw5w= X-Received: by 2002:a05:6402:13d9:b0:463:398a:75af with SMTP id a25-20020a05640213d900b00463398a75afmr45995334edx.328.1667860996510; Mon, 07 Nov 2022 14:43:16 -0800 (PST) X-Google-Smtp-Source: AMsMyM6LrJwrRCMEUJjYSI7uaNsKv6a7IUcBcv0n/yyagakteOJv4UdHEVA9j4vH/2PWcUiMRjJNTKOuBgzuzfFe2HQ= X-Received: by 2002:a05:6402:13d9:b0:463:398a:75af with SMTP id a25-20020a05640213d900b00463398a75afmr45995320edx.328.1667860996328; Mon, 07 Nov 2022 14:43:16 -0800 (PST) MIME-Version: 1.0 References: <6cffcff-f879-c122-2aeb-fa53714511ac@codesourcery.com> In-Reply-To: From: Jonathan Wakely Date: Mon, 7 Nov 2022 22:43:05 +0000 Message-ID: Subject: Re: [PATCH] libstdc++: Add _Float128 to_chars/from_chars support for x86, ia64 and ppc64le with glibc To: Jakub Jelinek Cc: Joseph Myers , Patrick Palka , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, 7 Nov 2022 at 19:13, Jakub Jelinek wrote: > > On Mon, Nov 07, 2022 at 05:48:42PM +0000, Jonathan Wakely wrote: > > On Mon, 7 Nov 2022 at 16:11, Joseph Myers 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 > > * 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 >