2023-01-06 21:08:04 +00:00
|
|
|
# Copyright (C) 1991-2023 Free Software Foundation, Inc.
|
1995-02-18 01:27:10 +00:00
|
|
|
# This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
# The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
|
|
|
# The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
# Lesser General Public License for more details.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
# License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
# <https://www.gnu.org/licenses/>.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Makefile for stdlib routines
|
|
|
|
#
|
|
|
|
subdir := stdlib
|
|
|
|
|
2014-02-26 23:12:03 +00:00
|
|
|
include ../Makeconfig
|
|
|
|
|
2022-04-08 12:57:57 +00:00
|
|
|
headers := \
|
|
|
|
alloca.h \
|
|
|
|
bits/errno.h \
|
|
|
|
bits/indirect-return.h \
|
|
|
|
bits/monetary-ldbl.h \
|
|
|
|
bits/stdint-intn.h \
|
|
|
|
bits/stdint-uintn.h \
|
|
|
|
bits/stdlib-bsearch.h \
|
|
|
|
bits/stdlib-float.h \
|
|
|
|
bits/stdlib-ldbl.h \
|
2023-05-11 18:35:55 +00:00
|
|
|
bits/stdlib.h \
|
2022-04-08 12:57:57 +00:00
|
|
|
bits/time64.h \
|
|
|
|
bits/timesize.h \
|
|
|
|
bits/types/error_t.h \
|
|
|
|
bits/wordsize.h \
|
|
|
|
errno.h \
|
|
|
|
fmtmsg.h \
|
|
|
|
inttypes.h \
|
|
|
|
monetary.h \
|
|
|
|
stdint.h \
|
|
|
|
stdlib.h \
|
|
|
|
sys/errno.h \
|
|
|
|
sys/random.h \
|
|
|
|
sys/ucontext.h \
|
|
|
|
ucontext.h \
|
|
|
|
# headers
|
|
|
|
|
|
|
|
routines := \
|
|
|
|
a64l \
|
|
|
|
abort \
|
|
|
|
abs \
|
stdlib: Add arc4random, arc4random_buf, and arc4random_uniform (BZ #4417)
The implementation is based on scalar Chacha20 with per-thread cache.
It uses getrandom or /dev/urandom as fallback to get the initial entropy,
and reseeds the internal state on every 16MB of consumed buffer.
To improve performance and lower memory consumption the per-thread cache
is allocated lazily on first arc4random functions call, and if the
memory allocation fails getentropy or /dev/urandom is used as fallback.
The cache is also cleared on thread exit iff it was initialized (so if
arc4random is not called it is not touched).
Although it is lock-free, arc4random is still not async-signal-safe
(the per thread state is not updated atomically).
The ChaCha20 implementation is based on RFC8439 [1], omitting the final
XOR of the keystream with the plaintext because the plaintext is a
stream of zeros. This strategy is similar to what OpenBSD arc4random
does.
The arc4random_uniform is based on previous work by Florian Weimer,
where the algorithm is based on Jérémie Lumbroso paper Optimal Discrete
Uniform Generation from Coin Flips, and Applications (2013) [2], who
credits Donald E. Knuth and Andrew C. Yao, The complexity of nonuniform
random number generation (1976), for solving the general case.
The main advantage of this method is the that the unit of randomness is not
the uniform random variable (uint32_t), but a random bit. It optimizes the
internal buffer sampling by initially consuming a 32-bit random variable
and then sampling byte per byte. Depending of the upper bound requested,
it might lead to better CPU utilization.
Checked on x86_64-linux-gnu, aarch64-linux, and powerpc64le-linux-gnu.
Co-authored-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Yann Droneaud <ydroneaud@opteya.com>
[1] https://datatracker.ietf.org/doc/html/rfc8439
[2] https://arxiv.org/pdf/1304.1916.pdf
2022-07-21 13:04:59 +00:00
|
|
|
arc4random \
|
|
|
|
arc4random_uniform \
|
2022-04-08 12:57:57 +00:00
|
|
|
at_quick_exit \
|
|
|
|
atof \
|
|
|
|
atoi \
|
|
|
|
atol\
|
2023-05-11 18:35:55 +00:00
|
|
|
atoll \
|
2022-04-08 12:57:57 +00:00
|
|
|
bsearch \
|
|
|
|
canonicalize \
|
|
|
|
cxa_at_quick_exit \
|
|
|
|
cxa_atexit \
|
|
|
|
cxa_finalize \
|
|
|
|
cxa_thread_atexit_impl \
|
|
|
|
div \
|
|
|
|
drand48 \
|
|
|
|
drand48-iter \
|
|
|
|
drand48_r \
|
|
|
|
erand48 \
|
|
|
|
erand48_r \
|
|
|
|
exit \
|
|
|
|
fmtmsg \
|
|
|
|
getcontext \
|
|
|
|
getentropy \
|
|
|
|
getenv \
|
|
|
|
getrandom \
|
|
|
|
getsubopt \
|
|
|
|
jrand48 \
|
|
|
|
jrand48_r \
|
|
|
|
l64a \
|
|
|
|
labs \
|
|
|
|
lcong48 \
|
|
|
|
lcong48_r \
|
|
|
|
ldiv \
|
|
|
|
llabs \
|
|
|
|
lldiv \
|
|
|
|
lrand48 \
|
|
|
|
lrand48_r \
|
|
|
|
makecontext \
|
|
|
|
mblen \
|
|
|
|
mbstowcs \
|
|
|
|
mbtowc \
|
|
|
|
mrand48 \
|
|
|
|
mrand48_r \
|
|
|
|
msort \
|
|
|
|
nrand48 \
|
|
|
|
nrand48_r \
|
|
|
|
old_atexit \
|
|
|
|
on_exit atexit \
|
|
|
|
putenv \
|
|
|
|
qsort \
|
|
|
|
quick_exit \
|
|
|
|
rand \
|
|
|
|
rand_r \
|
|
|
|
random \
|
|
|
|
random_r \
|
|
|
|
rpmatch \
|
|
|
|
secure-getenv \
|
|
|
|
seed48 \
|
|
|
|
seed48_r \
|
|
|
|
setcontext \
|
|
|
|
setenv \
|
|
|
|
srand48 \
|
|
|
|
srand48_r \
|
|
|
|
strfmon \
|
|
|
|
strfmon_l \
|
|
|
|
strfromd \
|
|
|
|
strfromf \
|
|
|
|
strfroml \
|
|
|
|
strtod \
|
|
|
|
strtod_l \
|
|
|
|
strtod_nan \
|
|
|
|
strtof \
|
|
|
|
strtof_l \
|
|
|
|
strtof_nan \
|
|
|
|
strtol \
|
|
|
|
strtol_l \
|
|
|
|
strtold \
|
|
|
|
strtold_l \
|
|
|
|
strtold_nan \
|
|
|
|
strtoll \
|
|
|
|
strtoll_l \
|
|
|
|
strtoul \
|
|
|
|
strtoul_l \
|
|
|
|
strtoull \
|
|
|
|
strtoull_l \
|
|
|
|
swapcontext \
|
|
|
|
system \
|
|
|
|
wcstombs \
|
|
|
|
wctomb \
|
|
|
|
xpg_basename \
|
|
|
|
# routines
|
|
|
|
|
|
|
|
aux = \
|
|
|
|
grouping \
|
|
|
|
groupingwc \
|
|
|
|
tens_in_limb \
|
|
|
|
# aux
|
1995-02-18 01:27:10 +00:00
|
|
|
|
2001-02-26 17:53:15 +00:00
|
|
|
# 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.
|
2022-04-08 12:57:57 +00:00
|
|
|
static-only-routines = \
|
|
|
|
at_quick_exit \
|
2023-05-11 18:35:55 +00:00
|
|
|
atexit \
|
2022-04-08 12:57:57 +00:00
|
|
|
# static-only-routines
|
|
|
|
|
|
|
|
test-srcs := \
|
|
|
|
tst-fmtmsg \
|
|
|
|
#test-srcs
|
2001-02-26 17:53:15 +00:00
|
|
|
|
2022-01-13 13:20:55 +00:00
|
|
|
tests := \
|
|
|
|
bug-fmtmsg1 \
|
|
|
|
bug-getcontext \
|
|
|
|
bug-strtod \
|
|
|
|
bug-strtod2 \
|
|
|
|
test-a64l \
|
|
|
|
test-at_quick_exit-race \
|
|
|
|
test-atexit-race \
|
2023-02-18 20:53:41 +00:00
|
|
|
test-atexit-recursive \
|
2022-01-13 13:20:55 +00:00
|
|
|
test-bz22786 \
|
|
|
|
test-canon \
|
|
|
|
test-canon2 \
|
|
|
|
test-cxa_atexit-race \
|
|
|
|
test-cxa_atexit-race2 \
|
|
|
|
test-dlclose-exit-race \
|
|
|
|
test-on_exit-race \
|
|
|
|
testdiv \
|
|
|
|
testmb \
|
|
|
|
testmb2 \
|
|
|
|
testrand \
|
|
|
|
testsort \
|
2023-04-04 13:57:45 +00:00
|
|
|
tst-abs \
|
2022-07-21 13:05:00 +00:00
|
|
|
tst-arc4random-fork \
|
|
|
|
tst-arc4random-stats \
|
|
|
|
tst-arc4random-thread \
|
2022-01-13 13:20:55 +00:00
|
|
|
tst-at_quick_exit \
|
|
|
|
tst-atexit \
|
|
|
|
tst-atof1 \
|
|
|
|
tst-atof2 \
|
|
|
|
tst-bsearch \
|
|
|
|
tst-bz20544 \
|
|
|
|
tst-canon-bz26341 \
|
|
|
|
tst-cxa_atexit \
|
|
|
|
tst-environ \
|
|
|
|
tst-getrandom \
|
2023-04-04 13:57:46 +00:00
|
|
|
tst-labs \
|
2022-01-13 13:20:55 +00:00
|
|
|
tst-limits \
|
2023-04-04 13:57:47 +00:00
|
|
|
tst-llabs \
|
2022-01-13 13:20:55 +00:00
|
|
|
tst-makecontext \
|
|
|
|
tst-makecontext-align \
|
|
|
|
tst-makecontext2 \
|
|
|
|
tst-makecontext3 \
|
|
|
|
tst-on_exit \
|
|
|
|
tst-qsort \
|
|
|
|
tst-qsort2 \
|
|
|
|
tst-quick_exit \
|
|
|
|
tst-rand48 \
|
|
|
|
tst-rand48-2 \
|
|
|
|
tst-random \
|
|
|
|
tst-random2 \
|
|
|
|
tst-realpath \
|
2022-01-13 05:58:36 +00:00
|
|
|
tst-realpath-toolong \
|
2022-01-13 13:20:55 +00:00
|
|
|
tst-secure-getenv \
|
|
|
|
tst-setcontext \
|
|
|
|
tst-setcontext2 \
|
|
|
|
tst-setcontext3 \
|
|
|
|
tst-setcontext4 \
|
|
|
|
tst-setcontext5 \
|
|
|
|
tst-setcontext6 \
|
|
|
|
tst-setcontext7 \
|
|
|
|
tst-setcontext8 \
|
|
|
|
tst-setcontext9 \
|
|
|
|
tst-strfmon_l \
|
|
|
|
tst-strfrom \
|
|
|
|
tst-strfrom-locale \
|
|
|
|
tst-strtod \
|
|
|
|
tst-strtod-nan-locale \
|
|
|
|
tst-strtod-nan-sign \
|
|
|
|
tst-strtod-overflow \
|
|
|
|
tst-strtod-round \
|
|
|
|
tst-strtod-underflow \
|
|
|
|
tst-strtod2 \
|
|
|
|
tst-strtod5 \
|
|
|
|
tst-strtod6 \
|
|
|
|
tst-strtol \
|
C2x strtol binary constant handling
C2x adds binary integer constants starting with 0b or 0B, and supports
those constants in strtol-family functions when the base passed is 0
or 2. Implement that strtol support for glibc.
As discussed at
<https://sourceware.org/pipermail/libc-alpha/2020-December/120414.html>,
this is incompatible with previous C standard versions, in that such
an input string starting with 0b or 0B was previously required to be
parsed as 0 (with the rest of the string unprocessed). Thus, as
proposed there, this patch adds 20 new __isoc23_* functions with
appropriate header redirection support. This patch does *not* do
anything about scanf %i (which will need 12 new functions per long
double variant, so 12, 24 or 36 depending on the glibc configuration),
instead leaving that for a future patch. The function names would
remain as __isoc23_* even if C2x ends up published in 2024 rather than
2023.
Making this change leads to the question of what should happen to
internal uses of these functions in glibc and its tests. The header
redirection (which applies for _GNU_SOURCE or any other feature test
macros enabling C2x features) has the effect of redirecting internal
uses but without those uses then ending up at a hidden alias (see the
comment in include/stdio.h about interaction with libc_hidden_proto).
It seems desirable for the default for internal uses to be the same
versions used by normal code using _GNU_SOURCE, so rather than doing
anything to disable that redirection, similar macro definitions to
those in include/stdio.h are added to the include/ headers for the new
functions.
Given that the default for uses in glibc is for the redirections to
apply, the next question is whether the C2x semantics are correct for
all those uses. Uses with the base fixed to 10, 16 or any other value
other than 0 or 2 can be ignored. I think this leaves the following
internal uses to consider (an important consideration for review of
this patch will be both whether this list is complete and whether my
conclusions on all entries in it are correct):
benchtests/bench-malloc-simple.c
benchtests/bench-string.h
elf/sotruss-lib.c
math/libm-test-support.c
nptl/perf.c
nscd/nscd_conf.c
nss/nss_files/files-parse.c
posix/tst-fnmatch.c
posix/wordexp.c
resolv/inet_addr.c
rt/tst-mqueue7.c
soft-fp/testit.c
stdlib/fmtmsg.c
support/support_test_main.c
support/test-container.c
sysdeps/pthread/tst-mutex10.c
I think all of these places are OK with the new semantics, except for
resolv/inet_addr.c, where the POSIX semantics of inet_addr do not
allow for binary constants; thus, I changed that file (to use
__strtoul_internal, whose semantics are unchanged) and added a test
for this case. In the case of posix/wordexp.c I think accepting
binary constants is OK since POSIX explicitly allows additional forms
of shell arithmetic expressions, and in stdlib/fmtmsg.c SEV_LEVEL is
not in POSIX so again I think accepting binary constants is OK.
Functions such as __strtol_internal, which are only exported for
compatibility with old binaries from when those were used in inline
functions in headers, have unchanged semantics; the __*_l_internal
versions (purely internal to libc and not exported) have a new
argument to specify whether to accept binary constants.
As well as for the standard functions, the header redirection also
applies to the *_l versions (GNU extensions), and to legacy functions
such as strtoq, to avoid confusing inconsistency (the *q functions
redirect to __isoc23_*ll rather than needing their own __isoc23_*
entry points). For the functions that are only declared with
_GNU_SOURCE, this means the old versions are no longer available for
normal user programs at all. An internal __GLIBC_USE_C2X_STRTOL macro
is used to control the redirections in the headers, and cases in glibc
that wish to avoid the redirections - the function implementations
themselves and the tests of the old versions of the GNU functions -
then undefine and redefine that macro to allow the old versions to be
accessed. (There would of course be greater complexity should we wish
to make any of the old versions into compat symbols / avoid them being
defined at all for new glibc ABIs.)
strtol_l.c has some similarity to strtol.c in gnulib, but has already
diverged some way (and isn't listed at all at
https://sourceware.org/glibc/wiki/SharedSourceFiles unlike strtoll.c
and strtoul.c); I haven't made any attempts at gnulib compatibility in
the changes to that file.
I note incidentally that inttypes.h and wchar.h are missing the
__nonnull present on declarations of this family of functions in
stdlib.h; I didn't make any changes in that regard for the new
declarations added.
2023-02-16 23:02:40 +00:00
|
|
|
tst-strtol-binary-c11 \
|
|
|
|
tst-strtol-binary-c2x \
|
|
|
|
tst-strtol-binary-gnu11 \
|
|
|
|
tst-strtol-binary-gnu2x \
|
2022-01-13 13:20:55 +00:00
|
|
|
tst-strtol-locale \
|
|
|
|
tst-strtoll \
|
|
|
|
tst-swapcontext1 \
|
|
|
|
tst-thread-quick_exit \
|
|
|
|
tst-tininess \
|
|
|
|
tst-unsetenv1 \
|
|
|
|
tst-width \
|
|
|
|
tst-width-stdint \
|
|
|
|
tst-xpg-basename \
|
2022-04-08 12:57:57 +00:00
|
|
|
# tests
|
|
|
|
|
|
|
|
tests-internal := \
|
|
|
|
tst-strtod1i \
|
|
|
|
tst-strtod3 \
|
|
|
|
tst-strtod4 \
|
|
|
|
tst-strtod5i \
|
|
|
|
tst-tls-atexit \
|
|
|
|
tst-tls-atexit-nodelete \
|
|
|
|
# tests-internal
|
2017-08-28 02:10:40 +00:00
|
|
|
|
2022-04-08 12:57:57 +00:00
|
|
|
tests-static := \
|
|
|
|
tst-secure-getenv \
|
|
|
|
# tests-static
|
|
|
|
|
|
|
|
tests-container := \
|
|
|
|
tst-system \
|
|
|
|
#tests-container
|
Suppress internal declarations for most of the testsuite.
This patch adds a new build module called 'testsuite'.
IS_IN (testsuite) implies _ISOMAC, as do IS_IN_build and __cplusplus
(which means several ad-hoc tests for __cplusplus can go away).
libc-symbols.h now suppresses almost all of *itself* when _ISOMAC is
defined; in particular, _ISOMAC mode does not get config.h
automatically anymore.
There are still quite a few tests that need to see internal gunk of
one variety or another. For them, we now have 'tests-internal' and
'test-internal-extras'; files in this category will still be compiled
with MODULE_NAME=nonlib, and everything proceeds as it always has.
The bulk of this patch is moving tests from 'tests' to
'tests-internal'. There is also 'tests-static-internal', which has
the same effect on files in 'tests-static', and 'modules-names-tests',
which has the *inverse* effect on files in 'modules-names' (it's
inverted because most of the things in modules-names are *not* tests).
For both of these, the file must appear in *both* the new variable and
the old one.
There is also now a special case for when libc-symbols.h is included
without MODULE_NAME being defined at all. (This happens during the
creation of libc-modules.h, and also when preprocessing Versions
files.) When this happens, IS_IN is set to be always false and
_ISOMAC is *not* defined, which was the status quo, but now it's
explicit.
The remaining changes to C source files in this patch seemed likely to
cause problems in the absence of the main change. They should be
relatively self-explanatory. In a few cases I duplicated a definition
from an internal header rather than move the test to tests-internal;
this was a judgement call each time and I'm happy to change those
however reviewers feel is more appropriate.
* Makerules: New subdir configuration variables 'tests-internal'
and 'test-internal-extras'. Test files in these categories will
still be compiled with MODULE_NAME=nonlib. Test files in the
existing categories (tests, xtests, test-srcs, test-extras) are
now compiled with MODULE_NAME=testsuite.
New subdir configuration variable 'modules-names-tests'. Files
which are in both 'modules-names' and 'modules-names-tests' will
be compiled with MODULE_NAME=testsuite instead of
MODULE_NAME=extramodules.
(gen-as-const-headers): Move to tests-internal.
(do-tests-clean, common-mostlyclean): Support tests-internal.
* Makeconfig (built-modules): Add testsuite.
* Makefile: Change libof-check-installed-headers-c and
libof-check-installed-headers-cxx to 'testsuite'.
* Rules: Likewise. Support tests-internal.
* benchtests/strcoll-inputs/filelist#en_US.UTF-8:
Remove extra-modules.mk.
* config.h.in: Don't check for __OPTIMIZE__ or __FAST_MATH__ here.
* include/libc-symbols.h: Move definitions of _GNU_SOURCE,
PASTE_NAME, PASTE_NAME1, IN_MODULE, IS_IN, and IS_IN_LIB to the
very top of the file and rationalize their order.
If MODULE_NAME is not defined at all, define IS_IN to always be
false, and don't define _ISOMAC.
If any of IS_IN (testsuite), IS_IN_build, or __cplusplus are
true, define _ISOMAC and suppress everything else in this file,
starting with the inclusion of config.h.
Do check for inappropriate definitions of __OPTIMIZE__ and
__FAST_MATH__ here, but only if _ISOMAC is not defined.
Correct some out-of-date commentary.
* include/math.h: If _ISOMAC is defined, undefine NO_LONG_DOUBLE
and _Mlong_double_ before including math.h.
* include/string.h: If _ISOMAC is defined, don't expose
_STRING_ARCH_unaligned. Move a comment to a more appropriate
location.
* include/errno.h, include/stdio.h, include/stdlib.h, include/string.h
* include/time.h, include/unistd.h, include/wchar.h: No need to
check __cplusplus nor use __BEGIN_DECLS/__END_DECLS.
* misc/sys/cdefs.h (__NTHNL): New macro.
* sysdeps/m68k/m680x0/fpu/bits/mathinline.h
(__m81_defun): Use __NTHNL to avoid errors with GCC 6.
* elf/tst-env-setuid-tunables.c: Include config.h with _LIBC
defined, for HAVE_TUNABLES.
* inet/tst-checks-posix.c: No need to define _ISOMAC.
* intl/tst-gettext2.c: Provide own definition of N_.
* math/test-signgam-finite-c99.c: No need to define _ISOMAC.
* math/test-signgam-main.c: No need to define _ISOMAC.
* stdlib/tst-strtod.c: Convert to test-driver. Split locale_test to...
* stdlib/tst-strtod1i.c: ...this new file.
* stdlib/tst-strtod5.c: Convert to test-driver and add copyright notice.
Split tests of __strtod_internal to...
* stdlib/tst-strtod5i.c: ...this new file.
* string/test-string.h: Include stdint.h. Duplicate definition of
inhibit_loop_to_libcall here (from libc-symbols.h).
* string/test-strstr.c: Provide dummy definition of
libc_hidden_builtin_def when including strstr.c.
* sysdeps/ia64/fpu/libm-symbols.h: Suppress entire file in _ISOMAC
mode; no need to test __STRICT_ANSI__ nor __cplusplus as well.
* sysdeps/x86_64/fpu/math-tests-arch.h: Include cpu-features.h.
Don't include init-arch.h.
* sysdeps/x86_64/multiarch/test-multiarch.h: Include cpu-features.h.
Don't include init-arch.h.
* elf/Makefile: Move tst-ptrguard1-static, tst-stackguard1-static,
tst-tls1-static, tst-tls2-static, tst-tls3-static, loadtest,
unload, unload2, circleload1, neededtest, neededtest2,
neededtest3, neededtest4, tst-tls1, tst-tls2, tst-tls3,
tst-tls6, tst-tls7, tst-tls8, tst-dlmopen2, tst-ptrguard1,
tst-stackguard1, tst-_dl_addr_inside_object, and all of the
ifunc tests to tests-internal.
Don't add $(modules-names) to test-extras.
* inet/Makefile: Move tst-inet6_scopeid_pton to tests-internal.
Add tst-deadline to tests-static-internal.
* malloc/Makefile: Move tst-mallocstate and tst-scratch_buffer to
tests-internal.
* misc/Makefile: Move tst-atomic and tst-atomic-long to tests-internal.
* nptl/Makefile: Move tst-typesizes, tst-rwlock19, tst-sem11,
tst-sem12, tst-sem13, tst-barrier5, tst-signal7, tst-tls3,
tst-tls3-malloc, tst-tls5, tst-stackguard1, tst-sem11-static,
tst-sem12-static, and tst-stackguard1-static to tests-internal.
Link tests-internal with libpthread also.
Don't add $(modules-names) to test-extras.
* nss/Makefile: Move tst-field to tests-internal.
* posix/Makefile: Move bug-regex5, bug-regex20, bug-regex33,
tst-rfc3484, tst-rfc3484-2, and tst-rfc3484-3 to tests-internal.
* stdlib/Makefile: Move tst-strtod1i, tst-strtod3, tst-strtod4,
tst-strtod5i, tst-tls-atexit, and tst-tls-atexit-nodelete to
tests-internal.
* sunrpc/Makefile: Move tst-svc_register to tests-internal.
* sysdeps/powerpc/Makefile: Move test-get_hwcap and
test-get_hwcap-static to tests-internal.
* sysdeps/unix/sysv/linux/Makefile: Move tst-setgetname to
tests-internal.
* sysdeps/x86_64/fpu/Makefile: Add all libmvec test modules to
modules-names-tests.
2016-11-21 01:46:30 +00:00
|
|
|
|
2017-01-19 19:15:09 +00:00
|
|
|
ifeq ($(build-hardcoded-path-in-tests),yes)
|
2022-04-08 12:57:57 +00:00
|
|
|
tests += \
|
|
|
|
tst-empty-env \
|
|
|
|
# tests
|
2017-01-19 19:15:09 +00:00
|
|
|
endif
|
Suppress internal declarations for most of the testsuite.
This patch adds a new build module called 'testsuite'.
IS_IN (testsuite) implies _ISOMAC, as do IS_IN_build and __cplusplus
(which means several ad-hoc tests for __cplusplus can go away).
libc-symbols.h now suppresses almost all of *itself* when _ISOMAC is
defined; in particular, _ISOMAC mode does not get config.h
automatically anymore.
There are still quite a few tests that need to see internal gunk of
one variety or another. For them, we now have 'tests-internal' and
'test-internal-extras'; files in this category will still be compiled
with MODULE_NAME=nonlib, and everything proceeds as it always has.
The bulk of this patch is moving tests from 'tests' to
'tests-internal'. There is also 'tests-static-internal', which has
the same effect on files in 'tests-static', and 'modules-names-tests',
which has the *inverse* effect on files in 'modules-names' (it's
inverted because most of the things in modules-names are *not* tests).
For both of these, the file must appear in *both* the new variable and
the old one.
There is also now a special case for when libc-symbols.h is included
without MODULE_NAME being defined at all. (This happens during the
creation of libc-modules.h, and also when preprocessing Versions
files.) When this happens, IS_IN is set to be always false and
_ISOMAC is *not* defined, which was the status quo, but now it's
explicit.
The remaining changes to C source files in this patch seemed likely to
cause problems in the absence of the main change. They should be
relatively self-explanatory. In a few cases I duplicated a definition
from an internal header rather than move the test to tests-internal;
this was a judgement call each time and I'm happy to change those
however reviewers feel is more appropriate.
* Makerules: New subdir configuration variables 'tests-internal'
and 'test-internal-extras'. Test files in these categories will
still be compiled with MODULE_NAME=nonlib. Test files in the
existing categories (tests, xtests, test-srcs, test-extras) are
now compiled with MODULE_NAME=testsuite.
New subdir configuration variable 'modules-names-tests'. Files
which are in both 'modules-names' and 'modules-names-tests' will
be compiled with MODULE_NAME=testsuite instead of
MODULE_NAME=extramodules.
(gen-as-const-headers): Move to tests-internal.
(do-tests-clean, common-mostlyclean): Support tests-internal.
* Makeconfig (built-modules): Add testsuite.
* Makefile: Change libof-check-installed-headers-c and
libof-check-installed-headers-cxx to 'testsuite'.
* Rules: Likewise. Support tests-internal.
* benchtests/strcoll-inputs/filelist#en_US.UTF-8:
Remove extra-modules.mk.
* config.h.in: Don't check for __OPTIMIZE__ or __FAST_MATH__ here.
* include/libc-symbols.h: Move definitions of _GNU_SOURCE,
PASTE_NAME, PASTE_NAME1, IN_MODULE, IS_IN, and IS_IN_LIB to the
very top of the file and rationalize their order.
If MODULE_NAME is not defined at all, define IS_IN to always be
false, and don't define _ISOMAC.
If any of IS_IN (testsuite), IS_IN_build, or __cplusplus are
true, define _ISOMAC and suppress everything else in this file,
starting with the inclusion of config.h.
Do check for inappropriate definitions of __OPTIMIZE__ and
__FAST_MATH__ here, but only if _ISOMAC is not defined.
Correct some out-of-date commentary.
* include/math.h: If _ISOMAC is defined, undefine NO_LONG_DOUBLE
and _Mlong_double_ before including math.h.
* include/string.h: If _ISOMAC is defined, don't expose
_STRING_ARCH_unaligned. Move a comment to a more appropriate
location.
* include/errno.h, include/stdio.h, include/stdlib.h, include/string.h
* include/time.h, include/unistd.h, include/wchar.h: No need to
check __cplusplus nor use __BEGIN_DECLS/__END_DECLS.
* misc/sys/cdefs.h (__NTHNL): New macro.
* sysdeps/m68k/m680x0/fpu/bits/mathinline.h
(__m81_defun): Use __NTHNL to avoid errors with GCC 6.
* elf/tst-env-setuid-tunables.c: Include config.h with _LIBC
defined, for HAVE_TUNABLES.
* inet/tst-checks-posix.c: No need to define _ISOMAC.
* intl/tst-gettext2.c: Provide own definition of N_.
* math/test-signgam-finite-c99.c: No need to define _ISOMAC.
* math/test-signgam-main.c: No need to define _ISOMAC.
* stdlib/tst-strtod.c: Convert to test-driver. Split locale_test to...
* stdlib/tst-strtod1i.c: ...this new file.
* stdlib/tst-strtod5.c: Convert to test-driver and add copyright notice.
Split tests of __strtod_internal to...
* stdlib/tst-strtod5i.c: ...this new file.
* string/test-string.h: Include stdint.h. Duplicate definition of
inhibit_loop_to_libcall here (from libc-symbols.h).
* string/test-strstr.c: Provide dummy definition of
libc_hidden_builtin_def when including strstr.c.
* sysdeps/ia64/fpu/libm-symbols.h: Suppress entire file in _ISOMAC
mode; no need to test __STRICT_ANSI__ nor __cplusplus as well.
* sysdeps/x86_64/fpu/math-tests-arch.h: Include cpu-features.h.
Don't include init-arch.h.
* sysdeps/x86_64/multiarch/test-multiarch.h: Include cpu-features.h.
Don't include init-arch.h.
* elf/Makefile: Move tst-ptrguard1-static, tst-stackguard1-static,
tst-tls1-static, tst-tls2-static, tst-tls3-static, loadtest,
unload, unload2, circleload1, neededtest, neededtest2,
neededtest3, neededtest4, tst-tls1, tst-tls2, tst-tls3,
tst-tls6, tst-tls7, tst-tls8, tst-dlmopen2, tst-ptrguard1,
tst-stackguard1, tst-_dl_addr_inside_object, and all of the
ifunc tests to tests-internal.
Don't add $(modules-names) to test-extras.
* inet/Makefile: Move tst-inet6_scopeid_pton to tests-internal.
Add tst-deadline to tests-static-internal.
* malloc/Makefile: Move tst-mallocstate and tst-scratch_buffer to
tests-internal.
* misc/Makefile: Move tst-atomic and tst-atomic-long to tests-internal.
* nptl/Makefile: Move tst-typesizes, tst-rwlock19, tst-sem11,
tst-sem12, tst-sem13, tst-barrier5, tst-signal7, tst-tls3,
tst-tls3-malloc, tst-tls5, tst-stackguard1, tst-sem11-static,
tst-sem12-static, and tst-stackguard1-static to tests-internal.
Link tests-internal with libpthread also.
Don't add $(modules-names) to test-extras.
* nss/Makefile: Move tst-field to tests-internal.
* posix/Makefile: Move bug-regex5, bug-regex20, bug-regex33,
tst-rfc3484, tst-rfc3484-2, and tst-rfc3484-3 to tests-internal.
* stdlib/Makefile: Move tst-strtod1i, tst-strtod3, tst-strtod4,
tst-strtod5i, tst-tls-atexit, and tst-tls-atexit-nodelete to
tests-internal.
* sunrpc/Makefile: Move tst-svc_register to tests-internal.
* sysdeps/powerpc/Makefile: Move test-get_hwcap and
test-get_hwcap-static to tests-internal.
* sysdeps/unix/sysv/linux/Makefile: Move tst-setgetname to
tests-internal.
* sysdeps/x86_64/fpu/Makefile: Add all libmvec test modules to
modules-names-tests.
2016-11-21 01:46:30 +00:00
|
|
|
|
2017-09-20 16:31:48 +00:00
|
|
|
LDLIBS-test-atexit-race = $(shared-thread-library)
|
|
|
|
LDLIBS-test-at_quick_exit-race = $(shared-thread-library)
|
|
|
|
LDLIBS-test-cxa_atexit-race = $(shared-thread-library)
|
2021-04-26 19:27:29 +00:00
|
|
|
LDLIBS-test-cxa_atexit-race2 = $(shared-thread-library)
|
2017-09-20 16:31:48 +00:00
|
|
|
LDLIBS-test-on_exit-race = $(shared-thread-library)
|
2020-12-29 15:24:28 +00:00
|
|
|
LDLIBS-tst-canon-bz26341 = $(shared-thread-library)
|
2022-07-21 13:05:00 +00:00
|
|
|
LDLIBS-tst-arc4random-fork = $(shared-thread-library)
|
|
|
|
LDLIBS-tst-arc4random-thread = $(shared-thread-library)
|
2023-03-08 08:11:47 +00:00
|
|
|
LDLIBS-tst-system = $(shared-thread-library)
|
2017-09-20 16:31:48 +00:00
|
|
|
|
2021-06-03 06:26:04 +00:00
|
|
|
LDLIBS-test-dlclose-exit-race = $(shared-thread-library)
|
2017-09-21 19:14:41 +00:00
|
|
|
LDFLAGS-test-dlclose-exit-race = $(LDFLAGS-rdynamic)
|
|
|
|
LDLIBS-test-dlclose-exit-race-helper.so = $(libsupport) $(shared-thread-library)
|
|
|
|
|
2023-04-04 13:57:45 +00:00
|
|
|
CFLAGS-tst-abs.c += -fno-builtin
|
2023-04-04 13:57:46 +00:00
|
|
|
CFLAGS-tst-labs.c += -fno-builtin
|
2023-04-04 13:57:47 +00:00
|
|
|
CFLAGS-tst-llabs.c += -fno-builtin
|
2023-04-04 13:57:45 +00:00
|
|
|
|
2016-06-06 18:20:58 +00:00
|
|
|
ifeq ($(have-cxx-thread_local),yes)
|
|
|
|
CFLAGS-tst-quick_exit.o = -std=c++11
|
|
|
|
LDLIBS-tst-quick_exit = -lstdc++
|
|
|
|
CFLAGS-tst-thread-quick_exit.o = -std=c++11
|
|
|
|
LDLIBS-tst-thread-quick_exit = -lstdc++
|
|
|
|
$(objpfx)tst-thread-quick_exit: $(shared-thread-library)
|
|
|
|
else
|
2022-04-08 12:57:57 +00:00
|
|
|
tests-unsupported += \
|
|
|
|
tst-quick_exit \
|
|
|
|
tst-thread-quick_exit \
|
|
|
|
# tests-unsupported
|
2016-06-06 18:20:58 +00:00
|
|
|
endif
|
1995-02-18 01:27:10 +00:00
|
|
|
|
2022-04-08 12:57:57 +00:00
|
|
|
modules-names = \
|
|
|
|
test-dlclose-exit-race-helper \
|
|
|
|
tst-tls-atexit-lib \
|
|
|
|
# modules-names
|
2016-04-13 15:04:37 +00:00
|
|
|
extra-test-objs += $(addsuffix .os, $(modules-names))
|
2013-02-18 13:38:21 +00:00
|
|
|
|
2005-01-04 07:48:13 +00:00
|
|
|
ifeq ($(build-shared),yes)
|
2022-04-08 12:57:57 +00:00
|
|
|
tests += \
|
|
|
|
tst-putenv \
|
|
|
|
# tests
|
2005-01-04 07:48:13 +00:00
|
|
|
endif
|
1995-03-24 03:05:04 +00:00
|
|
|
|
|
|
|
# Several mpn functions from GNU MP are used by the strtod function.
|
2022-04-08 12:57:57 +00:00
|
|
|
mpn-routines := \
|
|
|
|
add_n \
|
|
|
|
addmul_1 \
|
|
|
|
cmp \
|
|
|
|
divmod_1 \
|
|
|
|
divrem \
|
|
|
|
inlines \
|
|
|
|
lshift \
|
|
|
|
mod_1 \
|
|
|
|
mul \
|
|
|
|
mul_1 \
|
|
|
|
mul_n \
|
|
|
|
rshift \
|
|
|
|
sub_n \
|
|
|
|
submul_1 \
|
|
|
|
udiv_qrnnd \
|
|
|
|
# mpn-routines
|
|
|
|
mpn-headers = \
|
|
|
|
asm-syntax.h \
|
|
|
|
gmp-impl.h \
|
|
|
|
gmp-mparam.h \
|
|
|
|
gmp.h \
|
|
|
|
longlong.h \
|
|
|
|
# mpn-headers
|
1995-03-24 03:05:04 +00:00
|
|
|
|
2022-04-08 12:57:57 +00:00
|
|
|
routines := \
|
|
|
|
$(strip $(routines) $(mpn-routines)) \
|
|
|
|
dbl2mpn \
|
|
|
|
ldbl2mpn \
|
|
|
|
mpn2dbl \
|
|
|
|
mpn2flt \
|
|
|
|
mpn2ldbl \
|
|
|
|
# routines
|
|
|
|
aux += \
|
|
|
|
fpioconst \
|
|
|
|
mp_clz_tab \
|
|
|
|
# aux
|
2005-01-04 07:48:13 +00:00
|
|
|
|
2022-04-08 12:57:57 +00:00
|
|
|
tests-extras += \
|
|
|
|
tst-putenvmod \
|
|
|
|
# tests-extras
|
2022-06-22 17:53:33 +00:00
|
|
|
|
2022-04-08 12:57:57 +00:00
|
|
|
extra-test-objs += \
|
|
|
|
tst-putenvmod.os \
|
|
|
|
# extra-test-objs
|
1995-03-24 03:05:04 +00:00
|
|
|
|
2022-04-08 12:57:57 +00:00
|
|
|
generated += \
|
|
|
|
isomac \
|
|
|
|
isomac.out \
|
|
|
|
tst-putenvmod.so \
|
|
|
|
# generated
|
1995-03-24 03:05:04 +00:00
|
|
|
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-bsearch.c += $(uses-callbacks)
|
|
|
|
CFLAGS-msort.c += $(uses-callbacks)
|
|
|
|
CFLAGS-qsort.c += $(uses-callbacks)
|
|
|
|
CFLAGS-system.c += -fexceptions
|
2005-01-23 04:39:17 +00:00
|
|
|
CFLAGS-system.os = -fomit-frame-pointer
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-fmtmsg.c += -fexceptions
|
Update.
1998-06-26 14:37 Ulrich Drepper <drepper@cygnus.com>
* configure.in: Check for -fexceptions.
* config.make.in: Define exceptions, not no-exceptions.
* misc/sys/cdefs.h: Define __PMS. When using modern g++ define
__P to use throw().
* misc/Makefile: Define CFLAGS-tsearch.c and CFLAGS-lsearch.c to
$(exceptions).
* stdlib/Makefile: Likewise for bsearch.c, msort.c, and qsort.c.
* misc/search.h: Use __PMS in tsearch, tfind, tdelete, twalk, tdestroy,
lfind, and lsearch prototpypes.
* stdlib/stdlib.h: Likewise for bsearch and qsort.
1998-06-26 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/i386/fpu/bits/mathinline.h (__finite): Use C code, not asm.
1998-06-25 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile (remove-old-headers): Make phony.
* configure.in: Substitute @old_glibc_headers@.
1998-06-26 Ulrich Drepper <drepper@cygnus.com>
* libc.map: Remove __libc_uid.
1998-06-24 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/terminal.texi (Allocation, Pseudo-Terminal Pairs): Fix
typos.
1998-06-26 Ulrich Drepper <drepper@cygnus.com>
* libc.map: Add Alpha-specific io function from protected namespace.
1998-06-26 14:47:05 +00:00
|
|
|
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-strfmon.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-strfmon_l.c += $(libio-mtsafe)
|
2001-02-07 19:07:39 +00:00
|
|
|
|
2016-06-28 20:30:42 +00:00
|
|
|
# The strfrom class of functions call __printf_fp in order to convert the
|
|
|
|
# floating-point value to characters. This requires the value of IO_MTSAFE_IO.
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-strfromd.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-strfromf.c += $(libio-mtsafe)
|
|
|
|
CFLAGS-strfroml.c += $(libio-mtsafe)
|
2016-06-28 20:30:42 +00:00
|
|
|
|
2022-03-11 13:40:44 +00:00
|
|
|
CFLAGS-strtol.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-strtoul.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-strtoll.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-strtoull.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-strtof.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-strtof_l.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-strtod.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-strtod_l.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-strtold.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-strtold_l.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-secure-getenv.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-tst-bsearch.c += $(stack-align-test-flags)
|
|
|
|
CFLAGS-tst-qsort.c += $(stack-align-test-flags)
|
2016-02-11 17:17:38 +00:00
|
|
|
CFLAGS-tst-makecontext.c += -funwind-tables
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-tst-makecontext2.c += $(stack-align-test-flags)
|
2003-09-17 08:47:44 +00:00
|
|
|
|
2023-02-03 04:00:31 +00:00
|
|
|
CFLAGS-testmb.c += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Werror
|
2022-06-22 15:24:21 +00:00
|
|
|
|
C2x strtol binary constant handling
C2x adds binary integer constants starting with 0b or 0B, and supports
those constants in strtol-family functions when the base passed is 0
or 2. Implement that strtol support for glibc.
As discussed at
<https://sourceware.org/pipermail/libc-alpha/2020-December/120414.html>,
this is incompatible with previous C standard versions, in that such
an input string starting with 0b or 0B was previously required to be
parsed as 0 (with the rest of the string unprocessed). Thus, as
proposed there, this patch adds 20 new __isoc23_* functions with
appropriate header redirection support. This patch does *not* do
anything about scanf %i (which will need 12 new functions per long
double variant, so 12, 24 or 36 depending on the glibc configuration),
instead leaving that for a future patch. The function names would
remain as __isoc23_* even if C2x ends up published in 2024 rather than
2023.
Making this change leads to the question of what should happen to
internal uses of these functions in glibc and its tests. The header
redirection (which applies for _GNU_SOURCE or any other feature test
macros enabling C2x features) has the effect of redirecting internal
uses but without those uses then ending up at a hidden alias (see the
comment in include/stdio.h about interaction with libc_hidden_proto).
It seems desirable for the default for internal uses to be the same
versions used by normal code using _GNU_SOURCE, so rather than doing
anything to disable that redirection, similar macro definitions to
those in include/stdio.h are added to the include/ headers for the new
functions.
Given that the default for uses in glibc is for the redirections to
apply, the next question is whether the C2x semantics are correct for
all those uses. Uses with the base fixed to 10, 16 or any other value
other than 0 or 2 can be ignored. I think this leaves the following
internal uses to consider (an important consideration for review of
this patch will be both whether this list is complete and whether my
conclusions on all entries in it are correct):
benchtests/bench-malloc-simple.c
benchtests/bench-string.h
elf/sotruss-lib.c
math/libm-test-support.c
nptl/perf.c
nscd/nscd_conf.c
nss/nss_files/files-parse.c
posix/tst-fnmatch.c
posix/wordexp.c
resolv/inet_addr.c
rt/tst-mqueue7.c
soft-fp/testit.c
stdlib/fmtmsg.c
support/support_test_main.c
support/test-container.c
sysdeps/pthread/tst-mutex10.c
I think all of these places are OK with the new semantics, except for
resolv/inet_addr.c, where the POSIX semantics of inet_addr do not
allow for binary constants; thus, I changed that file (to use
__strtoul_internal, whose semantics are unchanged) and added a test
for this case. In the case of posix/wordexp.c I think accepting
binary constants is OK since POSIX explicitly allows additional forms
of shell arithmetic expressions, and in stdlib/fmtmsg.c SEV_LEVEL is
not in POSIX so again I think accepting binary constants is OK.
Functions such as __strtol_internal, which are only exported for
compatibility with old binaries from when those were used in inline
functions in headers, have unchanged semantics; the __*_l_internal
versions (purely internal to libc and not exported) have a new
argument to specify whether to accept binary constants.
As well as for the standard functions, the header redirection also
applies to the *_l versions (GNU extensions), and to legacy functions
such as strtoq, to avoid confusing inconsistency (the *q functions
redirect to __isoc23_*ll rather than needing their own __isoc23_*
entry points). For the functions that are only declared with
_GNU_SOURCE, this means the old versions are no longer available for
normal user programs at all. An internal __GLIBC_USE_C2X_STRTOL macro
is used to control the redirections in the headers, and cases in glibc
that wish to avoid the redirections - the function implementations
themselves and the tests of the old versions of the GNU functions -
then undefine and redefine that macro to allow the old versions to be
accessed. (There would of course be greater complexity should we wish
to make any of the old versions into compat symbols / avoid them being
defined at all for new glibc ABIs.)
strtol_l.c has some similarity to strtol.c in gnulib, but has already
diverged some way (and isn't listed at all at
https://sourceware.org/glibc/wiki/SharedSourceFiles unlike strtoll.c
and strtoul.c); I haven't made any attempts at gnulib compatibility in
the changes to that file.
I note incidentally that inttypes.h and wchar.h are missing the
__nonnull present on declarations of this family of functions in
stdlib.h; I didn't make any changes in that regard for the new
declarations added.
2023-02-16 23:02:40 +00:00
|
|
|
# Some versions of GCC supported for building glibc do not support -std=c2x
|
|
|
|
# or -std=gnu2x, so the tests for those versions use -std=c11 and -std=gnu11
|
|
|
|
# and then _ISOC2X_SOURCE is defined in the test as needed.
|
|
|
|
CFLAGS-tst-strtol-binary-c11.c += -std=c11
|
|
|
|
CFLAGS-tst-strtol-binary-c2x.c += -std=c11
|
|
|
|
CFLAGS-tst-strtol-binary-gnu11.c += -std=gnu11
|
|
|
|
CFLAGS-tst-strtol-binary-gnu2x.c += -std=gnu11
|
|
|
|
|
2022-06-22 15:24:21 +00:00
|
|
|
|
Enumerate tests with special rules in tests-special variable.
This patch is a revised and updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html>.
In order to generate overall summaries of the results of all tests in
the glibc testsuite, we need to identify and concatenate the files
with the results of individual tests.
Tomas Dohnalek's patch used $(common-objpfx)*/*.test-result for this.
However, the normal glibc approach is explicit enumeration of the
expected set of files with a given property, rather than all files
matching some pattern like that. Furthermore, we would like to be
able to mark tests as UNRESOLVED if the file with their results is for
some reason missing, and in future we would like to be able to mark
tests as UNSUPPORTED if they are disabled for a particular
configuration (rather than simply having them missing from the list of
tests as at present). Such handling of tests that were not run or did
not record results requires an explicit enumeration of tests.
For the tests following the default makefile rules, $(tests) (and
$(xtests)) provides such an enumeration. Others, however, are added
directly as dependencies of the "tests" and "xtests" makefile
targets. This patch changes the makefiles to put them in variables
tests-special and xtests-special, with appropriate dependencies on the
tests listed there then being added centrally.
Those variables are used in Rules and so need to be set before Rules
is included in a subdirectory makefile, which is often earlier in the
makefile than the dependencies were present before. We previously
discussed the question of where to include Rules; see the question at
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, and a
discussion in
<https://sourceware.org/ml/libc-alpha/2013-01/msg00337.html> of why
Rules is included early rather than late in subdirectory makefiles.
It was necessary to avoid an indirection through the check-abi target
and get the check-abi-* targets for individual libraries into the
tests-special variable. The intl/ test $(objpfx)tst-gettext.out,
previously built only because of dependencies from other tests, was
also added to tests-special for the same reason.
The entries in tests-special are the full makefile targets, complete
with $(objpfx) and .out. If a future change causes tests to be named
consistently with a .out suffix, this can be changed to include just
the path relative to $(objpfx), without .out.
Tested x86_64, including that the same set of files is generated in
the build directory by a build and testsuite run both before and after
the patch (except for changes to the
elf/tst-null-argv.debug.out.<number> file name), and a build with
run-built-tests=no to verify there aren't any more obvious instances
of the issue Marcus Shawcroft reported with a previous version in
<https://sourceware.org/ml/libc-alpha/2014-01/msg00462.html>.
* Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(tests): Depend on $(tests-special).
* Makerules (check-abi-list): New variable.
(check-abi): Depend on $(check-abi-list).
[$(subdir) = elf] (tests-special): Add
$(objpfx)check-abi-libc.out.
[$(build-shared) = yes && subdir] (tests-special): Add
$(check-abi-list).
[$(build-shared) = yes && subdir] (tests): Do not depend on
check-abi.
* Rules (tests): Depend on $(tests-special).
(xtests): Depend on $(xtests-special).
* catgets/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* conform/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* elf/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* grp/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* iconv/Makefile (xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* iconvdata/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* intl/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable. Also add
$(objpfx)tst-gettext.out.
* io/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* libio/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* malloc/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* misc/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* nptl/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* nptl_db/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* posix/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* resolv/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* stdio-common/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(do-tst-unbputc): Remove target.
(do-tst-printf): Likewise.
* stdlib/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* string/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* sysdeps/x86/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
localedata:
* Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
2014-03-06 22:35:33 +00:00
|
|
|
# Run a test on the header files we use.
|
|
|
|
tests-special += $(objpfx)isomac.out
|
|
|
|
|
|
|
|
ifeq ($(run-built-tests),yes)
|
|
|
|
tests-special += $(objpfx)tst-fmtmsg.out
|
|
|
|
endif
|
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
include ../Rules
|
1995-03-24 03:05:04 +00:00
|
|
|
|
2015-10-12 10:24:41 +00:00
|
|
|
ifeq ($(run-built-tests),yes)
|
2022-04-08 12:57:57 +00:00
|
|
|
LOCALES := \
|
|
|
|
cs_CZ.UTF-8 \
|
|
|
|
de_DE.UTF-8 \
|
|
|
|
el_GR.UTF-8 \
|
|
|
|
en_US.ISO-8859-1 \
|
|
|
|
hi_IN.UTF-8 \
|
|
|
|
hr_HR.UTF-8 \
|
|
|
|
tg_TJ.UTF-8 \
|
|
|
|
tr_TR.ISO-8859-9 \
|
|
|
|
tr_TR.UTF-8 \
|
|
|
|
# LOCALES
|
2015-10-12 10:24:41 +00:00
|
|
|
include ../gen-locales.mk
|
|
|
|
|
|
|
|
$(objpfx)bug-strtod2.out: $(gen-locales)
|
|
|
|
$(objpfx)testmb2.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-strtod.out: $(gen-locales)
|
2018-05-29 08:34:52 +00:00
|
|
|
$(objpfx)tst-strtod1i.out: $(gen-locales)
|
2015-10-12 10:24:41 +00:00
|
|
|
$(objpfx)tst-strtod3.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-strtod4.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-strtod5.out: $(gen-locales)
|
2018-05-29 08:34:52 +00:00
|
|
|
$(objpfx)tst-strtod5i.out: $(gen-locales)
|
2015-11-23 08:50:53 +00:00
|
|
|
$(objpfx)tst-strtol-locale.out: $(gen-locales)
|
2015-11-24 22:21:59 +00:00
|
|
|
$(objpfx)tst-strtod-nan-locale.out: $(gen-locales)
|
2016-04-04 13:18:13 +00:00
|
|
|
$(objpfx)tst-strfmon_l.out: $(gen-locales)
|
2016-10-22 13:39:46 +00:00
|
|
|
$(objpfx)tst-strfrom.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-strfrom-locale.out: $(gen-locales)
|
2017-09-21 19:14:41 +00:00
|
|
|
$(objpfx)test-dlclose-exit-race.out: $(objpfx)test-dlclose-exit-race-helper.so
|
2015-10-12 10:24:41 +00:00
|
|
|
endif
|
|
|
|
|
2000-05-17 11:04:21 +00:00
|
|
|
# Testdir has to be named stdlib and needs to be writable
|
2000-07-12 20:06:44 +00:00
|
|
|
test-canon-ARGS = --test-dir=${common-objpfx}stdlib
|
2000-05-17 11:04:21 +00:00
|
|
|
|
2012-01-16 14:03:20 +00:00
|
|
|
bug-fmtmsg1-ENV = SEV_LEVEL=foo,11,newsev
|
2001-01-24 22:19:16 +00:00
|
|
|
|
2000-07-16 07:30:42 +00:00
|
|
|
$(objpfx)isomac.out: $(objpfx)isomac
|
2001-01-23 12:46:59 +00:00
|
|
|
$(dir $<)$(notdir $<) '$(CC)' \
|
2017-08-07 15:11:10 +00:00
|
|
|
'-I../include $(+sysdep-includes) $(sysincludes) -I..' > $@; \
|
2014-02-21 21:48:08 +00:00
|
|
|
$(evaluate-test)
|
1998-02-11 11:59:55 +00:00
|
|
|
|
2001-09-12 18:50:25 +00:00
|
|
|
isomac-CFLAGS = -O
|
1998-02-11 11:59:55 +00:00
|
|
|
$(objpfx)isomac: isomac.c
|
|
|
|
$(native-compile)
|
2000-10-27 23:37:52 +00:00
|
|
|
|
|
|
|
$(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
|
Don't require test wrappers to preserve environment variables, use more consistent environment.
One wart in the original support for test wrappers for cross testing,
as noted in
<https://sourceware.org/ml/libc-alpha/2012-10/msg00722.html>, is the
requirement for test wrappers to pass a poorly-defined set of
environment variables from the build system to the system running the
glibc under test. Although some variables are passed explicitly via
$(test-wrapper-env), including LD_* variables that simply can't be
passed implicitly because of the side effects they'd have on the build
system's dynamic linker, others are passed implicitly, including
variables such as GCONV_PATH and LOCPATH that could potentially affect
the build system's libc (so effectively relying on any such effects
not breaking the wrappers). In addition, the code in
cross-test-ssh.sh for preserving environment variables is fragile (it
depends on how bash formats a list of exported variables, and could
well break for multi-line variable definitions where the contents
contain things looking like other variable definitions).
This patch moves to explicitly passing environment variables via
$(test-wrapper-env). Makefile variables that previously used
$(test-wrapper) are split up into -before-env and -after-env parts
that can be passed separately to the various .sh files used in
testing, so those files can then insert environment settings between
the two parts.
The common default environment settings in make-test-out are made into
a separate makefile variable that can also be passed to scripts,
rather than many scripts duplicating those settings (for testing an
installed glibc, it is desirable to have the GCONV_PATH setting on
just one place, so just that one place needs to support it pointing to
an installed sysroot instead of the build tree). The default settings
are included in the variables such as $(test-program-prefix), so that
if tests do not need any non-default settings they can continue to use
single variables rather than the split-up variables.
Although this patch cleans up LC_ALL=C settings (that being part of
the common defaults), various LANG=C and LANGUAGE=C settings remain.
Those are generally unnecessary and I propose a subsequent cleanup to
remove them. LC_ALL takes precedence over LANG, and while LANGUAGE
takes precedence over LC_ALL, it only does so for settings other than
LC_ALL=C. So LC_ALL=C on its own is sufficient to ensure the C
locale, and anything that gets LC_ALL=C does not need the other
settings.
While preparing this patch I noticed some tests with .sh files that
appeared to do nothing beyond what the generic makefile support for
tests can do (localedata/tst-wctype.sh - the makefiles support -ENV
variables and .input files - and localedata/tst-mbswcs.sh - just runs
five tests that could be run individually from the makefile). So I
propose another subsequent cleanup to move those to using the generic
support instead of special .sh files.
Tested x86_64 (native) and powerpc32 (cross).
* Makeconfig (run-program-env): New variable.
(run-program-prefix-before-env): Likewise.
(run-program-prefix-after-env): Likewise.
(run-program-prefix): Define in terms of new variables.
(built-program-cmd-before-env): New variable.
(built-program-cmd-after-env): Likewise.
(built-program-cmd): Define in terms of new variables.
(test-program-prefix-before-env): New variable.
(test-program-prefix-after-env): Likewise.
(test-program-prefix): Define in terms of new variables.
(test-program-cmd-before-env): New variable.
(test-program-cmd-after-env): Likewise.
(test-program-cmd): Define in terms of new variables.
* Rules (make-test-out): Use $(run-program-env).
* scripts/cross-test-ssh.sh (env_blacklist): Remove variable.
(help): Do not mention environment variables. Mention
--timeoutfactor option.
(timeoutfactor): New variable.
(blacklist_exports): Remove function.
(exports): Remove variable.
(command): Do not include ${exports}.
* manual/install.texi (Configuring and compiling): Do not mention
test wrappers preserving environment variables. Mention that last
assignment to a variable must take precedence.
* INSTALL: Regenerated.
* benchtests/Makefile (run-bench): Use $(run-program-env).
* catgets/Makefile ($(objpfx)test1.cat): Use
$(built-program-cmd-before-env), $(run-program-env) and
$(built-program-cmd-after-env).
($(objpfx)test2.cat): Do not specify environment variables
explicitly.
($(objpfx)de/libc.cat): Use $(built-program-cmd-before-env),
$(run-program-env) and $(built-program-cmd-after-env).
($(objpfx)test-gencat.out): Use $(test-program-cmd-before-env),
$(run-program-env) and $(test-program-cmd-after-env).
($(objpfx)sample.SJIS.cat): Do not specify environment variables
explicitly.
* catgets/test-gencat.sh: Use test_program_cmd_before_env,
run_program_env and test_program_cmd_after_env arguments.
* elf/Makefile ($(objpfx)tst-pathopt.out): Use $(run-program-env).
* elf/tst-pathopt.sh: Use run_program_env argument.
* iconvdata/Makefile ($(objpfx)iconv-test.out): Use
$(test-wrapper-env) and $(run-program-env).
* iconvdata/run-iconv-test.sh: Use test_wrapper_env and
run_program_env arguments.
* iconvdata/tst-table.sh: Do not set GCONV_PATH explicitly.
* intl/Makefile ($(objpfx)tst-gettext.out): Use
$(test-program-prefix-before-env), $(run-program-env) and
$(test-program-prefix-after-env).
($(objpfx)tst-gettext2.out): Likewise.
* intl/tst-gettext.sh: Use test_program_prefix_before_env,
run_program_env and test_program_prefix_after_env arguments.
* intl/tst-gettext2.sh: Likewise.
* intl/tst-gettext4.sh: Do not set environment variables
explicitly.
* intl/tst-gettext6.sh: Likewise.
* intl/tst-translit.sh: Likewise.
* malloc/Makefile ($(objpfx)tst-mtrace.out): Use
$(test-program-prefix-before-env), $(run-program-env) and
$(test-program-prefix-after-env).
* malloc/tst-mtrace.sh: Use test_program_prefix_before_env,
run_program_env and test_program_prefix_after_env arguments.
* math/Makefile (run-regen-ulps): Use $(run-program-env).
* nptl/Makefile ($(objpfx)tst-tls6.out): Use $(run-program-env).
* nptl/tst-tls6.sh: Use run_program_env argument. Set LANG=C
explicitly with each use of ${test_wrapper_env}.
* posix/Makefile ($(objpfx)wordexp-tst.out): Use
$(test-program-prefix-before-env), $(run-program-env) and
$(test-program-prefix-after-env).
* posix/tst-getconf.sh: Do not set environment variables
explicitly.
* posix/wordexp-tst.sh: Use test_program_prefix_before_env,
run_program_env and test_program_prefix_after_env arguments.
* stdio-common/tst-printf.sh: Do not set environment variables
explicitly.
* stdlib/Makefile ($(objpfx)tst-fmtmsg.out): Use
$(test-program-prefix-before-env), $(run-program-env) and
$(test-program-prefix-after-env).
* stdlib/tst-fmtmsg.sh: Use test_program_prefix_before_env,
run_program_env and test_program_prefix_after_env arguments.
Split $test calls into $test_pre and $test.
* timezone/Makefile (build-testdata): Use
$(built-program-cmd-before-env), $(run-program-env) and
$(built-program-cmd-after-env).
localedata/ChangeLog:
* Makefile ($(addprefix $(objpfx),$(CTYPE_FILES))): Use
$(built-program-cmd-before-env), $(run-program-env) and
$(built-program-cmd-after-env).
($(objpfx)sort-test.out): Use $(test-program-prefix-before-env),
$(run-program-env) and $(test-program-prefix-after-env).
($(objpfx)tst-fmon.out): Use $(run-program-prefix-before-env),
$(run-program-env) and $(run-program-prefix-after-env).
($(objpfx)tst-locale.out): Use $(built-program-cmd-before-env),
$(run-program-env) and $(built-program-cmd-after-env).
($(objpfx)tst-trans.out): Use $(run-program-prefix-before-env),
$(run-program-env), $(run-program-prefix-after-env),
$(test-program-prefix-before-env) and
$(test-program-prefix-after-env).
($(objpfx)tst-ctype.out): Use $(test-program-cmd-before-env),
$(run-program-env) and $(test-program-cmd-after-env).
($(objpfx)tst-wctype.out): Likewise.
($(objpfx)tst-langinfo.out): Likewise.
($(objpfx)tst-langinfo-static.out): Likewise.
* gen-locale.sh: Use localedef_before_env, run_program_env and
localedef_after_env arguments.
* sort-test.sh: Use test_program_prefix_before_env,
run_program_env and test_program_prefix_after_env arguments.
* tst-ctype.sh: Use tst_ctype_before_env, run_program_env and
tst_ctype_after_env arguments.
* tst-fmon.sh: Use run_program_prefix_before_env, run_program_env
and run_program_prefix_after_env arguments.
* tst-langinfo.sh: Use tst_langinfo_before_env, run_program_env
and tst_langinfo_after_env arguments.
* tst-locale.sh: Use localedef_before_env, run_program_env and
localedef_after_env arguments.
* tst-mbswcs.sh: Do not set environment variables explicitly.
* tst-numeric.sh: Likewise.
* tst-rpmatch.sh: Likewise.
* tst-trans.sh: Use run_program_prefix_before_env,
run_program_env, run_program_prefix_after_env,
test_program_prefix_before_env and test_program_prefix_after_env
arguments.
* tst-wctype.sh: Use tst_wctype_before_env, run_program_env and
tst_wctype_after_env arguments.
2014-06-06 22:19:27 +00:00
|
|
|
$(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
|
|
|
|
'$(run-program-env)' '$(test-program-prefix-after-env)' \
|
2020-10-01 13:42:38 +00:00
|
|
|
$(common-objpfx)stdlib/; \
|
2014-02-21 21:48:08 +00:00
|
|
|
$(evaluate-test)
|
2005-01-04 07:48:13 +00:00
|
|
|
|
|
|
|
$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
|
2019-12-03 09:58:52 +00:00
|
|
|
LDFLAGS-tst-putenv = -Wl,--no-as-needed
|
2005-01-04 07:48:13 +00:00
|
|
|
|
2013-05-31 16:16:33 +00:00
|
|
|
$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps)
|
2005-01-04 07:48:13 +00:00
|
|
|
$(build-module)
|
2014-11-19 06:43:54 +00:00
|
|
|
libof-tst-putenvmod = extramodules
|
2011-04-18 01:51:26 +00:00
|
|
|
|
Use existing makefile variables for dependencies on glibc libraries.
glibc's Makeconfig defines some variables such as $(libm) and $(libdl)
for linking with libraries built by glibc, and nptl/Makeconfig
(included by the toplevel Makeconfig) defines others such as
$(shared-thread-library).
In some places glibc's Makefiles use those variables when linking
against the relevant libraries, but in other places they hardcode the
location of the libraries in the build tree. This patch cleans up
various places to use the variables that already exist (in the case of
libm, replacing several duplicate definitions of a $(link-libm)
variable in subdirectory Makefiles). (It's not necessarily exactly
equivalent to what the existing code does - in particular,
$(shared-thread-library) includes libpthread_nonshared, but is
replacing places that just referred to libpthread.so. But I think
that change is desirable on the general principle of linking things as
close as possible to the way in which they would be linked with an
installed library, unless there is a clear reason not to do so.)
To support running tests with an installed copy of glibc without
needing the full build tree from when that copy was built, I think it
will be useful to use such variables more generally and systematically
- every time the rules for building a test refer to some file from the
build tree that's also installed by glibc, use a makefile variable so
that the installed-testing case can point those variables to installed
copies of the files. This patch just deals with straightforward cases
where such variables already exist.
It's quite possible some uses of $(shared-thread-library) should
actually be a new $(thread-library) variable that's set appropriately
in the --disable-shared case, if those uses would in fact work without
shared libraries. I didn't change the status quo that those cases
hardcode use of a shared library whether or not it's actually needed
(but other uses such as $(libm) and $(libdl) would now get the static
library if the shared library isn't built, when some previously
hardcoded use of the shared library - if they actually need shared
libraries, the test itself needs an enable-shared conditional anyway).
Tested x86_64.
* benchtests/Makefile
($(addprefix $(objpfx)bench-,$(bench-math))): Depend on $(libm),
not $(common-objpfx)math/libm.so.
($(addprefix $(objpfx)bench-,$(bench-pthread))): Depend on
$(shared-thread-library), not $(common-objpfx)nptl/libpthread.so.
* elf/Makefile ($(objpfx)noload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
($(objpfx)tst-audit8): Depend on $(libm), not
$(common-objpfx)math/libm.so.
* malloc/Makefile ($(objpfx)libmemusage.so): Depend on $(libdl),
not $(common-objpfx)dlfcn/libdl.so.
* math/Makefile
($(addprefix $(objpfx),$(filter-out $(tests-static),$(tests)))):
Depend on $(libm), not $(objpfx)libm.so. Do not condition on
[$(build-shared) = yes].
($(objpfx)test-fenv-tls): Depend on $(shared-thread-library), not
$(common-objpfx)nptl/libpthread.so.
* misc/Makefile ($(objpfx)tst-tsearch): Depend on $(libm), not
$(common-objpfx)math/libm.so$(libm.so-version) or
$(common-objpfx)math/libm.a depending on [$(build-shared) = yes].
* nptl/Makefile ($(objpfx)tst-unload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
* setjmp/Makefile (link-libm): Remove variable.
($(objpfx)tst-setjmp-fp): Depend on $(libm), not $(link-libm).
* stdio-common/Makefile (link-libm): Remove variable.
($(objpfx)tst-printf-round): Depend on $(libm), not $(link-libm).
* stdlib/Makefile (link-libm): Remove variable.
($(objpfx)bug-getcontext): Depend on $(libm), not $(link-libm).
($(objpfx)tst-strtod-round): Likewise.
($(objpfx)tst-tininess): Likewise.
($(objpfx)tst-strtod-underflow): Likewise.
($(objpfx)tst-strtod6): Likewise.
($(objpfx)tst-tls-atexit): Depend on $(shared-thread-library) and
$(libdl), not $(common-objpfx)nptl/libpthread.so and
$(common-objpfx)dlfcn/libdl.so.
2014-05-16 21:38:08 +00:00
|
|
|
$(objpfx)bug-getcontext: $(libm)
|
2016-07-25 18:10:00 +00:00
|
|
|
$(objpfx)bug-strtod2: $(libm)
|
Use existing makefile variables for dependencies on glibc libraries.
glibc's Makeconfig defines some variables such as $(libm) and $(libdl)
for linking with libraries built by glibc, and nptl/Makeconfig
(included by the toplevel Makeconfig) defines others such as
$(shared-thread-library).
In some places glibc's Makefiles use those variables when linking
against the relevant libraries, but in other places they hardcode the
location of the libraries in the build tree. This patch cleans up
various places to use the variables that already exist (in the case of
libm, replacing several duplicate definitions of a $(link-libm)
variable in subdirectory Makefiles). (It's not necessarily exactly
equivalent to what the existing code does - in particular,
$(shared-thread-library) includes libpthread_nonshared, but is
replacing places that just referred to libpthread.so. But I think
that change is desirable on the general principle of linking things as
close as possible to the way in which they would be linked with an
installed library, unless there is a clear reason not to do so.)
To support running tests with an installed copy of glibc without
needing the full build tree from when that copy was built, I think it
will be useful to use such variables more generally and systematically
- every time the rules for building a test refer to some file from the
build tree that's also installed by glibc, use a makefile variable so
that the installed-testing case can point those variables to installed
copies of the files. This patch just deals with straightforward cases
where such variables already exist.
It's quite possible some uses of $(shared-thread-library) should
actually be a new $(thread-library) variable that's set appropriately
in the --disable-shared case, if those uses would in fact work without
shared libraries. I didn't change the status quo that those cases
hardcode use of a shared library whether or not it's actually needed
(but other uses such as $(libm) and $(libdl) would now get the static
library if the shared library isn't built, when some previously
hardcoded use of the shared library - if they actually need shared
libraries, the test itself needs an enable-shared conditional anyway).
Tested x86_64.
* benchtests/Makefile
($(addprefix $(objpfx)bench-,$(bench-math))): Depend on $(libm),
not $(common-objpfx)math/libm.so.
($(addprefix $(objpfx)bench-,$(bench-pthread))): Depend on
$(shared-thread-library), not $(common-objpfx)nptl/libpthread.so.
* elf/Makefile ($(objpfx)noload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
($(objpfx)tst-audit8): Depend on $(libm), not
$(common-objpfx)math/libm.so.
* malloc/Makefile ($(objpfx)libmemusage.so): Depend on $(libdl),
not $(common-objpfx)dlfcn/libdl.so.
* math/Makefile
($(addprefix $(objpfx),$(filter-out $(tests-static),$(tests)))):
Depend on $(libm), not $(objpfx)libm.so. Do not condition on
[$(build-shared) = yes].
($(objpfx)test-fenv-tls): Depend on $(shared-thread-library), not
$(common-objpfx)nptl/libpthread.so.
* misc/Makefile ($(objpfx)tst-tsearch): Depend on $(libm), not
$(common-objpfx)math/libm.so$(libm.so-version) or
$(common-objpfx)math/libm.a depending on [$(build-shared) = yes].
* nptl/Makefile ($(objpfx)tst-unload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
* setjmp/Makefile (link-libm): Remove variable.
($(objpfx)tst-setjmp-fp): Depend on $(libm), not $(link-libm).
* stdio-common/Makefile (link-libm): Remove variable.
($(objpfx)tst-printf-round): Depend on $(libm), not $(link-libm).
* stdlib/Makefile (link-libm): Remove variable.
($(objpfx)bug-getcontext): Depend on $(libm), not $(link-libm).
($(objpfx)tst-strtod-round): Likewise.
($(objpfx)tst-tininess): Likewise.
($(objpfx)tst-strtod-underflow): Likewise.
($(objpfx)tst-strtod6): Likewise.
($(objpfx)tst-tls-atexit): Depend on $(shared-thread-library) and
$(libdl), not $(common-objpfx)nptl/libpthread.so and
$(common-objpfx)dlfcn/libdl.so.
2014-05-16 21:38:08 +00:00
|
|
|
$(objpfx)tst-strtod-round: $(libm)
|
|
|
|
$(objpfx)tst-tininess: $(libm)
|
|
|
|
$(objpfx)tst-strtod-underflow: $(libm)
|
|
|
|
$(objpfx)tst-strtod6: $(libm)
|
2015-11-24 22:21:59 +00:00
|
|
|
$(objpfx)tst-strtod-nan-locale: $(libm)
|
2018-06-15 17:36:21 +00:00
|
|
|
$(objpfx)tst-strtod-nan-sign: $(libm)
|
2013-02-18 13:38:21 +00:00
|
|
|
|
|
|
|
tst-tls-atexit-lib.so-no-z-defs = yes
|
2017-09-21 19:14:41 +00:00
|
|
|
test-dlclose-exit-race-helper.so-no-z-defs = yes
|
2013-02-18 13:38:21 +00:00
|
|
|
|
2021-06-03 06:26:04 +00:00
|
|
|
$(objpfx)tst-tls-atexit: $(shared-thread-library)
|
2013-02-18 13:38:21 +00:00
|
|
|
$(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so
|
2015-05-08 15:20:32 +00:00
|
|
|
|
2021-06-03 06:26:04 +00:00
|
|
|
$(objpfx)tst-tls-atexit-nodelete: $(shared-thread-library)
|
2015-07-23 05:46:18 +00:00
|
|
|
$(objpfx)tst-tls-atexit-nodelete.out: $(objpfx)tst-tls-atexit-lib.so
|
|
|
|
|
2015-05-08 15:20:32 +00:00
|
|
|
$(objpfx)tst-setcontext3.out: tst-setcontext3.sh $(objpfx)tst-setcontext3
|
|
|
|
$(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
|
|
|
|
'$(run-program-env)' '$(test-program-prefix-after-env)' \
|
2020-10-01 13:42:38 +00:00
|
|
|
$(common-objpfx)stdlib/; \
|
2015-05-08 15:20:32 +00:00
|
|
|
$(evaluate-test)
|