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 \
66 cxa_thread_atexit_impl \
152 # These routines will be omitted from the libc shared object.
153 # Instead the static object files will be included in a special archive
154 # linked against when the shared library will be used.
155 static-only-routines
= \
158 # static-only-routines
170 test-at_quick_exit-race \
175 test-cxa_atexit-race \
176 test-cxa_atexit-race2 \
177 test-dlclose-exit-race \
196 tst-makecontext-align \
208 tst-realpath-toolong \
223 tst-strtod-nan-locale \
224 tst-strtod-nan-sign \
225 tst-strtod-overflow \
227 tst-strtod-underflow \
235 tst-thread-quick_exit \
249 tst-tls-atexit-nodelete \
260 ifeq ($(build-hardcoded-path-in-tests
),yes
)
266 LDLIBS-test-atexit-race
= $(shared-thread-library
)
267 LDLIBS-test-at_quick_exit-race
= $(shared-thread-library
)
268 LDLIBS-test-cxa_atexit-race
= $(shared-thread-library
)
269 LDLIBS-test-cxa_atexit-race2
= $(shared-thread-library
)
270 LDLIBS-test-on_exit-race
= $(shared-thread-library
)
271 LDLIBS-tst-canon-bz26341
= $(shared-thread-library
)
273 LDLIBS-test-dlclose-exit-race
= $(shared-thread-library
)
274 LDFLAGS-test-dlclose-exit-race
= $(LDFLAGS-rdynamic
)
275 LDLIBS-test-dlclose-exit-race-helper.so
= $(libsupport
) $(shared-thread-library
)
277 ifeq ($(have-cxx-thread_local
),yes
)
278 CFLAGS-tst-quick_exit.o
= -std
=c
++11
279 LDLIBS-tst-quick_exit
= -lstdc
++
280 CFLAGS-tst-thread-quick_exit.o
= -std
=c
++11
281 LDLIBS-tst-thread-quick_exit
= -lstdc
++
282 $(objpfx
)tst-thread-quick_exit
: $(shared-thread-library
)
284 tests-unsupported
+= \
286 tst-thread-quick_exit \
291 test-dlclose-exit-race-helper \
294 extra-test-objs
+= $(addsuffix .os
, $(modules-names
))
296 ifeq ($(build-shared
),yes
)
302 # Several mpn functions from GNU MP are used by the strtod function.
329 $(strip $(routines
) $(mpn-routines
)) \
355 CFLAGS-bsearch.c
+= $(uses-callbacks
)
356 CFLAGS-msort.c
+= $(uses-callbacks
)
357 CFLAGS-qsort.c
+= $(uses-callbacks
)
358 CFLAGS-system.c
+= -fexceptions
359 CFLAGS-system.os
= -fomit-frame-pointer
360 CFLAGS-fmtmsg.c
+= -fexceptions
362 CFLAGS-strfmon.c
+= $(libio-mtsafe
)
363 CFLAGS-strfmon_l.c
+= $(libio-mtsafe
)
365 # The strfrom class of functions call __printf_fp in order to convert the
366 # floating-point value to characters. This requires the value of IO_MTSAFE_IO.
367 CFLAGS-strfromd.c
+= $(libio-mtsafe
)
368 CFLAGS-strfromf.c
+= $(libio-mtsafe
)
369 CFLAGS-strfroml.c
+= $(libio-mtsafe
)
371 CFLAGS-tst-bsearch.c
+= $(stack-align-test-flags
)
372 CFLAGS-tst-qsort.c
+= $(stack-align-test-flags
)
373 CFLAGS-tst-makecontext.c
+= -funwind-tables
374 CFLAGS-tst-makecontext2.c
+= $(stack-align-test-flags
)
376 CFLAGS-testmb.c
+= -D_FORTIFY_SOURCE
=2 -Wall
-Werror
379 # Run a test on the header files we use.
380 tests-special
+= $(objpfx
)isomac.out
382 ifeq ($(run-built-tests
),yes
)
383 tests-special
+= $(objpfx
)tst-fmtmsg.out
388 ifeq ($(run-built-tests
),yes
)
400 include ..
/gen-locales.mk
402 $(objpfx
)bug-strtod2.out
: $(gen-locales
)
403 $(objpfx
)testmb2.out
: $(gen-locales
)
404 $(objpfx
)tst-strtod.out
: $(gen-locales
)
405 $(objpfx
)tst-strtod1i.out
: $(gen-locales
)
406 $(objpfx
)tst-strtod3.out
: $(gen-locales
)
407 $(objpfx
)tst-strtod4.out
: $(gen-locales
)
408 $(objpfx
)tst-strtod5.out
: $(gen-locales
)
409 $(objpfx
)tst-strtod5i.out
: $(gen-locales
)
410 $(objpfx
)tst-strtol-locale.out
: $(gen-locales
)
411 $(objpfx
)tst-strtod-nan-locale.out
: $(gen-locales
)
412 $(objpfx
)tst-strfmon_l.out
: $(gen-locales
)
413 $(objpfx
)tst-strfrom.out
: $(gen-locales
)
414 $(objpfx
)tst-strfrom-locale.out
: $(gen-locales
)
415 $(objpfx
)test-dlclose-exit-race.out
: $(objpfx
)test-dlclose-exit-race-helper.so
418 # Testdir has to be named stdlib and needs to be writable
419 test-canon-ARGS
= --test-dir
=${common-objpfx
}stdlib
421 bug-fmtmsg1-ENV
= SEV_LEVEL
=foo
,11,newsev
423 $(objpfx
)isomac.out
: $(objpfx
)isomac
424 $(dir $<)$(notdir $<) '$(CC)' \
425 '-I../include $(+sysdep-includes) $(sysincludes) -I..' > $@
; \
429 $(objpfx
)isomac
: isomac.c
432 $(objpfx
)tst-fmtmsg.out
: tst-fmtmsg.sh
$(objpfx
)tst-fmtmsg
433 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix-before-env)' \
434 '$(run-program-env)' '$(test-program-prefix-after-env)' \
435 $(common-objpfx
)stdlib
/; \
438 $(objpfx
)tst-putenv
: $(objpfx
)tst-putenvmod.so
439 LDFLAGS-tst-putenv
= -Wl
,--no-as-needed
441 $(objpfx
)tst-putenvmod.so
: $(objpfx
)tst-putenvmod.os
$(link-libc-deps
)
443 libof-tst-putenvmod
= extramodules
445 $(objpfx
)bug-getcontext
: $(libm
)
446 $(objpfx
)bug-strtod2
: $(libm
)
447 $(objpfx
)tst-strtod-round
: $(libm
)
448 $(objpfx
)tst-tininess
: $(libm
)
449 $(objpfx
)tst-strtod-underflow
: $(libm
)
450 $(objpfx
)tst-strtod6
: $(libm
)
451 $(objpfx
)tst-strtod-nan-locale
: $(libm
)
452 $(objpfx
)tst-strtod-nan-sign
: $(libm
)
454 tst-tls-atexit-lib.so-no-z-defs
= yes
455 test-dlclose-exit-race-helper.so-no-z-defs
= yes
457 $(objpfx
)tst-tls-atexit
: $(shared-thread-library
)
458 $(objpfx
)tst-tls-atexit.out
: $(objpfx
)tst-tls-atexit-lib.so
460 $(objpfx
)tst-tls-atexit-nodelete
: $(shared-thread-library
)
461 $(objpfx
)tst-tls-atexit-nodelete.out
: $(objpfx
)tst-tls-atexit-lib.so
463 $(objpfx
)tst-setcontext3.out
: tst-setcontext3.sh
$(objpfx
)tst-setcontext3
464 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix-before-env)' \
465 '$(run-program-env)' '$(test-program-prefix-after-env)' \
466 $(common-objpfx
)stdlib
/; \