]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - Makerules
nptl: Move pthread_attr_setinheritsched implementation into libc.
[thirdparty/glibc.git] / Makerules
index 7214b2b43c7e06b855d9482e71544e7a0ce4e1de..f5134586fa53fa96b7ac8b72e865c4afee13d72d 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2016 Free Software Foundation, Inc.
+# Copyright (C) 1991-2019 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
@@ -13,7 +13,7 @@
 
 # You should have received a copy of the GNU Lesser General Public
 # License along with the GNU C Library; if not, see
-# <http://www.gnu.org/licenses/>.
+# <https://www.gnu.org/licenses/>.
 
 #
 #      Common rules for making the GNU C library.  This file is included
@@ -105,6 +105,13 @@ $(common-objpfx)%.latest: $(common-objpfx)abi-versions.h
        sed -n '/ VERSION_$*_/{s/^.*_\([A-Z0-9_]*\).*$$/\1/;h;};$${g;p;}' \
            $(common-objpfx)abi-versions.h > $@T
        mv -f $@T $@
+
+# first-versions.h and ldbl-compat-choose.h provide macros used in
+# various symbol versioning macro calls.
+before-compile := $(common-objpfx)first-versions.h \
+                 $(common-objpfx)ldbl-compat-choose.h $(before-compile)
+$(common-objpfx)first-versions.h: $(common-objpfx)versions.stmp
+$(common-objpfx)ldbl-compat-choose.h: $(common-objpfx)versions.stmp
 endif # avoid-generated
 endif # $(build-shared) = yes
 
@@ -127,6 +134,14 @@ $(common-objpfx)cstdlib: $(c++-cstdlib-header)
 $(common-objpfx)cmath: $(c++-cmath-header)
        $(INSTALL_DATA) $< $@T
        $(move-if-change) $@T $@
+ifneq (,$(c++-bits-std_abs-h))
+# Also make a copy of <bits/std_abs.h> from GCC 7 to prevent it from
+# including /usr/include/stdlib.h.
+before-compile := $(common-objpfx)bits/std_abs.h $(before-compile)
+$(common-objpfx)bits/std_abs.h: $(c++-bits-std_abs-h)
+       $(INSTALL_DATA) $< $@T
+       $(move-if-change) $@T $@
+endif
 endif
 
 before-compile := $(common-objpfx)libc-abis.h $(before-compile)
@@ -217,42 +232,26 @@ ifdef gen-py-const-headers
 py-const-files := $(patsubst %.pysym,%.py,$(gen-py-const-headers))
 py-const-dir := $(objpfx)
 py-const := $(addprefix $(py-const-dir),$(py-const-files))
-py-const-script := $(..)scripts/gen-py-const.awk
+py-const-script := $(..)scripts/gen-as-const.py
 
-# This is a hack we use to generate .py files with constants for Python
-# pretty printers.  It works the same way as gen-as-const.
-# See scripts/gen-py-const.awk for details on how the awk | gcc mechanism
-# works.
+# This is a hack we use to generate .py files with constants for
+# Python code.
 #
-# $@.tmp and $@.tmp2 are temporary files we use to store the partial contents
-# of the target file.  We do this instead of just writing on $@ because, if the
-# build process terminates prematurely, re-running Make wouldn't run this rule
-# since Make would see that the target file already exists (despite it being
-# incomplete).
+# $@.tmp is a temporary file we use to store the partial contents of
+# the target file.  We do this instead of just writing on $@ because,
+# if the build process terminates prematurely, re-running Make
+# wouldn't run this rule since Make would see that the target file
+# already exists (despite it being incomplete).
 #
-# The sed line replaces "@name@SOME_NAME@value@SOME_VALUE@" strings from the
-# output of 'gcc -S' with "SOME_NAME = SOME_VALUE" strings.
-# The '-n' option, combined with the '/p' command, makes sed output only the
-# modified lines instead of the whole input file.  The output is redirected
-# to a .py file; we'll import it in the pretty printers file to read
-# the constants generated by gen-py-const.awk.
-# The regex has two capturing groups, for SOME_NAME and SOME_VALUE
-# respectively.  Notice SOME_VALUE may be prepended by a special character,
-# depending on the assembly syntax (e.g. immediates are prefixed by a '$'
-# in AT&T x86, and by a '#' in ARM).  We discard it using a complemented set
-# before the second capturing group.
+# The output is redirected to a .py file; we'll import it in the main
+# Python code to read the constants generated by gen-as-const.py.
 $(py-const): $(py-const-dir)%.py: %.pysym $(py-const-script) \
             $(common-before-compile)
        $(make-target-directory)
-       $(AWK) -f $(py-const-script) $< \
-              | $(CC) -S -o $@.tmp $(CFLAGS) $(CPPFLAGS) -x c -
-       echo '# GENERATED FILE\n' > $@.tmp2
-       echo '# Constant definitions for pretty printers.' >> $@.tmp2
-       echo '# See gen-py-const.awk for details.\n' >> $@.tmp2
-       sed -n -r 's/^.*@name@([^@]+)@value@[^[:xdigit:]Xx-]*([[:xdigit:]Xx-]+)@.*/\1 = \2/p' \
-           $@.tmp >> $@.tmp2
-       mv -f $@.tmp2 $@
-       rm -f $@.tmp
+       $(PYTHON) $(py-const-script) --python \
+                 --cc="$(CC) $(CFLAGS) $(CPPFLAGS)" $< \
+                 > $@.tmp
+       mv -f $@.tmp $@
 
 generated += $(py-const)
 endif  # gen-py-const-headers
@@ -261,14 +260,18 @@ ifdef gen-as-const-headers
 # Generating headers for assembly constants.
 # We need this defined early to get into before-compile before
 # it's used in sysd-rules, below.
-$(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \
+# Define GEN_AS_CONST_HEADERS to avoid circular dependency [BZ #22792].
+# NB: <tcb-offsets.h> is generated from tcb-offsets.sym to define
+# offsets and sizes of types in <tls.h> and maybe <pthread.h> which
+# may include <tcb-offsets.h>.  Target header files can check if
+# GEN_AS_CONST_HEADERS is defined to avoid circular dependency which
+# may lead to build hang on a many-core machine.
+$(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.py \
                                           %.sym $(common-before-compile)
-       $(AWK) -f $< $(filter %.sym,$^) \
-       | $(CC) -S -o $(@:.h.d=.h)T3 $(CFLAGS) $(CPPFLAGS) -x c - \
-               -MD -MP -MF $(@:.h=.h.d)T -MT '$(@:.h=.h.d) $(@:.h.d=.h)'
-       sed -n 's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$$/#define \1 \2/p' \
-               $(@:.h.d=.h)T3 > $(@:.h.d=.h)T
-       rm -f $(@:.h.d=.h)T3
+       $(PYTHON) $< --cc="$(CC) $(CFLAGS) $(CPPFLAGS) -DGEN_AS_CONST_HEADERS \
+                          -MD -MP -MF $(@:.h=.h.d)T \
+                          -MT '$(@:.h=.h.d) $(@:.h.d=.h)'" \
+                 $(filter %.sym,$^) > $(@:.h.d=.h)T
        sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
            $(@:.h=.h.d)T > $(@:.h=.h.d)T2
        rm -f $(@:.h=.h.d)T
@@ -277,13 +280,12 @@ $(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \
 vpath %.sym $(sysdirs)
 before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
 
-tests += $(gen-as-const-headers:%.sym=test-as-const-%)
+tests-internal += $(gen-as-const-headers:%.sym=test-as-const-%)
 generated += $(gen-as-const-headers:%.sym=test-as-const-%.c)
-$(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.awk $(..)Makerules \
+$(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.py $(..)Makerules \
                            %.sym $(common-objpfx)%.h
        ($(AWK) '{ sub(/^/, "asconst_", $$2); print; }' $(filter %.h,$^); \
-        $(AWK) -v test=1 -f $< $(filter %.sym,$^); \
-        echo '#include "$(..)test-skeleton.c"') > $@T
+        $(PYTHON) $< --test $(filter %.sym,$^)) > $@T
        mv -f $@T $@
 endif
 \f
@@ -424,54 +426,6 @@ object-suffixes-left := $(all-object-suffixes)
 include $(o-iterator)
 endif
 
-# Generate version maps, but wait until sysdep-subdirs is known
-ifeq ($(sysd-sorted-done),t)
-ifeq ($(build-shared),yes)
--include $(common-objpfx)sysd-versions
-$(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions
-common-generated += $(version-maps)
-postclean-generated += sysd-versions Versions.all abi-versions.h \
-                      Versions.def Versions.v.i Versions.v
-
-ifndef avoid-generated
-ifneq ($(sysd-versions-subdirs),$(sorted-subdirs) $(config-sysdirs))
-sysd-versions-force = FORCE
-FORCE:
-endif
-
-$(common-objpfx)Versions.def: $(..)scripts/versionlist.awk \
-                             $(common-objpfx)Versions.v
-       LC_ALL=C $(AWK) -f $^ > $@T
-       mv -f $@T $@
-
-$(common-objpfx)Versions.all: $(..)scripts/firstversions.awk \
-                             $(common-objpfx)soversions.i \
-                             $(common-objpfx)Versions.def
-       { while read which lib version setname; do \
-           test x"$$which" = xDEFAULT || continue; \
-           test -z "$$setname" || echo "$$lib : $$setname"; \
-         done < $(word 2,$^); \
-         cat $(word 3,$^); \
-       } | LC_ALL=C $(AWK) -f $< > $@T
-       mv -f $@T $@
-# See %.v/%.v.i implicit rules in Makeconfig.
-$(common-objpfx)Versions.v.i: $(wildcard $(subdirs:%=$(..)%/Versions)) \
-                             $(wildcard $(sysdirs:%=%/Versions)) \
-                             $(sysd-versions-force)
-$(common-objpfx)sysd-versions: $(common-objpfx)Versions.all \
-                              $(common-objpfx)Versions.v \
-                              $(..)scripts/versions.awk
-       ( echo 'sysd-versions-subdirs = $(subdirs) $(config-sysdirs)' ; \
-         cat $(word 2,$^) \
-         | LC_ALL=C $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
-                           -v move_if_change='$(move-if-change)' \
-                           -f $(word 3,$^); \
-       ) > $@T
-       mv -f $@T $@
-endif # avoid-generated
-endif # $(build-shared) = yes
-endif # sysd-sorted-done
-
 # Generate .dT files as we compile.
 compile-mkdep-flags = -MD -MP -MF $@.dt -MT $@
 compile-command.S = $(compile.S) $(OUTPUT_OPTION) $(compile-mkdep-flags)
@@ -588,7 +542,7 @@ $(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \
          $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
          $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
          -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
-         $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
+         $(LDFLAGS.so) $(LDFLAGS-lib.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
          -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
 endef
 
@@ -624,9 +578,6 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
                 PROVIDE(__start___libc_atexit = .);\
                 __libc_atexit : { *(__libc_atexit) }\
                 PROVIDE(__stop___libc_atexit = .);\
-                PROVIDE(__start___libc_thread_subfreeres = .);\
-                __libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\
-                PROVIDE(__stop___libc_thread_subfreeres = .);\
                 PROVIDE(__start___libc_IO_vtables = .);\
                 __libc_IO_vtables : { *(__libc_IO_vtables) }\
                 PROVIDE(__stop___libc_IO_vtables = .);\
@@ -669,14 +620,17 @@ $(build-module-helper) -o $@ $(shlib-lds-flags) \
 $(call after-link,$@)
 endef
 
+# sofini.os must be placed last since it terminates .eh_frame section.
 build-module-helper-objlist = \
        $(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
                   $(filter-out %.lds $(map-file) $(+preinit) $(+postinit) \
+                               $(elf-objpfx)sofini.os \
                                $(link-libc-deps),$^))
 
 build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so)
 build-shlib-objlist = $(build-module-helper-objlist) \
-                     $(LDLIBS-$(@F:lib%.so=%).so)
+                     $(LDLIBS-$(@F:lib%.so=%).so) \
+                     $(filter $(elf-objpfx)sofini.os,$^)
 
 # Don't try to use -lc when making libc.so itself.
 # Also omits crti.o and crtn.o, which we do not want
@@ -686,10 +640,6 @@ LDFLAGS-c.so = -nostdlib -nostartfiles
 LDLIBS-c.so += $(libc.so-gnulib)
 # Give libc.so an entry point and make it directly runnable itself.
 LDFLAGS-c.so += -e __libc_main
-# If lazy relocation is disabled add the -z now flag.
-ifeq ($(bind-now),yes)
-LDFLAGS-c.so += -Wl,-z,now
-endif
 # Pre-link the objects of libc_pic.a so that we can locally resolve
 # COMMON symbols before we link against ld.so.  This is because ld.so
 # contains some of libc_pic.a already, which will prevent the COMMONs
@@ -797,12 +747,21 @@ endif
 
 # The makefile may define $(modules-names) to build additional modules.
 # These are built with $(build-module), except any in $(modules-names-nobuild).
+# MODULE_NAME=extramodules, except any in $(modules-names-tests).
 ifdef modules-names
-# extra-lib.mk is included once for each extra lib to define rules
-# to build it, and to add its objects to the various variables.
-# During its evaluation, $(lib) is set to the name of the library.
-extra-modules-left := $(modules-names)
-include $(patsubst %,$(..)extra-modules.mk,$(modules-names))
+cpp-srcs-left := $(filter-out $(modules-names-tests),$(modules-names))
+ifneq (,$(cpp-srcs-left))
+lib := extramodules
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
+endif
+
+ifdef modules-names-tests
+cpp-srcs-left := $(filter $(modules-names-tests),$(modules-names))
+ifneq (,$(cpp-srcs-left))
+lib := testsuite
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
+endif
+endif
 
 extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names))
 $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \
@@ -814,7 +773,7 @@ endif
             $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
             $(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \
             $(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \
-            $(addsuffix .d,$(tests) $(xtests) $(test-srcs))
+            $(addsuffix .d,$(tests) $(tests-internal) $(xtests) $(test-srcs))
 ifeq ($(build-programs),yes)
 +depfiles += $(addsuffix .d,$(others) $(sysdep-others))
 endif
@@ -1054,6 +1013,12 @@ rm -f $@.new
 $(SHELL) $(..)scripts/rellns-sh $< $@.new
 mv -f $@.new $@
 endef
+define make-link-multidir
+$(patsubst %/,cd %,$(objpfx)); \
+  $(addprefix $(abspath $(..)scripts/mkinstalldirs) ,$(dir $(multidir))); \
+  $(LN_S) . $(multidir) 2> /dev/null; \
+  test -L $(multidir)
+endef
 else
 # If we have no symbolic links don't bother with rellns-sh.
 define make-link
@@ -1061,6 +1026,10 @@ rm -f $@.new
 $(LN_S) $< $@.new
 mv -f $@.new $@
 endef
+define make-link-multidir
+$(make-target-directory)
+ln -f $(objpfx)/$(@F) $@
+endef
 endif
 
 ifeq (yes,$(build-shared))
@@ -1104,7 +1073,8 @@ $(common-objpfx)format.lds: $(..)scripts/output-format.sed \
 ifneq (unknown,$(output-format))
        echo > $@.new 'OUTPUT_FORMAT($(output-format))'
 else
-       $(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
+       $(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
+                 $(LDFLAGS.so) $(LDFLAGS-lib.so) \
                  -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
        | sed -n -f $< > $@.new
        test -s $@.new
@@ -1237,6 +1207,7 @@ $(addprefix $(inst_sbindir)/,$(install-sbin)): \
 endif
 ifdef install-lib
 install-lib.a := $(filter lib%.a,$(install-lib))
+install-lib.a := $(filter-out $(install-lib-ldscripts),$(install-lib.a))
 install-lib-non.a := $(filter-out lib%.a,$(install-lib))
 ifdef install-lib-non.a
 $(addprefix $(inst_libdir)/$(libprefix),$(install-lib-non.a)): \
@@ -1325,11 +1296,23 @@ check: tests
 .PHONY: xcheck
 xcheck: xtests
 
-all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others))
+# The only difference between MODULE_NAME=testsuite and MODULE_NAME=nonlib is
+# that almost all internal declarations from config.h, libc-symbols.h, and
+# include/*.h are not available to 'testsuite' code, but are to 'nonlib' code.
+all-testsuite := $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) \
+                $(tests-container))
+ifneq (,$(all-testsuite))
+cpp-srcs-left = $(all-testsuite)
+lib := testsuite
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
+endif
+
+all-nonlib := $(strip $(tests-internal) $(test-internal-extras) \
+                     $(others) $(others-extras))
 ifneq (,$(all-nonlib))
 cpp-srcs-left = $(all-nonlib)
 lib := nonlib
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
 endif
 
 
@@ -1345,14 +1328,6 @@ ifeq ($(build-shared),yes)
        LC_ALL=C $(OBJDUMP) --dynamic-syms $< > $@T
        mv -f $@T $@
 
-# A sysdeps/.../Makefile can set abilist-pattern to something like
-# %-foo.abilist to look for libc-foo.abilist instead of libc.abilist.
-# This makes sense if multiple ABIs can be most cleanly supported by a
-# configuration without using separate sysdeps directories for each.
-ifdef abilist-pattern
-vpath $(abilist-pattern) $(+sysdep_dirs)
-endif
-
 vpath %.abilist $(+sysdep_dirs)
 
 # The .PRECIOUS rule prevents the files built by an implicit rule whose
@@ -1362,16 +1337,6 @@ vpath %.abilist $(+sysdep_dirs)
 .PRECIOUS: %.symlist
 generated += $(extra-libs:=.symlist)
 
-ifdef abilist-pattern
-$(objpfx)check-abi-%.out: $(common-objpfx)config.make $(abilist-pattern) \
-                         $(objpfx)%.symlist
-       $(check-abi-pattern); \
-       $(evaluate-test)
-$(objpfx)check-abi-%.out: $(common-objpfx)config.make $(abilist-pattern) \
-                         $(common-objpfx)%.symlist
-       $(check-abi-pattern); \
-       $(evaluate-test)
-endif
 $(objpfx)check-abi-%.out: $(common-objpfx)config.make %.abilist \
                          $(objpfx)%.symlist
        $(check-abi); \
@@ -1380,32 +1345,14 @@ $(objpfx)check-abi-%.out: $(common-objpfx)config.make %.abilist \
                          $(common-objpfx)%.symlist
        $(check-abi); \
        $(evaluate-test)
-define check-abi-pattern
-       diff -p -U 0 $(filter $(abilist-pattern),$^) $(filter %.symlist,$^) \
-            > $@
-endef
 define check-abi
        diff -p -U 0 $(filter %.abilist,$^) $(filter %.symlist,$^) > $@
 endef
 
-ifdef abilist-pattern
-update-abi-%: $(objpfx)%.symlist $(abilist-pattern)
-       $(update-abi-pattern)
-update-abi-%: $(common-objpfx)%.symlist $(abilist-pattern)
-       $(update-abi-pattern)
-endif
 update-abi-%: $(objpfx)%.symlist %.abilist
        $(update-abi)
 update-abi-%: $(common-objpfx)%.symlist %.abilist
        $(update-abi)
-define update-abi-pattern
-@if cmp -s $^ 2> /dev/null; \
- then \
-      echo '+++ $(filter $(abilist-pattern),$^) is unchanged'; \
- else cp -f $^; \
-      echo '*** Now check $(filter $(abilist-pattern),$^) changes for correctness ***'; \
- fi
-endef
 define update-abi
 @if cmp -s $^ 2> /dev/null; \
  then \
@@ -1415,26 +1362,13 @@ define update-abi
  fi
 endef
 
-# Patch all .abilist files for one DSO.  The find command locates
-# abilist files for all architectures.  The regular expression in the
-# find invocation is needed to separate libc.abilist and
-# libcrypt.abilist, for example.  It assumes that abilist-pattern, if
-# set, is of the form "%-SUFFIX", and not "%SUFFIX", that is, there is
-# a non-alphanumeric seperator between the pattern and the suffix
-# added.  The abilist files in /generic/ are filtered out because
-# these are expected to remain empty.
+# Patch all .abilist files for one DSO.  The find command locates abilist
+# files for all architectures.  The abilist files in /generic/ are
+# filtered out because these are expected to remain empty.
 define update-all-abi
 $(SHELL) $(..)scripts/update-abilist.sh $^ \
-  $$(find $(..)sysdeps \
-    -regextype posix-egrep -regex '.*/$*([^a-z0-9].*)?\.abilist$$' \
-    \! -regex '.*/generic/.*')
+  $$(find $(..)sysdeps -name '$*.abilist' \! -path '*/generic/*')
 endef
-ifdef abilist-pattern
-update-all-abi-%: $(abilist-pattern) $(objpfx)%.symlist
-       $(update-all-abi)
-update-all-abi-%: $(abilist-pattern) $(common-objpfx)%.symlist
-       $(update-all-abi)
-endif
 update-all-abi-%: %.abilist $(objpfx)%.symlist
        $(update-all-abi)
 update-all-abi-%: %.abilist $(common-objpfx)%.symlist
@@ -1487,8 +1421,7 @@ $(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
                   $(common-objpfx)config.make
        $(make-target-directory)
        { echo '#include "$(..)posix/bits/posix1_lim.h"';               \
-         echo '#define _LIBC 1';                                       \
-         echo '#include "$(..)misc/sys/uio.h"'; } |                    \
+       } |                                                             \
        $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)'   \
              $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT)
        sed $(sed-remove-objpfx) $(sed-remove-dotdot)                   \
@@ -1496,21 +1429,14 @@ $(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
        mv -f $(@:st=dt) $(@:st=d)
        fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`;       \
        filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`;    \
-       iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`;        \
        fopen_max=$${fopen_max:-16};                                    \
        filename_max=$${filename_max:-1024};                            \
-       if [ -z "$$iov_max" ]; then                                     \
-         define_iov_max="# undef IOV_MAX";                             \
-       else                                                            \
-         define_iov_max="# define IOV_MAX $$iov_max";                  \
-       fi;                                                             \
        sed -e "s/@FOPEN_MAX@/$$fopen_max/"                             \
            -e "s/@FILENAME_MAX@/$$filename_max/"                       \
            -e "s/@L_tmpnam@/$(L_tmpnam)/"                              \
            -e "s/@TMP_MAX@/$(TMP_MAX)/"                                \
            -e "s/@L_ctermid@/$(L_ctermid)/"                            \
            -e "s/@L_cuserid@/$(L_cuserid)/"                            \
-           -e "s/@define_IOV_MAX@/$$define_iov_max/"                   \
            $< > $(@:st=h.new)
        $(move-if-change) $(@:st=h.new) $(@:st=h)
 # Remove these last so that they can be examined if something went wrong.
@@ -1539,22 +1465,32 @@ clean: common-clean
 mostlyclean: common-mostlyclean
 
 do-tests-clean:
-       -rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) $(xtests) \
+       -rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) \
+                                                     $(tests-internal) \
+                                                     $(xtests) \
                                                      $(test-srcs)) \
                                     $(addsuffix .test-result,$(tests) \
+                                                             $(tests-internal) \
                                                              $(xtests) \
                                                              $(test-srcs)))
 
 # Remove the object files.
 common-mostlyclean:
-       -rm -f $(addprefix $(objpfx),$(tests) $(xtests) $(test-srcs) \
+       -rm -f $(addprefix $(objpfx),$(tests) $(tests-internal) $(xtests) \
+                                    $(test-srcs) \
                                     $(others) $(sysdep-others) stubs \
-                                    $(addsuffix .o,$(tests) $(xtests) \
-                                                   $(test-srcs) $(others) \
+                                    $(addsuffix .o,$(tests) \
+                                                   $(tests-internal) \
+                                                   $(xtests) \
+                                                   $(test-srcs) \
+                                                   $(others) \
                                                    $(sysdep-others)) \
-                                    $(addsuffix .out,$(tests) $(xtests) \
+                                    $(addsuffix .out,$(tests) \
+                                                     $(tests-internal) \
+                                                     $(xtests) \
                                                      $(test-srcs)) \
                                     $(addsuffix .test-result,$(tests) \
+                                                             $(tests-internal) \
                                                              $(xtests) \
                                                              $(test-srcs)))
        -rm -f $(addprefix $(objpfx),$(extra-objs) $(extra-test-objs) \