aboutsummaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabrielftg@linux.ibm.com>2019-06-27 17:43:44 -0300
committerGabriel F. T. Gomes <gabrielftg@linux.ibm.com>2019-06-27 17:51:59 -0300
commit1626f499d159f17d5d99dc41497b52074f3850df (patch)
treedd408298c1a3b38707ce77e3b0cebae505c156c0 /libio
parentLinux: Adjust gedents64 buffer size to int range [BZ #24740] (diff)
downloadglibc-1626f499d159f17d5d99dc41497b52074f3850df.tar.gz
glibc-1626f499d159f17d5d99dc41497b52074f3850df.tar.bz2
glibc-1626f499d159f17d5d99dc41497b52074f3850df.zip
Prepare vfprintf to use __printf_fp/__printf_fphex with float128 arg
On powerpc64le, long double can currently take two formats: the same as double (-mlong-double-64) or IBM Extended Precision (default with -mlong-double-128 or explicitly with -mabi=ibmlongdouble). The internal implementation of printf-like functions is aware of these possibilities and properly parses floating-point values from the variable arguments, before making calls to __printf_fp and __printf_fphex. These functions are also aware of the format possibilities and know how to convert both formats to string. When library support for TS 18661-3 was added to glibc, __printf_fp and __printf_fphex were extended with support for an additional type (__float128/_Float128) with a different format (binary128). Now that powerpc64le is getting support for its third long double format, and taking into account that this format is the same as the format of __float128/_Float128, this patch extends __vfprintf_internal to properly call __printf_fp and __printf_fphex with this new format. Tested for powerpc64le (with additional patches to actually enable the use of these preparations) and for x86_64. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'libio')
-rw-r--r--libio/libioP.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/libio/libioP.h b/libio/libioP.h
index afa46cc519..8db24e1861 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -712,10 +712,22 @@ extern int __vswprintf_internal (wchar_t *string, size_t maxlen,
defined to 1 or 2. Otherwise, such checks are ignored.
PRINTF_CHK indicates, to the internal function being called, that the
- call is originated from one of the __*printf_chk functions. */
-#define PRINTF_LDBL_IS_DBL 0x0001
-#define PRINTF_FORTIFY 0x0002
-#define PRINTF_CHK 0x0004
+ call is originated from one of the __*printf_chk functions.
+
+ PRINTF_LDBL_USES_FLOAT128 is used on platforms where the long double
+ format used to be different from the IEC 60559 double format *and*
+ also different from the Quadruple 128-bits IEC 60559 format (such as
+ the IBM Extended Precision format on powerpc or the 80-bits IEC 60559
+ format on x86), but was later converted to the Quadruple 128-bits IEC
+ 60559 format, which is the same format that the _Float128 always has
+ (hence the `USES_FLOAT128' suffix in the name of the flag). When set
+ to one, this macro indicates that long double values are to be
+ handled as having this new format. Otherwise, they should be handled
+ as the previous format on that platform. */
+#define PRINTF_LDBL_IS_DBL 0x0001
+#define PRINTF_FORTIFY 0x0002
+#define PRINTF_CHK 0x0004
+#define PRINTF_LDBL_USES_FLOAT128 0x0008
extern size_t _IO_getline (FILE *,char *, size_t, int, int);
libc_hidden_proto (_IO_getline)