From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 4132F26B6D for ; Thu, 13 Jun 2024 03:06:49 +0200 (CEST) Received: (qmail 20024 invoked by uid 550); 13 Jun 2024 01:06:41 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 19812 invoked from network); 13 Jun 2024 01:06:39 -0000 Date: Wed, 12 Jun 2024 21:06:55 -0400 From: Rich Felker To: "Ram Nalamothu (QUIC)" Cc: "musl@lists.openwall.com" Message-ID: <20240613010654.GV10433@brightrain.aerifal.cx> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] Integer only print functions support in MUSL On Wed, Jun 12, 2024 at 05:29:59PM +0000, Ram Nalamothu (QUIC) wrote: > Hi, > > On the subject line topic, is there a plan for integer only print > functions support in MUSL upstream? > > The newlib seems to support the same since 2004 [1] and one > immediate scenario using this capability is assert function [2] in > the C library itself which needs to print only the non-float types. > > Applications that use integer only print functions can benefit from > this capability in terms of reduced code size by avoiding floating > point support implementation in the linked print functions. > > I tried a quick search on the mailing list but couldn't find any > previous discussions on this topic. > Would it make sense to have the similar support in MUSL as well? > Would the community be open to accept patches supporting integer > only print functions? My leaning is no. There is no major precedent for this, no hard *need* (it's only an optimization hint to make up for other failed optimizations), and to do it completely and consistently it's a combinatoric explosion (doubling the number of printf-family functions). At the very least you'd need (and this would be application-unfriendly to have just these) i versions of vfprintf and vsnprintf; everything else can be built on them. But to get back to the point, on archs that are hard-float and don't have an oversized soft-only long double, the size of the floating point code in printf is around 6k. Only the most extreme environments would warrant exploding complexity like that to save 6k. A better way to meet their needs would probably be to provide a way to dummy-out float support at link-time, by putting fmt_fp in its own TU and having some trick to keep it from getting linked if you use the right LDFLAGS. But unless there is a really good documented widespread need for this, I can't see it making sense to do hacks like that upstream in musl. Rich