1ifeq ($(subdir),libio)
2ldbl-extra-routines += fwscanf \
3		       fwprintf \
4		       obprintf \
5		       swscanf \
6		       swprintf \
7		       wscanf \
8		       vasprintf \
9		       vdprintf \
10		       vscanf \
11		       vsprintf \
12		       vsnprintf \
13		       vsscanf \
14		       vswprintf \
15		       vswscanf \
16		       vwprintf \
17		       vwscanf \
18		       wprintf
19endif
20
21ifeq ($(subdir),wcsmbs)
22ldbl-extra-routines += isoc99_fwscanf \
23		       isoc99_swscanf \
24		       isoc99_wscanf \
25		       isoc99_vfwscanf \
26		       isoc99_vswscanf \
27		       isoc99_vwscanf
28
29tests-internal += test-wcstold-ibm128 test-wcstold-ieee128
30CFLAGS-test-wcstold-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
31CFLAGS-test-wcstold-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
32
33endif
34
35ifeq ($(subdir),stdio-common)
36ldbl-extra-routines += printf_size \
37		       asprintf \
38		       dprintf \
39		       fprintf \
40		       printf \
41		       snprintf \
42		       sprintf \
43		       vfprintf \
44		       vprintf \
45		       vfwprintf \
46		       fscanf \
47		       scanf \
48		       sscanf \
49		       vfscanf \
50		       vfwscanf \
51		       isoc99_fscanf \
52		       isoc99_scanf \
53		       isoc99_sscanf \
54		       isoc99_vfscanf \
55		       isoc99_vscanf \
56		       isoc99_vsscanf
57
58# Printing long double values with IEEE binary128 format reuses part
59# of the internal float128 implementation (__printf_fp, __printf_fphex,
60# and __float128 variables and union members).  Likewise, reading these
61# values reuses __strtof128_internal.  Thus, the compilation of the
62# following functions, must have -mfloat128 and -mabi=ibmlongdouble
63# passed to the compiler.
64CFLAGS-vfprintf-internal.c += -mfloat128 -mabi=ibmlongdouble
65CFLAGS-vfwprintf-internal.c += -mfloat128 -mabi=ibmlongdouble
66CFLAGS-vfscanf-internal.c += -mfloat128 -mabi=ibmlongdouble
67CFLAGS-vfwscanf-internal.c += -mfloat128 -mabi=ibmlongdouble
68
69# Basic tests for the implementation of long double with IEEE binary128
70# format and for the related redirections in installed headers.
71tests-internal += test-printf-ieee128 test-printf-ibm128
72CFLAGS-test-printf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
73CFLAGS-test-printf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
74
75tests-internal += test-wprintf-ieee128 test-wprintf-ibm128
76CFLAGS-test-wprintf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
77CFLAGS-test-wprintf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
78
79tests-internal += test-obstack-ieee128 test-obstack-ibm128
80CFLAGS-test-obstack-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
81CFLAGS-test-obstack-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
82
83tests-internal += test-obstack-chk-ieee128 test-obstack-chk-ibm128
84CFLAGS-test-obstack-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
85CFLAGS-test-obstack-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
86
87tests-internal += test-scanf-ieee128 test-scanf-ibm128
88CFLAGS-test-scanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
89CFLAGS-test-scanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
90
91tests-internal += test-wscanf-ieee128 test-wscanf-ibm128
92CFLAGS-test-wscanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
93CFLAGS-test-wscanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
94
95tests-internal += test-isoc99-scanf-ieee128 test-isoc99-scanf-ibm128
96CFLAGS-test-isoc99-scanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c99
97CFLAGS-test-isoc99-scanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c99
98
99tests-internal += test-isoc99-wscanf-ieee128 test-isoc99-wscanf-ibm128
100CFLAGS-test-isoc99-wscanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c99
101CFLAGS-test-isoc99-wscanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c99
102
103ifeq ($(run-built-tests),yes)
104tests-special += $(objpfx)test-scanf-ieee128.out
105tests-special += $(objpfx)test-scanf-ibm128.out
106
107tests-special += $(objpfx)test-wscanf-ieee128.out
108tests-special += $(objpfx)test-wscanf-ibm128.out
109
110tests-special += $(objpfx)test-isoc99-scanf-ieee128.out
111tests-special += $(objpfx)test-isoc99-scanf-ibm128.out
112
113tests-special += $(objpfx)test-isoc99-wscanf-ieee128.out
114tests-special += $(objpfx)test-isoc99-wscanf-ibm128.out
115endif
116
117$(objpfx)test-scanf-ieee128.out: \
118  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
119  $(objpfx)test-scanf-ieee128
120	$(SHELL) $^ '$(test-program-prefix)' $@; \
121	$(evaluate-test)
122
123$(objpfx)test-scanf-ibm128.out: \
124  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
125  $(objpfx)test-scanf-ibm128
126	$(SHELL) $^ '$(test-program-prefix)' $@; \
127	$(evaluate-test)
128
129$(objpfx)test-wscanf-ieee128.out: \
130  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
131  $(objpfx)test-wscanf-ieee128
132	$(SHELL) $^ '$(test-program-prefix)' $@; \
133	$(evaluate-test)
134
135$(objpfx)test-wscanf-ibm128.out: \
136  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
137  $(objpfx)test-wscanf-ibm128
138	$(SHELL) $^ '$(test-program-prefix)' $@; \
139	$(evaluate-test)
140
141$(objpfx)test-isoc99-scanf-ieee128.out: \
142  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
143  $(objpfx)test-isoc99-scanf-ieee128
144	$(SHELL) $^ '$(test-program-prefix)' $@; \
145	$(evaluate-test)
146
147$(objpfx)test-isoc99-scanf-ibm128.out: \
148  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
149  $(objpfx)test-isoc99-scanf-ibm128
150	$(SHELL) $^ '$(test-program-prefix)' $@; \
151	$(evaluate-test)
152
153$(objpfx)test-isoc99-wscanf-ieee128.out: \
154  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
155  $(objpfx)test-isoc99-wscanf-ieee128
156	$(SHELL) $^ '$(test-program-prefix)' $@; \
157	$(evaluate-test)
158
159$(objpfx)test-isoc99-wscanf-ibm128.out: \
160  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
161  $(objpfx)test-isoc99-wscanf-ibm128
162	$(SHELL) $^ '$(test-program-prefix)' $@; \
163	$(evaluate-test)
164
165tests-internal += test-printf-size-ieee128 test-printf-size-ibm128
166CFLAGS-test-printf-size-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
167CFLAGS-test-printf-size-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
168
169ifeq ($(run-built-tests),yes)
170tests-special += $(objpfx)test-printf-size-ieee128.out
171tests-special += $(objpfx)test-printf-size-ibm128.out
172endif
173
174$(objpfx)test-printf-size-ieee128.out: \
175  tst-printfsz-islongdouble.sh $(objpfx)test-printf-size-ieee128
176	$(SHELL) $^ '$(test-program-prefix)' $@; \
177	$(evaluate-test)
178
179$(objpfx)test-printf-size-ibm128.out: \
180  tst-printfsz-islongdouble.sh $(objpfx)test-printf-size-ibm128
181	$(SHELL) $^ '$(test-program-prefix)' $@; \
182	$(evaluate-test)
183endif
184
185ifeq ($(subdir),debug)
186ldbl-extra-routines += asprintf_chk \
187		       dprintf_chk \
188		       fprintf_chk \
189		       printf_chk \
190		       snprintf_chk \
191		       sprintf_chk \
192		       vasprintf_chk \
193		       vdprintf_chk \
194		       vfprintf_chk \
195		       vprintf_chk \
196		       vsnprintf_chk \
197		       vsprintf_chk \
198		       fwprintf_chk \
199		       swprintf_chk \
200		       wprintf_chk \
201		       vfwprintf_chk \
202		       vswprintf_chk \
203		       vwprintf_chk \
204		       obstack_chk \
205		       vobstack_chk
206
207tests-internal += test-printf-chk-ieee128 test-printf-chk-ibm128
208CFLAGS-test-printf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
209CFLAGS-test-printf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
210
211tests-internal += test-printf-chk-redir-ieee128 test-printf-chk-redir-ibm128
212CFLAGS-test-printf-chk-redir-ieee128.c += -mfloat128 -mabi=ieeelongdouble \
213					  -Wno-psabi -Wno-unused-result
214CFLAGS-test-printf-chk-redir-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
215					 -Wno-unused-result
216
217tests-internal += test-wprintf-chk-ieee128 test-wprintf-chk-ibm128
218CFLAGS-test-wprintf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
219CFLAGS-test-wprintf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
220
221tests-internal += test-wprintf-chk-redir-ieee128 test-wprintf-chk-redir-ibm128
222CFLAGS-test-wprintf-chk-redir-ieee128.c += -mfloat128 -mabi=ieeelongdouble \
223					   -Wno-psabi -Wno-unused-result
224CFLAGS-test-wprintf-chk-redir-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
225					  -Wno-unused-result
226endif
227
228ifeq ($(subdir),argp)
229ldbl-extra-routines += argp-help
230
231$(objpfx)tst-ieee128-argp.c: tst-ldbl-argp.c
232	cp $< $@
233
234$(objpfx)tst-ibm128-argp.c: tst-ldbl-argp.c
235	cp $< $@
236
237tests-internal += tst-ieee128-argp tst-ibm128-argp
238CFLAGS-tst-ieee128-argp.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
239CFLAGS-tst-ibm128-argp.c += -mabi=ibmlongdouble -Wno-psabi
240endif
241
242ifeq ($(subdir),misc)
243ldbl-extra-routines += err \
244		       error \
245		       syslog \
246		       qefgcvt \
247		       qefgcvt_r
248
249CFLAGS-ieee128-qefgcvt.c += -mabi=ieeelongdouble -Wno-psabi -mno-gnu-attribute
250CFLAGS-ieee128-qefgcvt_r.c += -mabi=ieeelongdouble -Wno-psabi -mno-gnu-attribute
251
252tests-internal += tst-ibm128-warn tst-ieee128-warn
253tests-internal += tst-ibm128-error tst-ieee128-error
254tests-internal += tst-ibm128-efgcvt tst-ieee128-efgcvt
255
256$(objpfx)tst-ibm128-%.c: tst-ldbl-%.c
257	cp $< $@
258
259$(objpfx)tst-ieee128-%.c: tst-ldbl-%.c
260	cp $< $@
261
262CFLAGS-tst-ibm128-warn.c += -mabi=ibmlongdouble -Wno-psabi
263CFLAGS-tst-ibm128-error.c += -mabi=ibmlongdouble -Wno-psabi
264CFLAGS-tst-ibm128-efgcvt.c += -mabi=ibmlongdouble -Wno-psabi
265
266CFLAGS-tst-ieee128-warn.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
267CFLAGS-tst-ieee128-error.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
268CFLAGS-tst-ieee128-efgcvt.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
269
270tests-container += test-syslog-ieee128 test-syslog-ibm128
271CFLAGS-test-syslog-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
272CFLAGS-test-syslog-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
273
274tests-container += test-syslog-chk-ieee128 test-syslog-chk-ibm128
275CFLAGS-test-syslog-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
276CFLAGS-test-syslog-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
277endif
278
279ifeq ($(subdir),stdlib)
280ldbl-extra-routines += strfmon strfmon_l
281
282# Printing long double values with IEEE binary128 format reuses part
283# of the internal float128 implementation (__printf_fp, __printf_fphex,
284# and __float128 variables and union members).  Thus, the compilation of
285# the following files, must have -mfloat128 passed to the compiler.
286# Also, guarantee that they are compiled in IBM long double mode.
287CFLAGS-strfmon.c += -mfloat128 -mabi=ibmlongdouble
288CFLAGS-strfmon_l.c += -mfloat128 -mabi=ibmlongdouble
289
290tests-internal += test-strfmon-ibm128 test-strfmon-ieee128
291CFLAGS-test-strfmon-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
292CFLAGS-test-strfmon-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
293$(objpfx)tst-strfmon-ibm128.out: $(gen-locales)
294$(objpfx)tst-strfmon-ieee128.out: $(gen-locales)
295
296tests-internal += test-strfrom-ibm128 test-strfrom-ieee128
297CFLAGS-test-strfrom-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
298CFLAGS-test-strfrom-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
299
300endif
301
302ifeq ($(subdir),math)
303# The totalorder{,mag} compatibility tests were added prior to this
304# support.  Thus, they can only correctly be used with ibm128.
305CFLAGS-test-ldouble-compat_totalorder.c += -mabi=ibmlongdouble
306CFLAGS-test-ldouble-compat_totalordermag.c += -mabi=ibmlongdouble
307endif
308
309# Add IEEE binary128 files as make targets.
310routines += $(foreach r,$(ldbl-extra-routines),ieee128-$(r))
311
312# On powerpc64le, the routines responsible for converting between long
313# double and string (e.g.: printf, scanf, strtold, strfroml) default to
314# IBM long double mode.  When support for TS 18661-3 was added, several
315# internal functions were modified so that they could also handle
316# floating-point variables with IEEE binary128 format, but as an
317# additional type, _Float128.
318#
319# The following rule ensures that the string conversion routines will
320# always be built in IBM long double mode, with additional support for
321# IEEE binary128, through the use of -mabi=ibmlongdouble and -mfloat128.
322ldbl-ibm128-files := $(objpfx)test-%-ibm128^ \
323		     $(objpfx)iovdprintf^ \
324		     $(objpfx)iovsprintf^ \
325		     $(objpfx)iovsscanf^ \
326		     $(objpfx)iovswscanf^ \
327		     $(objpfx)iovfscanf^ \
328		     $(objpfx)mpn2ldbl^ \
329		     $(objpfx)ldbl2mpn^ \
330		     $(objpfx)strtold_nan^ \
331		     $(objpfx)strtold_l^ \
332		     $(objpfx)strtold^ \
333		     $(objpfx)strfroml^ \
334		     $(objpfx)wcstold_nan^ \
335		     $(objpfx)wcstold_l^ \
336		     $(objpfx)wcstold^ \
337		     $(objpfx)printf_fphex^ \
338		     $(objpfx)printf_fp^ \
339		     $(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)^) \
340		     $(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)-internal^)
341obj-suf-foreach = $(foreach suf,$(all-object-suffixes),$(subst ^,$(suf),$(1)))
342
343# Explicitly add -mabi=ibm-long-double to required files.
344$(call obj-suf-foreach,$(ldbl-ibm128-files)): \
345  sysdep-CFLAGS += -mabi=ibmlongdouble
346