]>
Commit | Line | Data |
---|---|---|
581c785b | 1 | # Copyright (C) 1991-2022 Free Software Foundation, Inc. |
28f540f4 RM |
2 | # This file is part of the GNU C Library. |
3 | ||
4 | # The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
5 | # modify it under the terms of the GNU Lesser General Public |
6 | # License as published by the Free Software Foundation; either | |
7 | # version 2.1 of the License, or (at your option) any later version. | |
28f540f4 RM |
8 | |
9 | # The GNU C Library is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | # Lesser General Public License for more details. |
28f540f4 | 13 | |
41bdb6e2 | 14 | # You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 15 | # License along with the GNU C Library; if not, see |
5a82c748 | 16 | # <https://www.gnu.org/licenses/>. |
28f540f4 RM |
17 | |
18 | # | |
19 | # Makefile for stdlib routines | |
20 | # | |
21 | subdir := stdlib | |
22 | ||
a5f891ac JM |
23 | include ../Makeconfig |
24 | ||
d275970a AZ |
25 | headers := \ |
26 | alloca.h \ | |
27 | bits/errno.h \ | |
28 | bits/indirect-return.h \ | |
29 | bits/monetary-ldbl.h \ | |
30 | bits/stdint-intn.h \ | |
31 | bits/stdint-uintn.h \ | |
32 | bits/stdlib-bsearch.h \ | |
33 | bits/stdlib-float.h \ | |
34 | bits/stdlib.h \ | |
35 | bits/stdlib-ldbl.h \ | |
36 | bits/time64.h \ | |
37 | bits/timesize.h \ | |
38 | bits/types/error_t.h \ | |
39 | bits/wordsize.h \ | |
40 | errno.h \ | |
41 | fmtmsg.h \ | |
42 | inttypes.h \ | |
43 | monetary.h \ | |
44 | stdint.h \ | |
45 | stdlib.h \ | |
46 | sys/errno.h \ | |
47 | sys/random.h \ | |
48 | sys/ucontext.h \ | |
49 | ucontext.h \ | |
50 | # headers | |
51 | ||
52 | routines := \ | |
53 | a64l \ | |
54 | abort \ | |
55 | abs \ | |
6f4e0fcf AZN |
56 | arc4random \ |
57 | arc4random_uniform \ | |
d275970a AZ |
58 | at_quick_exit \ |
59 | atof \ | |
60 | atoi \ | |
61 | atol\ | |
62 | atoll \ | |
63 | bsearch \ | |
64 | canonicalize \ | |
65 | cxa_at_quick_exit \ | |
66 | cxa_atexit \ | |
67 | cxa_finalize \ | |
68 | cxa_thread_atexit_impl \ | |
69 | div \ | |
70 | drand48 \ | |
71 | drand48-iter \ | |
72 | drand48_r \ | |
73 | erand48 \ | |
74 | erand48_r \ | |
75 | exit \ | |
76 | fmtmsg \ | |
77 | getcontext \ | |
78 | getentropy \ | |
79 | getenv \ | |
80 | getrandom \ | |
81 | getsubopt \ | |
82 | jrand48 \ | |
83 | jrand48_r \ | |
84 | l64a \ | |
85 | labs \ | |
86 | lcong48 \ | |
87 | lcong48_r \ | |
88 | ldiv \ | |
89 | llabs \ | |
90 | lldiv \ | |
91 | lrand48 \ | |
92 | lrand48_r \ | |
93 | makecontext \ | |
94 | mblen \ | |
95 | mbstowcs \ | |
96 | mbtowc \ | |
97 | mrand48 \ | |
98 | mrand48_r \ | |
99 | msort \ | |
100 | nrand48 \ | |
101 | nrand48_r \ | |
102 | old_atexit \ | |
103 | on_exit atexit \ | |
104 | putenv \ | |
105 | qsort \ | |
106 | quick_exit \ | |
107 | rand \ | |
108 | rand_r \ | |
109 | random \ | |
110 | random_r \ | |
111 | rpmatch \ | |
112 | secure-getenv \ | |
113 | seed48 \ | |
114 | seed48_r \ | |
115 | setcontext \ | |
116 | setenv \ | |
117 | srand48 \ | |
118 | srand48_r \ | |
119 | strfmon \ | |
120 | strfmon_l \ | |
121 | strfromd \ | |
122 | strfromf \ | |
123 | strfroml \ | |
124 | strtod \ | |
125 | strtod_l \ | |
126 | strtod_nan \ | |
127 | strtof \ | |
128 | strtof_l \ | |
129 | strtof_nan \ | |
130 | strtol \ | |
131 | strtol_l \ | |
132 | strtold \ | |
133 | strtold_l \ | |
134 | strtold_nan \ | |
135 | strtoll \ | |
136 | strtoll_l \ | |
137 | strtoul \ | |
138 | strtoul_l \ | |
139 | strtoull \ | |
140 | strtoull_l \ | |
141 | swapcontext \ | |
142 | system \ | |
143 | wcstombs \ | |
144 | wctomb \ | |
145 | xpg_basename \ | |
146 | # routines | |
147 | ||
148 | aux = \ | |
149 | grouping \ | |
150 | groupingwc \ | |
151 | tens_in_limb \ | |
152 | # aux | |
28f540f4 | 153 | |
c08bc50a UD |
154 | # These routines will be omitted from the libc shared object. |
155 | # Instead the static object files will be included in a special archive | |
156 | # linked against when the shared library will be used. | |
d275970a AZ |
157 | static-only-routines = \ |
158 | atexit \ | |
159 | at_quick_exit \ | |
160 | # static-only-routines | |
161 | ||
162 | test-srcs := \ | |
163 | tst-fmtmsg \ | |
164 | #test-srcs | |
c08bc50a | 165 | |
f9dab1b5 SP |
166 | tests := \ |
167 | bug-fmtmsg1 \ | |
168 | bug-getcontext \ | |
169 | bug-strtod \ | |
170 | bug-strtod2 \ | |
171 | test-a64l \ | |
172 | test-at_quick_exit-race \ | |
173 | test-atexit-race \ | |
174 | test-bz22786 \ | |
175 | test-canon \ | |
176 | test-canon2 \ | |
177 | test-cxa_atexit-race \ | |
178 | test-cxa_atexit-race2 \ | |
179 | test-dlclose-exit-race \ | |
180 | test-on_exit-race \ | |
181 | testdiv \ | |
182 | testmb \ | |
183 | testmb2 \ | |
184 | testrand \ | |
185 | testsort \ | |
8dd890d9 AZN |
186 | tst-arc4random-fork \ |
187 | tst-arc4random-stats \ | |
188 | tst-arc4random-thread \ | |
f9dab1b5 SP |
189 | tst-at_quick_exit \ |
190 | tst-atexit \ | |
191 | tst-atof1 \ | |
192 | tst-atof2 \ | |
193 | tst-bsearch \ | |
194 | tst-bz20544 \ | |
195 | tst-canon-bz26341 \ | |
196 | tst-cxa_atexit \ | |
197 | tst-environ \ | |
198 | tst-getrandom \ | |
199 | tst-limits \ | |
200 | tst-makecontext \ | |
201 | tst-makecontext-align \ | |
202 | tst-makecontext2 \ | |
203 | tst-makecontext3 \ | |
204 | tst-on_exit \ | |
205 | tst-qsort \ | |
206 | tst-qsort2 \ | |
207 | tst-quick_exit \ | |
208 | tst-rand48 \ | |
209 | tst-rand48-2 \ | |
210 | tst-random \ | |
211 | tst-random2 \ | |
212 | tst-realpath \ | |
ee8d5e33 | 213 | tst-realpath-toolong \ |
f9dab1b5 SP |
214 | tst-secure-getenv \ |
215 | tst-setcontext \ | |
216 | tst-setcontext2 \ | |
217 | tst-setcontext3 \ | |
218 | tst-setcontext4 \ | |
219 | tst-setcontext5 \ | |
220 | tst-setcontext6 \ | |
221 | tst-setcontext7 \ | |
222 | tst-setcontext8 \ | |
223 | tst-setcontext9 \ | |
224 | tst-strfmon_l \ | |
225 | tst-strfrom \ | |
226 | tst-strfrom-locale \ | |
227 | tst-strtod \ | |
228 | tst-strtod-nan-locale \ | |
229 | tst-strtod-nan-sign \ | |
230 | tst-strtod-overflow \ | |
231 | tst-strtod-round \ | |
232 | tst-strtod-underflow \ | |
233 | tst-strtod2 \ | |
234 | tst-strtod5 \ | |
235 | tst-strtod6 \ | |
236 | tst-strtol \ | |
237 | tst-strtol-locale \ | |
238 | tst-strtoll \ | |
239 | tst-swapcontext1 \ | |
240 | tst-thread-quick_exit \ | |
241 | tst-tininess \ | |
242 | tst-unsetenv1 \ | |
243 | tst-width \ | |
244 | tst-width-stdint \ | |
245 | tst-xpg-basename \ | |
d275970a AZ |
246 | # tests |
247 | ||
248 | tests-internal := \ | |
249 | tst-strtod1i \ | |
250 | tst-strtod3 \ | |
251 | tst-strtod4 \ | |
252 | tst-strtod5i \ | |
253 | tst-tls-atexit \ | |
254 | tst-tls-atexit-nodelete \ | |
255 | # tests-internal | |
5f3b183d | 256 | |
d275970a AZ |
257 | tests-static := \ |
258 | tst-secure-getenv \ | |
259 | # tests-static | |
260 | ||
261 | tests-container := \ | |
262 | tst-system \ | |
263 | #tests-container | |
7c3018f9 | 264 | |
41389c40 | 265 | ifeq ($(build-hardcoded-path-in-tests),yes) |
d275970a AZ |
266 | tests += \ |
267 | tst-empty-env \ | |
268 | # tests | |
41389c40 | 269 | endif |
7c3018f9 | 270 | |
26e70aec PP |
271 | LDLIBS-test-atexit-race = $(shared-thread-library) |
272 | LDLIBS-test-at_quick_exit-race = $(shared-thread-library) | |
273 | LDLIBS-test-cxa_atexit-race = $(shared-thread-library) | |
16adc58e | 274 | LDLIBS-test-cxa_atexit-race2 = $(shared-thread-library) |
26e70aec | 275 | LDLIBS-test-on_exit-race = $(shared-thread-library) |
961d7cff | 276 | LDLIBS-tst-canon-bz26341 = $(shared-thread-library) |
8dd890d9 AZN |
277 | LDLIBS-tst-arc4random-fork = $(shared-thread-library) |
278 | LDLIBS-tst-arc4random-thread = $(shared-thread-library) | |
26e70aec | 279 | |
6f1c7010 | 280 | LDLIBS-test-dlclose-exit-race = $(shared-thread-library) |
e5e4d7cc PP |
281 | LDFLAGS-test-dlclose-exit-race = $(LDFLAGS-rdynamic) |
282 | LDLIBS-test-dlclose-exit-race-helper.so = $(libsupport) $(shared-thread-library) | |
283 | ||
47dd3543 CD |
284 | ifeq ($(have-cxx-thread_local),yes) |
285 | CFLAGS-tst-quick_exit.o = -std=c++11 | |
286 | LDLIBS-tst-quick_exit = -lstdc++ | |
287 | CFLAGS-tst-thread-quick_exit.o = -std=c++11 | |
288 | LDLIBS-tst-thread-quick_exit = -lstdc++ | |
289 | $(objpfx)tst-thread-quick_exit: $(shared-thread-library) | |
290 | else | |
d275970a AZ |
291 | tests-unsupported += \ |
292 | tst-quick_exit \ | |
293 | tst-thread-quick_exit \ | |
294 | # tests-unsupported | |
47dd3543 | 295 | endif |
28f540f4 | 296 | |
d275970a AZ |
297 | modules-names = \ |
298 | test-dlclose-exit-race-helper \ | |
299 | tst-tls-atexit-lib \ | |
300 | # modules-names | |
b4bcb3ae | 301 | extra-test-objs += $(addsuffix .os, $(modules-names)) |
ba384f6e | 302 | |
574b268e | 303 | ifeq ($(build-shared),yes) |
d275970a AZ |
304 | tests += \ |
305 | tst-putenv \ | |
306 | # tests | |
574b268e | 307 | endif |
3ef21326 RM |
308 | |
309 | # Several mpn functions from GNU MP are used by the strtod function. | |
d275970a AZ |
310 | mpn-routines := \ |
311 | add_n \ | |
312 | addmul_1 \ | |
313 | cmp \ | |
314 | divmod_1 \ | |
315 | divrem \ | |
316 | inlines \ | |
317 | lshift \ | |
318 | mod_1 \ | |
319 | mul \ | |
320 | mul_1 \ | |
321 | mul_n \ | |
322 | rshift \ | |
323 | sub_n \ | |
324 | submul_1 \ | |
325 | udiv_qrnnd \ | |
326 | # mpn-routines | |
327 | mpn-headers = \ | |
328 | asm-syntax.h \ | |
329 | gmp-impl.h \ | |
330 | gmp-mparam.h \ | |
331 | gmp.h \ | |
332 | longlong.h \ | |
333 | # mpn-headers | |
3ef21326 | 334 | |
d275970a AZ |
335 | routines := \ |
336 | $(strip $(routines) $(mpn-routines)) \ | |
337 | dbl2mpn \ | |
338 | ldbl2mpn \ | |
339 | mpn2dbl \ | |
340 | mpn2flt \ | |
341 | mpn2ldbl \ | |
342 | # routines | |
343 | aux += \ | |
344 | fpioconst \ | |
345 | mp_clz_tab \ | |
346 | # aux | |
574b268e | 347 | |
d275970a AZ |
348 | tests-extras += \ |
349 | tst-putenvmod \ | |
350 | # tests-extras | |
dd06af4f | 351 | |
d275970a AZ |
352 | extra-test-objs += \ |
353 | tst-putenvmod.os \ | |
354 | # extra-test-objs | |
3ef21326 | 355 | |
d275970a AZ |
356 | generated += \ |
357 | isomac \ | |
358 | isomac.out \ | |
359 | tst-putenvmod.so \ | |
360 | # generated | |
3ef21326 | 361 | |
36975e8e L |
362 | CFLAGS-bsearch.c += $(uses-callbacks) |
363 | CFLAGS-msort.c += $(uses-callbacks) | |
364 | CFLAGS-qsort.c += $(uses-callbacks) | |
365 | CFLAGS-system.c += -fexceptions | |
6bbc689e | 366 | CFLAGS-system.os = -fomit-frame-pointer |
36975e8e | 367 | CFLAGS-fmtmsg.c += -fexceptions |
dff14448 | 368 | |
36975e8e L |
369 | CFLAGS-strfmon.c += $(libio-mtsafe) |
370 | CFLAGS-strfmon_l.c += $(libio-mtsafe) | |
917e27b8 | 371 | |
6962682f GG |
372 | # The strfrom class of functions call __printf_fp in order to convert the |
373 | # floating-point value to characters. This requires the value of IO_MTSAFE_IO. | |
36975e8e L |
374 | CFLAGS-strfromd.c += $(libio-mtsafe) |
375 | CFLAGS-strfromf.c += $(libio-mtsafe) | |
376 | CFLAGS-strfroml.c += $(libio-mtsafe) | |
6962682f | 377 | |
36975e8e L |
378 | CFLAGS-tst-bsearch.c += $(stack-align-test-flags) |
379 | CFLAGS-tst-qsort.c += $(stack-align-test-flags) | |
e535ce25 | 380 | CFLAGS-tst-makecontext.c += -funwind-tables |
36975e8e | 381 | CFLAGS-tst-makecontext2.c += $(stack-align-test-flags) |
a4db3439 | 382 | |
464d189b NG |
383 | CFLAGS-testmb.c += -D_FORTIFY_SOURCE=2 -Wall -Werror |
384 | ||
385 | ||
f214606a JM |
386 | # Run a test on the header files we use. |
387 | tests-special += $(objpfx)isomac.out | |
388 | ||
389 | ifeq ($(run-built-tests),yes) | |
390 | tests-special += $(objpfx)tst-fmtmsg.out | |
391 | endif | |
392 | ||
28f540f4 | 393 | include ../Rules |
3ef21326 | 394 | |
f881f6ff | 395 | ifeq ($(run-built-tests),yes) |
d275970a AZ |
396 | LOCALES := \ |
397 | cs_CZ.UTF-8 \ | |
398 | de_DE.UTF-8 \ | |
399 | el_GR.UTF-8 \ | |
400 | en_US.ISO-8859-1 \ | |
401 | hi_IN.UTF-8 \ | |
402 | hr_HR.UTF-8 \ | |
403 | tg_TJ.UTF-8 \ | |
404 | tr_TR.ISO-8859-9 \ | |
405 | tr_TR.UTF-8 \ | |
406 | # LOCALES | |
f881f6ff AS |
407 | include ../gen-locales.mk |
408 | ||
409 | $(objpfx)bug-strtod2.out: $(gen-locales) | |
410 | $(objpfx)testmb2.out: $(gen-locales) | |
411 | $(objpfx)tst-strtod.out: $(gen-locales) | |
e4890300 | 412 | $(objpfx)tst-strtod1i.out: $(gen-locales) |
f881f6ff AS |
413 | $(objpfx)tst-strtod3.out: $(gen-locales) |
414 | $(objpfx)tst-strtod4.out: $(gen-locales) | |
415 | $(objpfx)tst-strtod5.out: $(gen-locales) | |
e4890300 | 416 | $(objpfx)tst-strtod5i.out: $(gen-locales) |
f5eee5c7 | 417 | $(objpfx)tst-strtol-locale.out: $(gen-locales) |
a7f0c5ae | 418 | $(objpfx)tst-strtod-nan-locale.out: $(gen-locales) |
985fc132 | 419 | $(objpfx)tst-strfmon_l.out: $(gen-locales) |
cd74aa4d RS |
420 | $(objpfx)tst-strfrom.out: $(gen-locales) |
421 | $(objpfx)tst-strfrom-locale.out: $(gen-locales) | |
e5e4d7cc | 422 | $(objpfx)test-dlclose-exit-race.out: $(objpfx)test-dlclose-exit-race-helper.so |
f881f6ff AS |
423 | endif |
424 | ||
e25054c4 | 425 | # Testdir has to be named stdlib and needs to be writable |
9f835f5f | 426 | test-canon-ARGS = --test-dir=${common-objpfx}stdlib |
e25054c4 | 427 | |
400aa020 | 428 | bug-fmtmsg1-ENV = SEV_LEVEL=foo,11,newsev |
98d3e993 | 429 | |
ca41028b | 430 | $(objpfx)isomac.out: $(objpfx)isomac |
7eff7a05 | 431 | $(dir $<)$(notdir $<) '$(CC)' \ |
d5afb385 | 432 | '-I../include $(+sysdep-includes) $(sysincludes) -I..' > $@; \ |
f0881698 | 433 | $(evaluate-test) |
1eb687d0 | 434 | |
e69924e3 | 435 | isomac-CFLAGS = -O |
1eb687d0 UD |
436 | $(objpfx)isomac: isomac.c |
437 | $(native-compile) | |
9f6c1fc4 UD |
438 | |
439 | $(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg | |
8540f6d2 JM |
440 | $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \ |
441 | '$(run-program-env)' '$(test-program-prefix-after-env)' \ | |
8f8052c2 | 442 | $(common-objpfx)stdlib/; \ |
f0881698 | 443 | $(evaluate-test) |
574b268e UD |
444 | |
445 | $(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so | |
8b196ac4 | 446 | LDFLAGS-tst-putenv = -Wl,--no-as-needed |
574b268e | 447 | |
fab7ce3f | 448 | $(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps) |
574b268e | 449 | $(build-module) |
9cd47470 | 450 | libof-tst-putenvmod = extramodules |
75ea32ab | 451 | |
79520f4b | 452 | $(objpfx)bug-getcontext: $(libm) |
45f39d45 | 453 | $(objpfx)bug-strtod2: $(libm) |
79520f4b JM |
454 | $(objpfx)tst-strtod-round: $(libm) |
455 | $(objpfx)tst-tininess: $(libm) | |
456 | $(objpfx)tst-strtod-underflow: $(libm) | |
457 | $(objpfx)tst-strtod6: $(libm) | |
a7f0c5ae | 458 | $(objpfx)tst-strtod-nan-locale: $(libm) |
b12c1e79 | 459 | $(objpfx)tst-strtod-nan-sign: $(libm) |
ba384f6e SP |
460 | |
461 | tst-tls-atexit-lib.so-no-z-defs = yes | |
e5e4d7cc | 462 | test-dlclose-exit-race-helper.so-no-z-defs = yes |
ba384f6e | 463 | |
6f1c7010 | 464 | $(objpfx)tst-tls-atexit: $(shared-thread-library) |
ba384f6e | 465 | $(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so |
c92d40c0 | 466 | |
6f1c7010 | 467 | $(objpfx)tst-tls-atexit-nodelete: $(shared-thread-library) |
90b37cac SP |
468 | $(objpfx)tst-tls-atexit-nodelete.out: $(objpfx)tst-tls-atexit-lib.so |
469 | ||
c92d40c0 CD |
470 | $(objpfx)tst-setcontext3.out: tst-setcontext3.sh $(objpfx)tst-setcontext3 |
471 | $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \ | |
472 | '$(run-program-env)' '$(test-program-prefix-after-env)' \ | |
8f8052c2 | 473 | $(common-objpfx)stdlib/; \ |
c92d40c0 | 474 | $(evaluate-test) |