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.133.124]) by sourceware.org (Postfix) with ESMTPS id CE34F3858C36 for ; Mon, 7 Nov 2022 19:13:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CE34F3858C36 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=1667848421; h=from:from:reply-to: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=ok5SoqBke2YajRL0S8YI1BSGnJBNUJrBfb6v7l7KiM0=; b=dEaCBi6C/aJ7I5bBqecLOpw93FS49McY5K/+lM3C/SU92qcSA06uY2urFId0Gn7OQNx9ku DwqmXizpueHMvsPCPv+ZXvWye0xqxuQVTcbCVqgVUbJSUHjUfGglZH3AlilrXlV9+SoN9i nH358PCDWzehD7fngLr1NL+PZP7t8Hw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-528-RXO0R66VO2O3_vf3hiwQzg-1; Mon, 07 Nov 2022 14:13:40 -0500 X-MC-Unique: RXO0R66VO2O3_vf3hiwQzg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C3C161C075A2; Mon, 7 Nov 2022 19:13:39 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.252]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E6E62028DC1; Mon, 7 Nov 2022 19:13:39 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2A7JDa8u381826 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 7 Nov 2022 20:13:36 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2A7JDZXh381825; Mon, 7 Nov 2022 20:13:35 +0100 Date: Mon, 7 Nov 2022 20:13:35 +0100 From: Jakub Jelinek To: Jonathan Wakely Cc: Joseph Myers , Patrick Palka , 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 Message-ID: Reply-To: Jakub Jelinek References: <6cffcff-f879-c122-2aeb-fa53714511ac@codesourcery.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.9 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, 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: 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