-# Copyright (C) 1991-2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1991-2014 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
#
# Makefile for stdlib routines
#
subdir := stdlib
-headers := stdlib.h alloca.h monetary.h fmtmsg.h ucontext.h sys/ucontext.h \
- inttypes.h stdint.h bits/wordsize.h bits/wchar.h \
- errno.h sys/errno.h bits/errno.h
+include ../Makeconfig
+
+headers := stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h \
+ monetary.h bits/monetary-ldbl.h \
+ inttypes.h stdint.h bits/wordsize.h \
+ errno.h sys/errno.h bits/errno.h \
+ ucontext.h sys/ucontext.h \
+ alloca.h fmtmsg.h \
+ bits/stdlib-bsearch.h
routines := \
atof atoi atol atoll \
bsearch qsort msort \
getenv putenv setenv secure-getenv \
exit on_exit atexit cxa_atexit cxa_finalize old_atexit \
+ quick_exit at_quick_exit cxa_at_quick_exit cxa_thread_atexit_impl \
abs labs llabs \
div ldiv lldiv \
mblen mbstowcs mbtowc wcstombs wctomb \
rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg \
strtoimax strtoumax wcstoimax wcstoumax \
getcontext setcontext makecontext swapcontext
-aux = grouping groupingwc
+aux = grouping groupingwc tens_in_limb
# These routines will be omitted from the libc shared object.
# Instead the static object files will be included in a special archive
# linked against when the shared library will be used.
-static-only-routines = atexit
+static-only-routines = atexit at_quick_exit
-distribute := exit.h grouping.h abort-instr.h isomac.c tst-fmtmsg.sh \
- allocalim.h
test-srcs := tst-fmtmsg
tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
test-canon test-canon2 tst-strtoll tst-environ \
- tst-xpg-basename tst-random tst-bsearch tst-limits \
- tst-rand48 bug-strtod tst-setcontext test-a64l tst-qsort \
- tst-system
-
+ tst-xpg-basename tst-random tst-random2 tst-bsearch \
+ tst-limits tst-rand48 bug-strtod tst-setcontext \
+ test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
+ tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
+ tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2 \
+ tst-makecontext2 tst-strtod6 tst-unsetenv1 \
+ tst-makecontext3 bug-getcontext bug-fmtmsg1 \
+ tst-secure-getenv tst-strtod-overflow tst-strtod-round \
+ tst-tininess tst-strtod-underflow tst-tls-atexit
+tests-static := tst-secure-getenv
+
+modules-names = tst-tls-atexit-lib
+
+ifeq ($(build-shared),yes)
+tests += tst-putenv
+endif
# Several mpn functions from GNU MP are used by the strtod function.
mpn-routines := inlines add_n addmul_1 cmp divmod_1 divrem udiv_qrnnd \
dbl2mpn ldbl2mpn \
mpn2flt mpn2dbl mpn2ldbl
aux += fpioconst mp_clz_tab
-distribute := $(distribute) $(mpn-headers) gen-mpn-copy fpioconst.h
-generated += isomac isomac.out
+tests-extras += tst-putenvmod
+extra-test-objs += tst-putenvmod.os
-CFLAGS-bsearch.c = $(exceptions)
-CFLAGS-msort.c = $(exceptions)
-CFLAGS-qsort.c = $(exceptions)
+generated += isomac isomac.out tst-putenvmod.so
+
+CFLAGS-bsearch.c = $(uses-callbacks)
+CFLAGS-msort.c = $(uses-callbacks)
+CFLAGS-qsort.c = $(uses-callbacks)
CFLAGS-system.c = -fexceptions
-CFLAGS-mkstemp.c = -fexceptions
+CFLAGS-system.os = -fomit-frame-pointer
CFLAGS-fmtmsg.c = -fexceptions
-include ../Makeconfig
+CFLAGS-strfmon.c = $(libio-mtsafe)
+CFLAGS-strfmon_l.c = $(libio-mtsafe)
-ifneq (,$(filter %REENTRANT, $(defines)))
-CFLAGS-strfmon.c = -D_IO_MTSAFE_IO
-CFLAGS-strfmon_l.c = -D_IO_MTSAFE_IO
-endif
-
-ifeq (yes,$(have-protected))
-CFLAGS-atexit.c = -DHAVE_DOT_HIDDEN
-endif
+CFLAGS-tst-bsearch.c = $(stack-align-test-flags)
+CFLAGS-tst-qsort.c = $(stack-align-test-flags)
+CFLAGS-tst-makecontext2.c = $(stack-align-test-flags)
include ../Rules
test-canon-ARGS = --test-dir=${common-objpfx}stdlib
tst-strtod-ENV = LOCPATH=$(common-objpfx)localedata
+tst-strtod3-ENV = LOCPATH=$(common-objpfx)localedata
+tst-strtod4-ENV = LOCPATH=$(common-objpfx)localedata
+tst-strtod5-ENV = LOCPATH=$(common-objpfx)localedata
+testmb2-ENV = LOCPATH=$(common-objpfx)localedata
+bug-fmtmsg1-ENV = SEV_LEVEL=foo,11,newsev
# Run a test on the header files we use.
tests: $(objpfx)isomac.out
-ifeq (no,$(cross-compiling))
+ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-fmtmsg.out
endif
$(objpfx)isomac.out: $(objpfx)isomac
$(dir $<)$(notdir $<) '$(CC)' \
- '-I../include -I.. $(+sysdep-includes) $(sysincludes)' > $<.out
+ '-I../include $(+sysdep-includes) $(sysincludes) -I..' > $<.out; \
+ $(evaluate-test)
isomac-CFLAGS = -O
$(objpfx)isomac: isomac.c
$(native-compile)
$(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)stdlib/
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)stdlib/; \
+ $(evaluate-test)
+
+$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
+LDFLAGS-tst-putenv = $(no-as-needed)
+
+$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps)
+ $(build-module)
+CFLAGS-tst-putenvmod.c = -DNOT_IN_libc=1
+
+ifeq ($(build-shared),yes)
+link-libm = $(common-objpfx)math/libm.so
+else
+link-libm = $(common-objpfx)math/libm.a
+endif
+$(objpfx)bug-getcontext: $(link-libm)
+$(objpfx)tst-strtod-round: $(link-libm)
+$(objpfx)tst-tininess: $(link-libm)
+$(objpfx)tst-strtod-underflow: $(link-libm)
+$(objpfx)tst-strtod6: $(link-libm)
+
+tst-tls-atexit-lib.so-no-z-defs = yes
+
+$(objpfx)tst-tls-atexit: $(common-objpfx)nptl/libpthread.so \
+ $(common-objpfx)dlfcn/libdl.so
+$(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so