about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
blob: 6d5414c54a7fa3758e0837a2df5e31ee2d873a4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
ifeq ($(subdir),libio)
ldbl-extra-routines += fwscanf \
		       swscanf \
		       wscanf \
		       vswscanf \
		       vwscanf
endif

ifeq ($(subdir),wcsmbs)
ldbl-extra-routines += isoc99_fwscanf \
		       isoc99_swscanf \
		       isoc99_wscanf \
		       isoc99_vfwscanf \
		       isoc99_vswscanf \
		       isoc99_vwscanf

tests-internal += test-wcstold-ibm128 test-wcstold-ieee128
CFLAGS-test-wcstold-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-test-wcstold-ibm128.c += -mabi=ibmlongdouble -Wno-psabi

$(objpfx)test-wcstold-ieee128: gnulib-tests += $(f128-loader-link)
endif

ifeq ($(subdir),stdio-common)
ldbl-extra-routines += printf_size \
		       asprintf \
		       dprintf \
		       fprintf \
		       printf \
		       snprintf \
		       sprintf \
		       vasprintf \
		       vdprintf \
		       vfprintf \
		       vprintf \
		       vsnprintf \
		       vsprintf \
		       fwprintf \
		       swprintf \
		       wprintf \
		       vfwprintf \
		       vswprintf \
		       vwprintf \
		       fscanf \
		       scanf \
		       sscanf \
		       vfscanf \
		       vscanf \
		       vsscanf \
		       vfwscanf \
		       obprintf \
		       obstack_chk \
		       vobstack_chk \
		       isoc99_fscanf \
		       isoc99_scanf \
		       isoc99_sscanf \
		       isoc99_vfscanf \
		       isoc99_vscanf \
		       isoc99_vsscanf

# 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).  Likewise, reading these
# values reuses __strtof128_internal.  Thus, the compilation of the
# following functions, must have -mfloat128 and -mabi=ibmlongdouble
# passed to the compiler.
CFLAGS-vfprintf-internal.c += -mfloat128 -mabi=ibmlongdouble
CFLAGS-vfwprintf-internal.c += -mfloat128 -mabi=ibmlongdouble
CFLAGS-vfscanf-internal.c += -mfloat128 -mabi=ibmlongdouble
CFLAGS-vfwscanf-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-wprintf-ieee128 test-wprintf-ibm128
CFLAGS-test-wprintf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-test-wprintf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi

tests-internal += test-obstack-ieee128 test-obstack-ibm128
CFLAGS-test-obstack-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-test-obstack-ibm128.c += -mabi=ibmlongdouble -Wno-psabi

tests-internal += test-obstack-chk-ieee128 test-obstack-chk-ibm128
CFLAGS-test-obstack-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-test-obstack-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi

tests-internal += test-scanf-ieee128 test-scanf-ibm128
CFLAGS-test-scanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
CFLAGS-test-scanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE

$(objpfx)test-scanf-ieee128: gnulib-tests += $(f128-loader-link)

tests-internal += test-wscanf-ieee128 test-wscanf-ibm128
CFLAGS-test-wscanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
CFLAGS-test-wscanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE

$(objpfx)test-wscanf-ieee128: gnulib-tests += $(f128-loader-link)

tests-internal += test-isoc99-scanf-ieee128 test-isoc99-scanf-ibm128
CFLAGS-test-isoc99-scanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c99
CFLAGS-test-isoc99-scanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c99

$(objpfx)test-isoc99-scanf-ieee128: gnulib-tests += $(f128-loader-link)

tests-internal += test-isoc99-wscanf-ieee128 test-isoc99-wscanf-ibm128
CFLAGS-test-isoc99-wscanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c99
CFLAGS-test-isoc99-wscanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c99

$(objpfx)test-isoc99-wscanf-ieee128: gnulib-tests += $(f128-loader-link)

ifeq ($(run-built-tests),yes)
tests-special += $(objpfx)test-scanf-ieee128.out
tests-special += $(objpfx)test-scanf-ibm128.out

tests-special += $(objpfx)test-wscanf-ieee128.out
tests-special += $(objpfx)test-wscanf-ibm128.out

tests-special += $(objpfx)test-isoc99-scanf-ieee128.out
tests-special += $(objpfx)test-isoc99-scanf-ibm128.out

tests-special += $(objpfx)test-isoc99-wscanf-ieee128.out
tests-special += $(objpfx)test-isoc99-wscanf-ibm128.out
endif

$(objpfx)test-scanf-ieee128.out: \
  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
  $(objpfx)test-scanf-ieee128
	$(SHELL) $^ '$(test-program-prefix)' $@; \
	$(evaluate-test)

$(objpfx)test-scanf-ibm128.out: \
  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
  $(objpfx)test-scanf-ibm128
	$(SHELL) $^ '$(test-program-prefix)' $@; \
	$(evaluate-test)

$(objpfx)test-wscanf-ieee128.out: \
  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
  $(objpfx)test-wscanf-ieee128
	$(SHELL) $^ '$(test-program-prefix)' $@; \
	$(evaluate-test)

$(objpfx)test-wscanf-ibm128.out: \
  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
  $(objpfx)test-wscanf-ibm128
	$(SHELL) $^ '$(test-program-prefix)' $@; \
	$(evaluate-test)

$(objpfx)test-isoc99-scanf-ieee128.out: \
  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
  $(objpfx)test-isoc99-scanf-ieee128
	$(SHELL) $^ '$(test-program-prefix)' $@; \
	$(evaluate-test)

$(objpfx)test-isoc99-scanf-ibm128.out: \
  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
  $(objpfx)test-isoc99-scanf-ibm128
	$(SHELL) $^ '$(test-program-prefix)' $@; \
	$(evaluate-test)

$(objpfx)test-isoc99-wscanf-ieee128.out: \
  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
  $(objpfx)test-isoc99-wscanf-ieee128
	$(SHELL) $^ '$(test-program-prefix)' $@; \
	$(evaluate-test)

$(objpfx)test-isoc99-wscanf-ibm128.out: \
  ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
  $(objpfx)test-isoc99-wscanf-ibm128
	$(SHELL) $^ '$(test-program-prefix)' $@; \
	$(evaluate-test)

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

ifeq ($(subdir),debug)
ldbl-extra-routines += asprintf_chk \
		       dprintf_chk \
		       fprintf_chk \
		       printf_chk \
		       snprintf_chk \
		       sprintf_chk \
		       vasprintf_chk \
		       vdprintf_chk \
		       vfprintf_chk \
		       vprintf_chk \
		       vsnprintf_chk \
		       vsprintf_chk \
		       fwprintf_chk \
		       swprintf_chk \
		       wprintf_chk \
		       vfwprintf_chk \
		       vswprintf_chk \
		       vwprintf_chk

tests-internal += test-printf-chk-ieee128 test-printf-chk-ibm128
CFLAGS-test-printf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-test-printf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi

tests-internal += test-printf-chk-redir-ieee128 test-printf-chk-redir-ibm128
CFLAGS-test-printf-chk-redir-ieee128.c += -mfloat128 -mabi=ieeelongdouble \
					  -Wno-psabi -Wno-unused-result
CFLAGS-test-printf-chk-redir-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
					 -Wno-unused-result

tests-internal += test-wprintf-chk-ieee128 test-wprintf-chk-ibm128
CFLAGS-test-wprintf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-test-wprintf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi

tests-internal += test-wprintf-chk-redir-ieee128 test-wprintf-chk-redir-ibm128
CFLAGS-test-wprintf-chk-redir-ieee128.c += -mfloat128 -mabi=ieeelongdouble \
					   -Wno-psabi -Wno-unused-result
CFLAGS-test-wprintf-chk-redir-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
					  -Wno-unused-result
endif

ifeq ($(subdir),argp)
ldbl-extra-routines += argp-help

$(objpfx)tst-ieee128-argp.c: tst-ldbl-argp.c
	cp $< $@

$(objpfx)tst-ibm128-argp.c: tst-ldbl-argp.c
	cp $< $@

tests-internal += tst-ieee128-argp tst-ibm128-argp
CFLAGS-tst-ieee128-argp.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-tst-ibm128-argp.c += -mabi=ibmlongdouble -Wno-psabi
endif

ifeq ($(subdir),misc)
ldbl-extra-routines += err \
		       error \
		       syslog

tests-internal += tst-ibm128-warn tst-ieee128-warn
tests-internal += tst-ibm128-error tst-ieee128-error

$(objpfx)tst-ibm128-%.c: tst-ldbl-%.c
	cp $< $@

$(objpfx)tst-ieee128-%.c: tst-ldbl-%.c
	cp $< $@

CFLAGS-tst-ibm128-warn.c += -mabi=ibmlongdouble -Wno-psabi
CFLAGS-tst-ibm128-error.c += -mabi=ibmlongdouble -Wno-psabi

CFLAGS-tst-ieee128-warn.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-tst-ieee128-error.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi

tests-container += test-syslog-ieee128 test-syslog-ibm128
CFLAGS-test-syslog-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-test-syslog-ibm128.c += -mabi=ibmlongdouble -Wno-psabi

tests-container += test-syslog-chk-ieee128 test-syslog-chk-ibm128
CFLAGS-test-syslog-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-test-syslog-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
endif

ifeq ($(subdir),stdlib)
ldbl-extra-routines += strfmon strfmon_l

# 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 files, must have -mfloat128 passed to the compiler.
# Also, guarantee that they are compiled in IBM long double mode.
CFLAGS-strfmon.c += -mfloat128 -mabi=ibmlongdouble
CFLAGS-strfmon_l.c += -mfloat128 -mabi=ibmlongdouble

tests-internal += test-strfmon-ibm128 test-strfmon-ieee128
CFLAGS-test-strfmon-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
CFLAGS-test-strfmon-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
$(objpfx)tst-strfmon-ibm128.out: $(gen-locales)
$(objpfx)tst-strfmon-ieee128.out: $(gen-locales)

tests-internal += test-strfrom-ibm128 test-strfrom-ieee128
CFLAGS-test-strfrom-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
CFLAGS-test-strfrom-ibm128.c += -mabi=ibmlongdouble -Wno-psabi

$(objpfx)test-strfrom-ieee128: gnulib-tests += $(f128-loader-link)
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