From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id D347F3938C29 for ; Mon, 1 Mar 2021 17:19:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D347F3938C29 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 121H4ljB163564; Mon, 1 Mar 2021 12:18:57 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37142k1526-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Mar 2021 12:18:57 -0500 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 121H4mtJ163662; Mon, 1 Mar 2021 12:18:57 -0500 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 37142k1514-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Mar 2021 12:18:57 -0500 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 121HGmH1024049; Mon, 1 Mar 2021 17:18:55 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma01dal.us.ibm.com with ESMTP id 37121j191r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Mar 2021 17:18:55 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 121HItio30671214 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 1 Mar 2021 17:18:55 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D878112067; Mon, 1 Mar 2021 17:18:55 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 88A52112062; Mon, 1 Mar 2021 17:18:54 +0000 (GMT) Received: from ibm-toto.the-meissners.org (unknown [9.65.200.124]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTPS; Mon, 1 Mar 2021 17:18:54 +0000 (GMT) Date: Mon, 1 Mar 2021 12:18:52 -0500 From: Michael Meissner To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , David Edelsohn , Bill Schmidt , Peter Bergner , Joseph Myers Subject: [PATCH 2/3 V2] Do not include stdio.h in libgcc's Decimal/Float128 conversions. Message-ID: <20210301171852.GB9185@ibm-toto.the-meissners.org> Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , David Edelsohn , Bill Schmidt , Peter Bergner , Joseph Myers References: <20210301171432.GA7962@ibm-toto.the-meissners.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210301171432.GA7962@ibm-toto.the-meissners.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-01_11:2021-03-01, 2021-03-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 adultscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103010137 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_MANYTO, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Mar 2021 17:19:02 -0000 [PATCH 2/3 V2] Do not include stdio.h in libgcc's Decimal/Float128 conversions. The _sprintfkf.c file was including stdio.h to get the definition of sprintf. This patch modifies this so that stdio.h is not included in order to support freestanding cross compilers that might not provide stdio.h. I have done bootstraps on a little endian power9 system with each of the long double variants (128-bit IBM, 128-bit IEEE, 64-bit) enabled, and there were no regressions in each of the builds with the previous version. In addition, I have built 2 cross compilers from my x86_64 system to little endian PowerPC Linux. One build enabled decimal support and one disabled the decimal support. On the build that disabled decimal support, I verified that the _Float128 <-> Decimal conversions were not built. Can I check this patch into the master branch for GCC 11? libgcc/ 2021-03-01 Michael Meissner * config/rs6000/_sprintfkf.c: Do not include stdio.h. (__sprintfkf): Call __builtin_sprintf not sprintf. --- libgcc/config/rs6000/_sprintfkf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libgcc/config/rs6000/_sprintfkf.c b/libgcc/config/rs6000/_sprintfkf.c index 2d624f14e25..9bbc26145ab 100644 --- a/libgcc/config/rs6000/_sprintfkf.c +++ b/libgcc/config/rs6000/_sprintfkf.c @@ -27,7 +27,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include #include #include -#include #include <_sprintfkf.h> /* This function must be built with IBM 128-bit as long double, so that we can @@ -42,7 +41,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see If we are linked against an earlier library, we will have fake it by converting the value to long double, and using sprintf to do the conversion. This isn't ideal, as IEEE 128-bit has more exponent range than IBM - 128-bit. */ + 128-bit. + + We use __builtin_sprintf so that we don't have to include stdio.h to define + sprintf. Stdio.h might not be present for freestanding cross compilers that + do not need to include a library. */ extern int __sprintfieee128 (char *restrict, const char *restrict, ...) __attribute__ ((__weak__)); @@ -54,5 +57,5 @@ int __sprintfkf (char *restrict string, if (__sprintfieee128) return __sprintfieee128 (string, format, number); - return sprintf (string, format, (long double) number); + return __builtin_sprintf (string, format, (long double) number); } -- 2.22.0 -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meissner@linux.ibm.com, phone: +1 (978) 899-4797