Hi Mike, On Thu, Mar 04, 2021 at 04:01:35PM -0500, Michael Meissner wrote: > [PATCH V3] Require GLIBC 2.32 for Decimal/_Float128 conversions. > > In the patch that I applied on March 2nd, I had code to provide support for > Decimal/_Float128 conversions if the user did not use at least GLIBC 2.32. It > did this by using __ibm128 as an intermediate type. The trouble is __ibm128 > cannot represent all of the numbers that _Float128 can, and you lose if you do > this conversion. > > This patch removes this support. The dfp-bit.c functions now call the the > __sprintfieee128 and __strtoieee128 functions to do the conversion. If the > user does not have GLIBC, they will get a linker error that these functions do > not exist. > > The float128 support functions are only built into the static libgcc, so there > isn't an issue with having references to __strtoieee128 and __sprintfieee128 > with older GLIBC libraries.
It still is a reverse dependency. > As an added bonus, this patch eliminates the __sprintfkf function which > included stdio.h to get a definition for the sprintf library function. This > allows for building cross compilers without having to have a target stdio.h > available. Which is required *anyway*. See my reply to Matheus. > --- a/libgcc/dfp-bit.h > +++ b/libgcc/dfp-bit.h > @@ -298,8 +298,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. > If not, see > #define BFP_TYPE _Float128 > #define BFP_FMT "%.36Le" > #define BFP_VIA_TYPE _Float128 > -#define STR_TO_BFP __strtokf > -#include <_strtokf.h> > +#define STR_TO_BFP __strtoieee128 > +extern _Float128 __strtoieee128 (const char *, char **); It is better to include a header for this. I tried to check this against the implementation, but I cannot find that function in glibc. Some macro magic in the name? Where is it? > @@ -647,8 +647,8 @@ extern DFP_C_TYPE BFP_TO_DFP (BFP_TYPE); > > #elif defined (L_kf_to_sd) || defined (L_kf_to_dd) || defined (L_kf_to_td) > extern DFP_C_TYPE BFP_TO_DFP (BFP_TYPE); > -#include <_sprintfkf.h> > -#define BFP_SPRINTF __sprintfkf > +extern int __sprintfieee128 (char *restrict, const char *restrict, ...); > +#define BFP_SPRINTF __sprintfieee128 The GCC headers use typeof (sprintf) __sprintfieee128; (well, an alias). But you cannot, because of the dependency inversion you have. But independent declarations like this are the source of many bugs :-( Hrm. This patch won't make things worse than they are, so, okay for trunk. Thanks! Segher