S/390: Add hwcap value for transactional execution.
[platform/upstream/glibc.git] / Makerules
index b0be86b..56dc60b 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 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
@@ -12,9 +12,8 @@
 # Lesser General Public License for more details.
 
 # You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
 
 #
 #      Common rules for making the GNU C library.  This file is included
@@ -109,6 +108,21 @@ $(common-objpfx)%.latest: $(common-objpfx)abi-versions.h
 endif # avoid-generated
 endif # $(versioning) = yes
 
+ifndef avoid-generated
+before-compile := $(common-objpfx)libc-abis.h $(before-compile)
+$(common-objpfx)libc-abis.h: $(common-objpfx)libc-abis.stamp; @:
+$(common-objpfx)libc-abis.stamp: $(..)scripts/gen-libc-abis \
+                            $(firstword $(wildcard $(sysdirs:=/libc-abis)) \
+                                        $(..)libc-abis) \
+                            $(..)Makerules
+       $(SHELL) $< \
+                $(base-machine)-$(config-vendor)-$(config-os) \
+                < $(word 2,$^) > $(@:.stamp=.h)T
+       $(move-if-change) $(@:.stamp=.h)T $(@:.stamp=.h)
+       touch $@
+common-generated += $(common-objpfx)libc-abis.h
+endif # avoid-generated
+
 # Make sure the subdirectory for object files gets created.
 ifdef objpfx
 ifeq (,$(wildcard $(objpfx).))
@@ -207,10 +221,9 @@ endif
 # patterns matching sysdep directories whose assembly source files should
 # be suppressed.
 ifdef inhibit-sysdep-asm
-define open-check-inhibit-asm
-case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) : ;; *)
+define check-inhibit-asm
+case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) asm= ;; esac;
 endef
-close-check-inhibit-asm = ;; esac ;
 endif
 
 -include $(common-objpfx)sysd-rules
@@ -221,7 +234,8 @@ sysd-rules-force = FORCE
 FORCE:
 endif
 $(common-objpfx)sysd-rules: $(common-objpfx)config.make $(..)Makerules \
-                           $(sysdep-makefiles) $(sysd-rules-force)
+                           $(sysdep-makefiles) $(sysdep-makeconfigs) \
+                           $(sysd-rules-force)
        -@rm -f $@T
        (echo 'sysd-rules-sysdirs := $(config-sysdirs)';                      \
         for dir in $(config-sysdirs); do                                     \
@@ -229,36 +243,22 @@ $(common-objpfx)sysd-rules: $(common-objpfx)config.make $(..)Makerules \
           /*) ;;                                                             \
           *) dir="\$$(..)$$dir" ;;                                           \
           esac;                                                              \
-          for o in $(all-object-suffixes); do \
-            $(open-check-inhibit-asm) \
-            echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile); \
-                 \$$(compile-command.S)";                                    \
-            echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile); \
-                 \$$(compile-command.s)";                                    \
-            echo "\$$(objpfx)rtld-%$$o: $$dir/%.S \$$(before-compile); \
-                 \$$(compile-command.S)";                                    \
-            echo "\$$(objpfx)rtld-%$$o: $$dir/%.s \$$(before-compile); \
-                 \$$(compile-command.s)";                                    \
-            echo "\$$(objpfx)ptw-%$$o: $$dir/%.S \$$(before-compile); \
-                 \$$(compile-command.S)";                                    \
-            echo "\$$(objpfx)ptw-%$$o: $$dir/%.s \$$(before-compile); \
-                 \$$(compile-command.s)";                                    \
-            echo "\$$(objpfx)m_%$$o: $$dir/s_%.S \$$(before-compile); \
-                 \$$(compile-command.S)";                                    \
-            echo "\$$(objpfx)m_%$$o: $$dir/s_%.s \$$(before-compile); \
-                 \$$(compile-command.s)";                                    \
-            $(close-check-inhibit-asm) \
-            echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile); \
-                 \$$(compile-command.c)";                                    \
-            echo "\$$(objpfx)rtld-%$$o: $$dir/%.c \$$(before-compile); \
-                 \$$(compile-command.c)";                                    \
-            echo "\$$(objpfx)ptw-%$$o: $$dir/%.c \$$(before-compile); \
-                 \$$(compile-command.c)";                                    \
-            echo "\$$(objpfx)m_%$$o: $$dir/s_%.c \$$(before-compile); \
-                 \$$(compile-command.c)";                                    \
-          done; \
-          echo "\$$(inst_includedir)/%.h: $$dir/%.h \$$(+force); \
-                       \$$(do-install)";                                     \
+          asm='.S';                                                          \
+          $(check-inhibit-asm)                                               \
+          for o in $(all-object-suffixes); do                                \
+            set $(subst :, ,$(sysd-rules-patterns));                         \
+            while [ $$# -ge 2 ]; do                                          \
+              t=$$1; shift;                                                  \
+              d=$$1; shift;                                                  \
+              v=$${t%%%}; [ x"$$v" = x ] || v="\$$($${v}CPPFLAGS)";          \
+              for s in $$asm .c; do                                          \
+                echo "\$$(objpfx)$$t$$o: $$dir/$$d$$s \$$(before-compile)";  \
+                echo " \$$(compile-command$$s) $$v";                         \
+              done;                                                          \
+            done;                                                            \
+          done;                                                              \
+          echo "\$$(inst_includedir)/%.h: $$dir/%.h \$$(+force)";            \
+          echo "       \$$(do-install)";                                     \
         done;                                                                \
         echo 'sysd-rules-done = t') > $@T
        mv -f $@T $@
@@ -275,12 +275,6 @@ object-suffixes-left := $(all-object-suffixes)
 include $(o-iterator)
 
 define o-iterator-doit
-$(objpfx)%$o: %.s $(before-compile); $$(compile-command.s)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-
-define o-iterator-doit
 $(objpfx)%$o: %.c $(before-compile); $$(compile-command.c)
 endef
 object-suffixes-left := $(all-object-suffixes)
@@ -304,12 +298,6 @@ object-suffixes-left := $(all-object-suffixes)
 include $(o-iterator)
 
 define o-iterator-doit
-$(objpfx)%$o: $(objpfx)%.s $(before-compile); $$(compile-command.s)
-endef
-object-suffixes-left := $(all-object-suffixes)
-include $(o-iterator)
-
-define o-iterator-doit
 $(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c)
 endef
 object-suffixes-left := $(all-object-suffixes)
@@ -365,24 +353,31 @@ 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)
-compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION) $(compile-mkdep-flags)
 compile-command.c = $(compile.c) $(OUTPUT_OPTION) $(compile-mkdep-flags)
 compile-command.cc = $(compile.cc) $(OUTPUT_OPTION) $(compile-mkdep-flags)
 
+# Like compile-mkdep-flags, but for use with $(BUILD_CC).  We don't want to
+# track system includes here, they may spuriously trigger an install rule,
+# and would cause the check-local-headers test to fail.
+native-compile-mkdep-flags = -MMD -MP -MF $@.dt -MT $@
+
 # GCC can grok options after the file name, and it looks nicer that way.
 compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
 compile.cc = $(CXX) $< -c $(CXXFLAGS) $(CPPFLAGS)
 compile.S = $(CC) $< -c $(CPPFLAGS) $(S-CPPFLAGS) \
                  $(ASFLAGS) $(ASFLAGS-$(suffix $@))
+COMPILE.c = $(CC) -c $(CFLAGS) $(CPPFLAGS)
 COMPILE.S = $(CC) -c $(CPPFLAGS) $(S-CPPFLAGS) \
                  $(ASFLAGS) $(ASFLAGS-$(suffix $@))
-COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS)
 
 # We need this for the output to go in the right place.  It will default to
 # empty if make was configured to work with a cc that can't grok -c and -o
 # together.  You can't compile the C library with such a compiler.
 OUTPUT_OPTION = -o $@
 
+# This is the end of the pipeline for compiling generated C code.
+compile-stdin.c = $(COMPILE.c) -o $@ -x c - $(compile-mkdep-flags)
+
 # We need the $(CFLAGS) to be in there to have the right predefines during
 # the dependency run for C sources.  But having it for assembly sources can
 # get the wrong predefines.
@@ -407,7 +402,7 @@ endif
 \f
 # Modify the list of routines we build for different targets
 
-ifeq (yesyes,$(build-shared)$(elf))
+ifeq (yes,$(build-shared))
 ifndef libc.so-version
 # Undefine this because it can't work when we libc.so is unversioned.
 static-only-routines =
@@ -448,13 +443,8 @@ endif
 # $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
 # on other shared objects.
 lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp)
-ifneq (,$(findstring aix,$(config-os)))
-       (echo '#!'; \
-        dump -g $< | sed '1,6d' | cut -f2 | sort | uniq) > $(<:a=exp)
-endif
        $(build-shlib)
 
-ifeq ($(elf),yes)
 define build-shlib-helper
 $(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) \
          $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(config-LDFLAGS) \
@@ -464,20 +454,12 @@ $(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) \
          $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
          -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
 endef
-else
-ifneq (,$(findstring aix,$(config-os)))
-define build-shlib-helper
-$(LINK.o) -Wl,-G,-bM:SRE,-bnoentry,-bE:$(<:a=exp) \
-         $(sysdep-LDFLAGS) $(config-LDFLAGS) $(extra-B-$(@F:lib%.so=%).so) \
-         $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
-         $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
-         -L$(subst :, -L,$(rpath-link))
-endef
-else
-endif
-endif
 
-ifeq (yes,$(elf))
+ifeq (yes,$(use-default-link))
+# If the linker is good enough, we can let it use its default linker script.
+shlib-lds =
+shlib-lds-flags =
+else
 # binutils only position loadable notes into the first page for binaries,
 # not for shared objects
 $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
@@ -509,37 +491,19 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
                 __libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\
                 PROVIDE(__stop___libc_thread_subfreeres = .);\
                 /DISCARD/ : { *(.gnu.glibc-stub.*) }@'
+       test -s $@T
        mv -f $@T $@
 common-generated += shlib.lds
 
+shlib-lds = $(common-objpfx)shlib.lds
+shlib-lds-flags = -T $(shlib-lds)
+endif
+
 define build-shlib
-$(build-shlib-helper) -o $@ -T $(common-objpfx)shlib.lds \
+$(build-shlib-helper) -o $@ $(shlib-lds-flags) \
          $(csu-objpfx)abi-note.o $(build-shlib-objlist)
 endef
-else
-ifneq (,$(findstring aix,$(config-os)))
-define build-shlib
-$(build-shlib-helper) \
-       -o $@ \
-       $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \
-       $(no-whole-archive) $(LDLIBS-$(@F:lib%.so=%).so)
-endef
-define build-shlib
-$(build-shlib-helper) \
-         $(build-shlib-objlist)
-endef
-endif
-endif
 
-ifneq (,$(findstring aix,$(config-os)))
-define build-module-helper
-$(LINK.o) -Wl,-G -Wl,-bM:SRE -Wl,-bnoentry -Wl,-bexpall \
-         $(sysdep-LDFLAGS) $(config-LDFLAGS) \
-         $(load-map-file) \
-         $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
-         -L$(subst :, -L,$(rpath-link)) -Wl,-L=$(rpath-link)
-endef
-else
 define build-module-helper
 $(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(config-LDFLAGS) \
          $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) \
@@ -547,44 +511,24 @@ $(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(config-LDFLAGS) \
          $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
          -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
 endef
-endif
 
 # This macro is similar to build-shlib but it does not define a soname
 # and it does not depend on the destination name to start with `lib'.
-ifeq (yes,$(elf))
 # binutils only position loadable notes into the first page for binaries,
 # not for shared objects
 define build-module
-$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \
+$(build-module-helper) -o $@ $(shlib-lds-flags) \
          $(csu-objpfx)abi-note.o $(build-module-objlist)
 endef
 define build-module-asneeded
-$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \
+$(build-module-helper) -o $@ $(shlib-lds-flags) \
          $(csu-objpfx)abi-note.o \
          -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed
 endef
-else
-ifneq (,$(findstring aix,$(config-os)))
-define build-module
-$(build-module-helper) \
-         -o $@ \
-         $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \
-         $(no-whole-archive) $(LDLIBS-$(@F:%.so=%).so)
-endef
-else
-define build-module
-define build-module
-$(build-module-helper) \
-         -o $@ \
-         $(build-module-objlist)
-endef
-endif
-endif
 
 build-module-helper-objlist = \
        $(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
                   $(filter-out %.lds $(map-file) $(+preinit) $(+postinit),$^))
-whole-archive := -Wl,--whole-archive
 
 build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so)
 build-shlib-objlist = $(build-module-helper-objlist) \
@@ -607,16 +551,32 @@ endif
 # contains some of libc_pic.a already, which will prevent the COMMONs
 # from being allocated in libc.so, which introduces evil dependencies
 # between libc.so and ld.so, which can make it impossible to upgrade.
-ifeq ($(elf),yes)
 $(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
        $(LINK.o) -nostdlib -nostartfiles -r -o $@ \
-       $(LDFLAGS-c_pic.os) -Wl,-d -Wl,--whole-archive $^
+       $(LDFLAGS-c_pic.os) -Wl,-d $(whole-archive) $^ -o $@
+
+ifeq (,$(strip $(shlib-lds-flags)))
+# Generate a list of -R options to excise .gnu.glibc-stub.* sections.
+$(common-objpfx)libc_pic.opts: $(common-objpfx)libc_pic.os
+       $(OBJDUMP) -h $< | \
+       $(AWK) '$$2 ~ /\.gnu\.glibc-stub\./ { print "-R", $$2 }' \
+               > $@T
+       mv -f $@T $@
+# Apply those -R options.
+$(common-objpfx)libc_pic.os.clean: $(common-objpfx)libc_pic.opts \
+                                  $(common-objpfx)libc_pic.os
+       $(OBJCOPY) @$^ $@
+generated += libc_pic.opts libc_pic.os.clean
+
+libc_pic_clean := .clean
+endif
+
 # Use our own special initializer and finalizer files for libc.so.
 $(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
-                        $(common-objpfx)libc_pic.os \
+                        $(common-objpfx)libc_pic.os$(libc_pic_clean) \
                         $(elfobjdir)/sofini.os \
                         $(elfobjdir)/interp.os $(elfobjdir)/ld.so \
-                        $(common-objpfx)shlib.lds
+                        $(shlib-lds)
        $(build-shlib)
 ifeq ($(versioning),yes)
 $(common-objpfx)libc.so: $(common-objpfx)libc.map
@@ -628,23 +588,6 @@ $(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
 common-generated += libc.so$(libc.so-version)
 endif
 endif
-else
-ifneq (,$(findstring aix,$(config-os)))
-$(common-objpfx)libc.so: $(common-objpfx)libc_pic.a
-       @rm -f $@
-       (echo '#!'; \
-        dump -g $^ | sed '1,6d' | cut -f2 | sort | uniq) > $(^:a=exp)
-       sed '/__mulh/d;/__mull/d;/__divss/d;/__divus/d;/__quoss/d;/__quous/d' \
-           /lib/syscalls.exp > $(common-objpfx)syscalls.exp
-       $(LINK.o) -G -bM:SRE -bnoentry -bE:$(^:a=exp) \
-                 -bE:$(common-objpfx)syscalls.exp \
-                 -bI:$(common-objpfx)syscalls.exp \
-                 -L$(common-objpfx) -o $@ $^
-# AIX runtime ld wants libc.so to be libc.a(shr.o) hardwired
-       cp $@ $(common-objpfx)shr.o
-       $(AR) $(ARFLAGS) $(common-objpfx)libc.a $(common-objpfx)shr.o
-endif
-endif
 \f
 # Figure out the source filenames in this directory.
 
@@ -687,13 +630,14 @@ include $(patsubst %,$(..)extra-modules.mk,$(modules-names))
 
 extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names))
 $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \
-               $(objpfx)%.os $(common-objpfx)shlib.lds \
+               $(objpfx)%.os $(shlib-lds) \
                $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
        $(build-module)
 endif
 \f
 +depfiles := $(sources:.c=.d) \
             $(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))
 ifeq ($(build-programs),yes)
@@ -732,7 +676,9 @@ MAKEFLAGS := $(MAKEFLAGS)r
 # Generic rule for making directories.
 %/:
 # mkdir isn't smart enough to strip a trailing /.
-       mkdir $(@:%/=%)
+# We always require a mkdir which supports the -p option to avoid error
+# messages in case of races.
+       mkdir -p $(@:%/=%)
 \f
 # Make sure that object files are not removed
 # when they are intermediates between sources and library members.
@@ -802,7 +748,6 @@ endef
 define do-makelib
 cd $(common-objdir) && \
 $(AR) $(CREATE_ARFLAGS) $(@F) `cat $(patsubst $(common-objpfx)%,%,$^)`
-$(RANLIB) $@
 endef
 subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%)
 subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
@@ -824,7 +769,6 @@ define build-extra-lib
 $(patsubst %/,cd % &&,$(objpfx)) \
 $(AR) $(CREATE_ARFLAGS) $(@:$(objpfx)%=%) \
       $(patsubst $(objpfx)%,%,$^)
-$(RANLIB) $@
 endef
 \f
 # Installation.
@@ -834,12 +778,13 @@ force-install:
 
 # $(install-lib) are installed from the object directory into $(libdir);
 # files in $(install-lib) matching `lib%.a' are ranlib'd after installation
-# unless they also appear in $(non-lib.a).  $(install-data) are installed
-# as they are into $(datadir).  $(headers) are installed as they are in
+# unless they also appear in $(non-lib.a).  $(install-data) are installed as
+# they are into $(datadir).  $(headers) are installed as they are in
 # $(includedir).  $(install-bin), $(install-bin-script) and $(install-sbin)
 # are installed from the object directory into $(bindir), $(bindir) and
-# $(sbindir), respectively.  $(install-others) are absolute path names of
-# files to install; rules to install them are defined elsewhere.
+# $(sbindir), respectively.  $(install-others) and $(install-others-programs)
+# are absolute path names of files to install; rules to install them are
+# defined elsewhere.
 
 # The simple library name to install libc.a under.
 # This could be defined by a sysdep Makefile.
@@ -868,9 +813,6 @@ install: $(installed-libcs)
 $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
        $(make-target-directory)
        $(INSTALL_DATA) $(common-objpfx)lib$(*:$(libc-name)%=c%) $@
-# Running ranlib after installing makes the __.SYMDEF time stamp up to
-# date, which avoids messages from some linkers.
-       $(RANLIB) $@
 
 define do-install-program
 $(make-target-directory)
@@ -899,11 +841,11 @@ install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
 #      $(inst_libdir)/libfoo.so        -- for linking, symlink or ld script
 #      $(inst_slibdir)/libfoo.so.NN    -- for loading by SONAME, symlink
 #      $(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file
-V := $(firstword $($(subdir)-version) $(version))
+lib-version := $(firstword $($(subdir)-version) $(version))
 install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \
                      $(foreach L,$(install-lib.so-versioned),\
                                $(inst_libdir)/$L \
-                               $(inst_slibdir)/$(L:.so=)-$V.so \
+                               $(inst_slibdir)/$(L:.so=)-$(lib-version).so \
                                $(inst_slibdir)/$L$($L-version))
 
 # Install all the unversioned shared libraries.
@@ -964,10 +906,15 @@ install: $(inst_slibdir)/libc.so$(libc.so-version)
 $(common-objpfx)format.lds: $(..)scripts/output-format.sed \
                            $(common-objpfx)config.make \
                            $(common-objpfx)config.h $(..)Makerules
+ifneq (unknown,$(output-format))
+       echo > $@.new 'OUTPUT_FORMAT($(output-format))'
+else
        $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
                  -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
        | sed -n -f $< > $@.new
+       test -s $@.new
        rm -f $@.so
+endif
        mv -f $@.new $@
 common-generated += format.lds
 
@@ -1104,7 +1051,6 @@ ifdef install-lib.a
 $(install-lib.a:lib%.a=$(inst_libdir)/lib$(libprefix)%.a): \
   $(inst_libdir)/lib$(libprefix)%.a: $(objpfx)lib%.a $(+force)
        $(do-install)
-       $(patsubst %,$(RANLIB) $@,$(filter-out $(non-lib.a),$(<F)))
 endif
 endif
 ifdef install-data
@@ -1118,6 +1064,8 @@ ifdef headers
 # headers in the sysdeps tree.
 $(inst_includedir)/%.h: $(objpfx)%.h $(+force)
        $(do-install)
+$(inst_includedir)/%.h: $(common-objpfx)%.h $(+force)
+       $(do-install)
 $(inst_includedir)/%.h: %.h $(+force)
        $(do-install)
 $(inst_includedir)/%.h: $(..)include/%.h $(+force)
@@ -1144,6 +1092,7 @@ install-lib-nosubdir: $(addprefix $(inst_libdir)/,\
 install-data-nosubdir: $(addprefix $(inst_datadir)/,$(install-data))
 install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))
 install-others-nosubdir: $(install-others)
+install-others-programs-nosubdir: $(install-others-programs)
 
 # We need all the `-nosubdir' targets so that `install' in the parent
 # doesn't depend on several things which each iterate over the subdirs.
@@ -1152,36 +1101,25 @@ install-others-nosubdir: $(install-others)
 install-%:: install-%-nosubdir ;
 
 .PHONY: install install-no-libc.a-nosubdir
-ifeq ($(build-programs),yes)
-install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
-                           install-bin-nosubdir install-bin-script-nosubdir \
-                           install-lib-nosubdir install-others-nosubdir \
-                           install-rootsbin-nosubdir install-sbin-nosubdir
-else
-install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
+install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir \
                            install-lib-nosubdir install-others-nosubdir
+ifeq ($(build-programs),yes)
+install-no-libc.a-nosubdir: install-bin-nosubdir install-bin-script-nosubdir \
+                           install-rootsbin-nosubdir install-sbin-nosubdir \
+                           install-others-programs-nosubdir
 endif
 install: install-no-libc.a-nosubdir
 \f
-# Command to compile $< in $(objdir) using the native libraries.
+# Command to compile $< using the native libraries.
 define native-compile
 $(make-target-directory)
-$(patsubst %/,cd % &&,$(objpfx)) \
-$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
-           $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(@F)
-endef
-
-# Command to compile $< in $(common-objdir) using the native libraries.
-# We must cd to $(objdir) anyway so that $(..)config.h is valid.
-define common-objdir-compile
-$(patsubst %/,cd % &&,$(objpfx)) \
 $(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
-           $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(..)$(@F)
+           $< $(OUTPUT_OPTION) $(BUILD_LDFLAGS)
 endef
 
 # We always want to use configuration definitions.
-# Note that this is only used for commands running in $(objpfx).
-ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) -include $(..)config.h
+ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -D_GNU_SOURCE \
+                  -DIS_IN_build -include $(common-objpfx)config.h
 
 # Support the GNU standard name for this target.
 .PHONY: check
@@ -1211,61 +1149,38 @@ ifeq ($(versioning),yes)
        mv -f $@T $@
 
 %.dynsym: %.so
-       $(OBJDUMP) --dynamic-syms $< > $@T
+       LC_ALL=C $(OBJDUMP) --dynamic-syms $< > $@T
        mv -f $@T $@
 
-check-abi-%: $(..)scripts/extract-abilist.awk $(common-objpfx)config.make \
-            $(..)abilist/%.abilist $(objpfx)%.symlist
+vpath %.abilist $(+sysdep_dirs)
+
+# The .PRECIOUS rule prevents the files built by an implicit rule whose
+# target pattern is %.symlist from being considered "intermediate files"
+# and automatically removed.  We only want these files to be removed by
+# 'make clean', which is handled by the 'generated' variable.
+.PRECIOUS: %.symlist
+generated += $(extra-libs:=.symlist)
+
+check-abi-%: $(common-objpfx)config.make %.abilist $(objpfx)%.symlist
        $(check-abi)
-check-abi-%: $(..)scripts/extract-abilist.awk $(common-objpfx)config.make \
-            $(..)abilist/%.abilist $(common-objpfx)%.symlist
+check-abi-%: $(common-objpfx)config.make %.abilist $(common-objpfx)%.symlist
        $(check-abi)
 define check-abi
-       LC_ALL=C \
-       $(AWK) -f $< -v 'config=$(check-abi-config)' \
-              $(patsubst %,-v 'lastversion=%',$($*-abi-frozen)) \
-              $(filter %.abilist,$^) \
-       | { diff -p -U 0 - $(filter %.symlist,$^) $(check-abi-warn) ; }
+       diff -p -U 0 $(filter %.abilist,$^) $(filter %.symlist,$^)
 endef
-ifeq ($(enable-check-abi),warn)
-check-abi-warn = || echo '*** WARNING: $*.so failed ABI check'
-endif
 
-ifeq ($(firstword $(sysd-sorted-done) f)$(firstword $(generating) f),tf)
--include $(common-objpfx)tls.make
-config-tls := notls
-ifeq ($(use-tls),yes)
-config-tls := tls
-endif
-ifeq ($(use-thread),yes)
-config-tls := thread
-endif
-check-abi-config := \
-  $(config-machine)-$(config-vendor)-$(config-os)/$(config-tls)
-endif
-
-update-abi-%: $(..)scripts/merge-abilist.awk $(..)abilist/%.abilist \
-             $(objpfx)%.symlist
+update-abi-%: $(objpfx)%.symlist %.abilist
        $(update-abi)
-update-abi-%: $(..)scripts/merge-abilist.awk $(..)abilist/%.abilist \
-             $(common-objpfx)%.symlist
+update-abi-%: $(common-objpfx)%.symlist %.abilist
        $(update-abi)
-ifndef update-abi-config
-define update-abi
-       @echo 'Run $(MAKE) $@ update-abi-config=REGEXP'; exit 2
-endef
-else
 define update-abi
-LC_ALL=C $(AWK) -v config='$(update-abi-config)' -f $^ \
-        > $(..)abilist/$*.abilist.new
-@if cmp -s $(..)abilist/$*.abilist.new $(..)abilist/$*.abilist 2> /dev/null; \
- then rm -f $(..)abilist/$*.abilist.new; \
-      echo '+++ $(..)abilist/$*.abilist is unchanged'; \
- else mv -f $(..)abilist/$*.abilist.new $(..)abilist/$*.abilist; \
-      echo '*** Now check $*.abilist changes for correctness ***'; \
+@if cmp -s $^ 2> /dev/null; \
+ then \
+      echo '+++ $(filter %.abilist,$^) is unchanged'; \
+ else cp -f $^; \
+      echo '*** Now check $(filter %.abilist,$^) changes for correctness ***'; \
  fi
 endef
-endif
 
 .PHONY: update-abi check-abi
 update-abi: $(patsubst %.so,update-abi-%,$(install-lib.so-versioned))
@@ -1285,12 +1200,10 @@ common-generated += libc.symlist
 endif
 
 ifeq ($(build-shared),yes)
-ifneq ($(enable-check-abi),no)
 ifdef subdir
 tests: check-abi
 endif
 endif
-endif
 
 endif
 
@@ -1310,7 +1223,7 @@ $(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
          echo '#define _LIBC 1';                                       \
          echo '#include "$(..)misc/sys/uio.h"'; } |                    \
        $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)'   \
-             $(+includes) -xc - -o $(@:st=hT)
+             $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT)
        sed $(sed-remove-objpfx) $(sed-remove-dotdot)                   \
            $(@:st=dT) > $(@:st=dt)
        mv -f $(@:st=dt) $(@:st=d)
@@ -1350,6 +1263,7 @@ echo-headers:
 
 %.bz2: %; bzip2 -9vk $<
 %.gz: %; gzip -9vnc $< > $@.new && mv -f $@.new $@
+%.xz: %; xz -9evk $<
 \f
 # Common cleaning targets.
 
@@ -1393,11 +1307,10 @@ common-clean: common-mostlyclean
        -rm -f $(objpfx)*.d $(objpfx)*.dt
        -rm -fr $(addprefix $(objpfx),$(generated-dirs))
        -rm -f $(addprefix $(common-objpfx),$(common-generated))
+       -rm -f $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
 \f
 # Produce a file `stubs' which contains `#define __stub_FUNCTION'
-# for each function which is a stub.  We grovel over all the .d files
-# looking for references to <stub-tag.h>.  Then we grovel over each
-# referenced source file to see what stub function it defines.
+# for each function which is a stub.
 
 ifdef objpfx
 .PHONY: stubs # The parent Makefile calls this target.
@@ -1409,7 +1322,7 @@ $(objpfx)stubs: $(objs-for-stubs)
 ifneq (,$(strip $(objs-for-stubs)))
        (cd $(objpfx).; $(OBJDUMP) -h $(patsubst $(objpfx)%,%,$^)) | \
        $(AWK) '/\.gnu\.glibc-stub\./ { \
-                 sub(/\.gnu\.glibc-stub\./, "", $$2); \
+                 sub(/\.gnu\.glibc-stub\./, "", $$2); \
                  stubs[$$2] = 1; } \
                END { for (s in stubs) print "#define __stub_" s }' > $@T
        mv -f $@T $@
@@ -1425,9 +1338,6 @@ $(gpl2lgpl): %: $(..)gpl2lgpl.sed /home/gd/gnu/lib/%
 # So I don't edit them by mistake.
        chmod a-w $@-tmp
        mv -f $@-tmp $@
-ifeq ($(with-cvs),yes)
-       test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $^' $@
-endif
 endif
 endif