mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-12 06:10:10 +00:00
421a1d34bf
The 'mode' argument to __vfprintf_internal allows the selection of the long double format for all long double arguments requested by the format string. Currently, there are two possibilities: long double with the same format as double or long double as something else. The 'something else' format varies between architectures, and on powerpc64le, it means IBM Extended Precision format. In preparation for the third option of long double format on powerpc64le, this patch uses the new mode mask, PRINTF_LDBL_USES_FLOAT128, which tells __vfprintf_internal to save the floating-point values into variables of type __float128 and adjusts the parameters to __printf_fp and __printf_fphex as if it was a call from strfromf128. Many files from the stdio-common, wcsmbs, argp, misc, and libio directories will have IEEE binary128 counterparts. Setting the correct compiler options to these files (original and counterparts) would produce a large amount of repetitive Makefile rules. To avoid this repetition, this patch adds a Makefile routine that iterates over the files adding or removing the appropriate flags. Tested for powerpc64le. Reviewed-By: Florian Weimer <fweimer@redhat.com> Reviewed-By: Joseph Myers <joseph@codesourcery.com> Reviewed-By: Paul E. Murphy <murphyp@linux.ibm.com>
68 lines
2.7 KiB
Makefile
68 lines
2.7 KiB
Makefile
ifeq ($(subdir),stdio-common)
|
|
ldbl-extra-routines += printf_size \
|
|
asprintf \
|
|
dprintf \
|
|
fprintf \
|
|
printf \
|
|
snprintf \
|
|
sprintf \
|
|
vasprintf \
|
|
vdprintf \
|
|
vfprintf \
|
|
vprintf \
|
|
vsnprintf \
|
|
vsprintf
|
|
|
|
# Printing long double values with IEEE binary128 format reuses part
|
|
# of the internal float128 implementation (__printf_fp, __printf_fphex,
|
|
# and __float128 variables and union members). Thus, the compilation of
|
|
# the following functions, must have -mfloat128 and -mabi=ibmlongdouble
|
|
# passed to the compiler.
|
|
CFLAGS-vfprintf-internal.c += -mfloat128 -mabi=ibmlongdouble
|
|
|
|
# Basic tests for the implementation of long double with IEEE binary128
|
|
# format and for the related redirections in installed headers.
|
|
tests-internal += test-printf-ieee128 test-printf-ibm128
|
|
CFLAGS-test-printf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
|
|
CFLAGS-test-printf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
|
|
|
|
tests-internal += test-printf-size-ieee128 test-printf-size-ibm128
|
|
CFLAGS-test-printf-size-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
|
|
CFLAGS-test-printf-size-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
|
|
|
|
ifeq ($(run-built-tests),yes)
|
|
tests-special += $(objpfx)test-printf-size-ieee128.out
|
|
tests-special += $(objpfx)test-printf-size-ibm128.out
|
|
endif
|
|
|
|
$(objpfx)test-printf-size-ieee128.out: \
|
|
tst-printfsz-islongdouble.sh $(objpfx)test-printf-size-ieee128
|
|
$(SHELL) $^ '$(test-program-prefix)' $@; \
|
|
$(evaluate-test)
|
|
|
|
$(objpfx)test-printf-size-ibm128.out: \
|
|
tst-printfsz-islongdouble.sh $(objpfx)test-printf-size-ibm128
|
|
$(SHELL) $^ '$(test-program-prefix)' $@; \
|
|
$(evaluate-test)
|
|
endif
|
|
|
|
# Add IEEE binary128 files as make targets.
|
|
routines += $(foreach r,$(ldbl-extra-routines),ieee128-$(r))
|
|
|
|
# On powerpc64le, the routines responsible for converting between long
|
|
# double and string (e.g.: printf, scanf, strtold, strfroml) default to
|
|
# IBM long double mode. When support for TS 18661-3 was added, several
|
|
# internal functions were modified so that they could also handle
|
|
# floating-point variables with IEEE binary128 format, but as an
|
|
# additional type, _Float128.
|
|
#
|
|
# The following rule ensures that the string conversion routines will
|
|
# always be built in IBM long double mode, with additional support for
|
|
# IEEE binary128, through the use of -mabi=ibmlongdouble and -mfloat128.
|
|
ldbl-ibm128-files := $(objpfx)test-%-ibm128^ \
|
|
$(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)^) \
|
|
$(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)-internal^)
|
|
obj-suf-foreach = $(foreach suf,$(all-object-suffixes),$(subst ^,$(suf),$(1)))
|
|
$(call obj-suf-foreach,$(ldbl-ibm128-files)): \
|
|
sysdep-CFLAGS += -mabi=ibmlongdouble
|