1 # Copyright (C) 1991-2022 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
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.
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
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <https://www.gnu.org/licenses/>.
19 # Makefile for stdlib routines
28 bits
/indirect-return.h \
29 bits
/monetary-ldbl.h \
32 bits
/stdlib-bsearch.h \
38 bits
/types
/error_t.h \
68 cxa_thread_atexit_impl \
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.
157 static-only-routines
= \
160 # static-only-routines
172 test-at_quick_exit-race \
177 test-cxa_atexit-race \
178 test-cxa_atexit-race2 \
179 test-dlclose-exit-race \
186 tst-arc4random-fork \
187 tst-arc4random-stats \
188 tst-arc4random-thread \
201 tst-makecontext-align \
213 tst-realpath-toolong \
228 tst-strtod-nan-locale \
229 tst-strtod-nan-sign \
230 tst-strtod-overflow \
232 tst-strtod-underflow \
240 tst-thread-quick_exit \
249 tst-arc4random-chacha20 \
255 tst-tls-atexit-nodelete \
259 tst-arc4random-chacha20 \
267 ifeq ($(build-hardcoded-path-in-tests
),yes
)
273 LDLIBS-test-atexit-race
= $(shared-thread-library
)
274 LDLIBS-test-at_quick_exit-race
= $(shared-thread-library
)
275 LDLIBS-test-cxa_atexit-race
= $(shared-thread-library
)
276 LDLIBS-test-cxa_atexit-race2
= $(shared-thread-library
)
277 LDLIBS-test-on_exit-race
= $(shared-thread-library
)
278 LDLIBS-tst-canon-bz26341
= $(shared-thread-library
)
279 LDLIBS-tst-arc4random-fork
= $(shared-thread-library
)
280 LDLIBS-tst-arc4random-thread
= $(shared-thread-library
)
282 LDLIBS-test-dlclose-exit-race
= $(shared-thread-library
)
283 LDFLAGS-test-dlclose-exit-race
= $(LDFLAGS-rdynamic
)
284 LDLIBS-test-dlclose-exit-race-helper.so
= $(libsupport
) $(shared-thread-library
)
286 ifeq ($(have-cxx-thread_local
),yes
)
287 CFLAGS-tst-quick_exit.o
= -std
=c
++11
288 LDLIBS-tst-quick_exit
= -lstdc
++
289 CFLAGS-tst-thread-quick_exit.o
= -std
=c
++11
290 LDLIBS-tst-thread-quick_exit
= -lstdc
++
291 $(objpfx
)tst-thread-quick_exit
: $(shared-thread-library
)
293 tests-unsupported
+= \
295 tst-thread-quick_exit \
300 test-dlclose-exit-race-helper \
303 extra-test-objs
+= $(addsuffix .os
, $(modules-names
))
305 ifeq ($(build-shared
),yes
)
311 # Several mpn functions from GNU MP are used by the strtod function.
338 $(strip $(routines
) $(mpn-routines
)) \
364 CFLAGS-bsearch.c
+= $(uses-callbacks
)
365 CFLAGS-msort.c
+= $(uses-callbacks
)
366 CFLAGS-qsort.c
+= $(uses-callbacks
)
367 CFLAGS-system.c
+= -fexceptions
368 CFLAGS-system.os
= -fomit-frame-pointer
369 CFLAGS-fmtmsg.c
+= -fexceptions
371 CFLAGS-strfmon.c
+= $(libio-mtsafe
)
372 CFLAGS-strfmon_l.c
+= $(libio-mtsafe
)
374 # The strfrom class of functions call __printf_fp in order to convert the
375 # floating-point value to characters. This requires the value of IO_MTSAFE_IO.
376 CFLAGS-strfromd.c
+= $(libio-mtsafe
)
377 CFLAGS-strfromf.c
+= $(libio-mtsafe
)
378 CFLAGS-strfroml.c
+= $(libio-mtsafe
)
380 CFLAGS-tst-bsearch.c
+= $(stack-align-test-flags
)
381 CFLAGS-tst-qsort.c
+= $(stack-align-test-flags
)
382 CFLAGS-tst-makecontext.c
+= -funwind-tables
383 CFLAGS-tst-makecontext2.c
+= $(stack-align-test-flags
)
385 CFLAGS-testmb.c
+= -D_FORTIFY_SOURCE
=2 -Wall
-Werror
388 # Run a test on the header files we use.
389 tests-special
+= $(objpfx
)isomac.out
391 ifeq ($(run-built-tests
),yes
)
392 tests-special
+= $(objpfx
)tst-fmtmsg.out
397 ifeq ($(run-built-tests
),yes
)
409 include ..
/gen-locales.mk
411 $(objpfx
)bug-strtod2.out
: $(gen-locales
)
412 $(objpfx
)testmb2.out
: $(gen-locales
)
413 $(objpfx
)tst-strtod.out
: $(gen-locales
)
414 $(objpfx
)tst-strtod1i.out
: $(gen-locales
)
415 $(objpfx
)tst-strtod3.out
: $(gen-locales
)
416 $(objpfx
)tst-strtod4.out
: $(gen-locales
)
417 $(objpfx
)tst-strtod5.out
: $(gen-locales
)
418 $(objpfx
)tst-strtod5i.out
: $(gen-locales
)
419 $(objpfx
)tst-strtol-locale.out
: $(gen-locales
)
420 $(objpfx
)tst-strtod-nan-locale.out
: $(gen-locales
)
421 $(objpfx
)tst-strfmon_l.out
: $(gen-locales
)
422 $(objpfx
)tst-strfrom.out
: $(gen-locales
)
423 $(objpfx
)tst-strfrom-locale.out
: $(gen-locales
)
424 $(objpfx
)test-dlclose-exit-race.out
: $(objpfx
)test-dlclose-exit-race-helper.so
427 # Testdir has to be named stdlib and needs to be writable
428 test-canon-ARGS
= --test-dir
=${common-objpfx
}stdlib
430 bug-fmtmsg1-ENV
= SEV_LEVEL
=foo
,11,newsev
432 $(objpfx
)isomac.out
: $(objpfx
)isomac
433 $(dir $<)$(notdir $<) '$(CC)' \
434 '-I../include $(+sysdep-includes) $(sysincludes) -I..' > $@
; \
438 $(objpfx
)isomac
: isomac.c
441 $(objpfx
)tst-fmtmsg.out
: tst-fmtmsg.sh
$(objpfx
)tst-fmtmsg
442 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix-before-env)' \
443 '$(run-program-env)' '$(test-program-prefix-after-env)' \
444 $(common-objpfx
)stdlib
/; \
447 $(objpfx
)tst-putenv
: $(objpfx
)tst-putenvmod.so
448 LDFLAGS-tst-putenv
= -Wl
,--no-as-needed
450 $(objpfx
)tst-putenvmod.so
: $(objpfx
)tst-putenvmod.os
$(link-libc-deps
)
452 libof-tst-putenvmod
= extramodules
454 $(objpfx
)bug-getcontext
: $(libm
)
455 $(objpfx
)bug-strtod2
: $(libm
)
456 $(objpfx
)tst-strtod-round
: $(libm
)
457 $(objpfx
)tst-tininess
: $(libm
)
458 $(objpfx
)tst-strtod-underflow
: $(libm
)
459 $(objpfx
)tst-strtod6
: $(libm
)
460 $(objpfx
)tst-strtod-nan-locale
: $(libm
)
461 $(objpfx
)tst-strtod-nan-sign
: $(libm
)
463 tst-tls-atexit-lib.so-no-z-defs
= yes
464 test-dlclose-exit-race-helper.so-no-z-defs
= yes
466 $(objpfx
)tst-tls-atexit
: $(shared-thread-library
)
467 $(objpfx
)tst-tls-atexit.out
: $(objpfx
)tst-tls-atexit-lib.so
469 $(objpfx
)tst-tls-atexit-nodelete
: $(shared-thread-library
)
470 $(objpfx
)tst-tls-atexit-nodelete.out
: $(objpfx
)tst-tls-atexit-lib.so
472 $(objpfx
)tst-setcontext3.out
: tst-setcontext3.sh
$(objpfx
)tst-setcontext3
473 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix-before-env)' \
474 '$(run-program-env)' '$(test-program-prefix-after-env)' \
475 $(common-objpfx
)stdlib
/; \