diff -Naur glibc-2.8.orig/extra-lib.mk glibc-2.8/extra-lib.mk
--- glibc-2.8.orig/extra-lib.mk	2008-11-24 14:14:23.000000000 -0500
+++ glibc-2.8/extra-lib.mk	2008-11-24 14:14:26.000000000 -0500
@@ -13,7 +13,7 @@
 
 ifneq (,$($(lib)-static-only-routines))
 ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version)))
-object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS)
+object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST)
 endif
 endif
 
@@ -29,7 +29,7 @@
 
 # Add each flavor of library to the lists of things to build and install.
 install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
-extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\
+extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\
 			$(patsubst %,%$o,$(filter-out \
 					   $($(lib)-shared-only-routines),\
 					   $(all-$(lib)-routines))))
@@ -57,7 +57,7 @@
 
 
 # Use o-iterator.mk to generate a rule for each flavor of library.
-ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib))))
+ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib))))
 define o-iterator-doit
 $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \
   $(patsubst %,$(objpfx)%$o,\
@@ -65,7 +65,7 @@
 			  $(all-$(lib)-routines))); \
 	$$(build-extra-lib)
 endef
-object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib)))
+object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib)))
 include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left))
 endif
 
@@ -77,9 +77,9 @@
 	$(build-extra-lib)
 endif
 
-ifneq (,$(filter .oS,$(object-suffixes-$(lib))))
-$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \
-  $(patsubst %,$(objpfx)%.oS,\
+ifneq (,$(filter .oST,$(object-suffixes-$(lib))))
+$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \
+  $(patsubst %,$(objpfx)%.oST,\
 	     $(filter $($(lib)-static-only-routines),\
 		      $(all-$(lib)-routines)))
 	$(build-extra-lib)
diff -Naur glibc-2.8.orig/Makeconfig glibc-2.8/Makeconfig
--- glibc-2.8.orig/Makeconfig	2008-11-24 14:14:24.000000000 -0500
+++ glibc-2.8/Makeconfig	2008-11-24 14:14:26.000000000 -0500
@@ -471,7 +471,7 @@
 # run the linked programs.
 link-libc = -Wl,-rpath-link=$(rpath-link) \
 	    $(common-objpfx)libc.so$(libc.so-version) \
-	    $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib)
+		$(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib)
 # This is how to find at build-time things that will be installed there.
 rpath-dirs = math elf dlfcn nss nis rt resolv crypt
 endif
@@ -692,7 +692,7 @@
 # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
 # to pass different flags for each flavor.
 libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
-all-object-suffixes := .o .os .op .og .ob .oS
+all-object-suffixes := .o .os .op .og .ob .oST
 object-suffixes :=
 CPPFLAGS-.o = $(pic-default)
 CFLAGS-.o = $(filter %frame-pointer,$(+cflags))
@@ -748,14 +748,14 @@
 
 ifeq (yes,$(build-shared))
 # Build special library that contains the static-only routines for libc.
-object-suffixes-for-libc += .oS
+object-suffixes-for-libc += .oST
 
 # Must build the routines as PIC, though, because they can end up in (users')
 # shared objects.  We don't want to use CFLAGS-os because users may, for
 # example, make that processor-specific.
-CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag)
-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
-libtype.oS = lib%_nonshared.a
+CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag)
+CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
+libtype.oST = lib%_nonshared.a
 endif
 
 # The assembler can generate debug information too.
diff -Naur glibc-2.8.orig/Makeconfig.orig glibc-2.8/Makeconfig.orig
--- glibc-2.8.orig/Makeconfig.orig	1969-12-31 19:00:00.000000000 -0500
+++ glibc-2.8/Makeconfig.orig	2008-09-03 10:51:30.000000000 -0400
@@ -0,0 +1,955 @@
+# Copyright (C) 1991-2003,2004,2005,2006,2007,2008
+#	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
+# 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.
+
+# 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
+# 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.
+
+#
+#	Makefile configuration options for the GNU C library.
+#
+ifneq (,)
+This makefile requires GNU Make.
+endif
+
+all: # Make this the default goal
+
+ifneq "$(origin +included-Makeconfig)" "file"
+
++included-Makeconfig := yes
+
+ifdef subdir
+.. := ../
+endif
+
+# If config.make exists, the source directory was configured,
+# so don't try to be clever and find another directory to build in.
+ifneq (,$(wildcard $(..)config.make))
+ARCH =
+machine =
+else	# Not configured.
+ifndef ARCH
+ifdef machine
+ARCH = $(machine)
+endif # machine
+endif # ARCH
+endif # config.make
+
+# Directory for object files and libc.a.  If this is not defined, the
+# object files live in the subdirectories where their sources live, and
+# libc.a lives in the parent directory (this probably doesn't work any
+# more).
+ifdef ARCH
+ifeq ($(filter /%,$(ARCH)),)
+objdir := $(..)$(ARCH)
+else
+objdir = $(ARCH)
+endif
+endif
+
+# $(common-objdir) is the place to put objects and
+# such that are not specific to a single subdir.
+ifdef objdir
+objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/)
+common-objpfx = $(objdir)/
+common-objdir = $(objdir)
+else
+objpfx :=
+ifdef ..
+common-objpfx = $(..)
+common-objdir = ..
+else
+# This is a kludge.  make wizards might grok.
+common-objpfx = sysdeps/../
+common-objdir = .
+endif
+endif
+
+# Root of the sysdeps tree.
+sysdep_dir := $(..)sysdeps
+export sysdep_dir := $(sysdep_dir)
+
+# Get the values defined by options to `configure'.
+include $(common-objpfx)config.make
+
+# What flags to give to sources which call user provided callbacks
+uses-callbacks = $(exceptions)
+
+# What flags to give to tests which test stack alignment
+stack-align-test-flags =
+
+# We have a special subdir for each binary format.
+# For now, only ELF is fully supported.
+ifeq ($(elf),yes)
+binfmt-subdir = elf
+else
+# This is probably better than nothing.
+binfmt-subdir = aout
+endif
+
+# Complete path to sysdep dirs.
+# `configure' writes a definition of `config-sysdirs' in `config.make'.
+sysdirs := $(foreach D,$(config-sysdirs),$(firstword $(filter /%,$D) $(..)$D))
+
+# Add-ons that contribute sysdeps trees get added to the include list
+# after sysdeps/generic.  This makes #include <sysdeps/...> work right
+# to find specific add-on files without assuming the add-on directory name.
+# It also means that headers can go into an add-on's base directory
+# instead of the add-on needing a sysdeps/generic of its own.
+sysdeps-srcdirs := $(foreach add-on,$(sysdeps-add-ons),\
+			     $(firstword $(filter /%,$(add-on)) \
+					 $(..)$(add-on)))
++sysdep_dirs = $(sysdirs) $(sysdeps-srcdirs)
+ifdef objdir
++sysdep_dirs := $(objdir) $(+sysdep_dirs)
+endif
+
+# Run config.status to update config.make and config.h.  We don't show the
+# dependence of config.h to Make, because it is only touched when it
+# changes and so config.status would be run every time; the dependence of
+# config.make should suffice to force regeneration and re-exec, and the new
+# image will notice if config.h changed.
+$(common-objpfx)config.make: $(common-objpfx)config.status \
+			     $(..)config.make.in $(..)config.h.in
+	cd $(<D); $(SHELL) $(<F)
+
+# Find all the add-on and sysdeps configure fragments, to make sure we
+# re-run configure when any of them changes.
+$(common-objpfx)config.status: $(..)version.h $(..)configure \
+			       $(foreach dir,$(sysdirs),\
+					 $(wildcard $(dir)/Implies) \
+					 $(patsubst %.in,%,\
+						    $(firstword $(wildcard \
+ $(addprefix $(dir)/,configure configure.in))))) \
+			       $(patsubst %.in,%,\
+					  $(foreach add-on,$(add-ons),\
+						    $(firstword $(wildcard \
+ $(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\
+	     configure configure.in)))))
+	@cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
+	 echo The GNU C library has not been configured. >&2; \
+	 echo Run \`configure\' to configure it before building. >&2; \
+	 echo Try \`configure --help\' for more details. >&2; \
+	 exit 1; fi
+
+# We don't want CPPFLAGS to be exported to the command running configure.
+unexport CPPFLAGS
+
+# Get the user's configuration parameters.
+ifneq ($(wildcard $(..)configparms),)
+include $(..)configparms
+endif
+ifneq ($(objpfx),)
+ifneq ($(wildcard $(common-objpfx)configparms),)
+include $(common-objpfx)configparms
+endif
+endif
+
+####
+####	These are the configuration variables.  You can define values for
+####	the variables below in the file `configparms'.
+####	Do NOT edit this file.
+####
+
+
+# Common prefix for machine-independent installation directories.
+ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
+prefix = /usr/local
+endif
+
+# Decide whether we shall build the programs or not.  We always do this
+# unless the user tells us (in configparms) or we are building for a
+# standalone target.
+ifndef build-programs
+ifneq ($(config-os),none)
+build-programs=yes
+else
+build-programs=no
+endif
+endif
+
+# Common prefix for machine-dependent installation directories.
+ifeq ($(origin exec_prefix),undefined)
+exec_prefix = $(prefix)
+endif
+
+# Where to install the library and object files.
+ifndef libdir
+libdir = $(exec_prefix)/lib
+endif
+inst_libdir = $(install_root)$(libdir)
+
+# Where to install the shared library and dynamic linker.
+ifndef slibdir
+slibdir = $(exec_prefix)/lib
+endif
+inst_slibdir = $(install_root)$(slibdir)
+
+# Prefix to put on files installed in $(libdir).  For libraries `libNAME.a',
+# the prefix is spliced between `lib' and the name, so the linker switch
+# `-l$(libprefix)NAME' finds the library; for other files the prefix is
+# just prepended to the whole file name.
+ifeq ($(origin libprefix),undefined)
+libprefix =
+endif
+
+# Where to install the header files.
+ifndef includedir
+includedir = $(prefix)/include
+endif
+inst_includedir = $(install_root)$(includedir)
+
+# Where to install machine-independent data files.
+# These are the timezone database, and the locale database.
+ifndef datadir
+datadir = $(prefix)/share
+endif
+inst_datadir = $(install_root)$(datadir)
+
+# Where to install the timezone data files (which are machine-independent).
+ifndef zonedir
+zonedir = $(datadir)/zoneinfo
+endif
+inst_zonedir = $(install_root)$(zonedir)
+
+# Where to install the locale files.
+ifndef localedir
+localedir = $(libdir)/locale
+endif
+inst_localedir = $(install_root)$(localedir)
+
+# Where to install the message catalog data files (which are
+# machine-independent).
+ifndef msgcatdir
+msgcatdir = $(datadir)/locale
+endif
+inst_msgcatdir = $(install_root)$(msgcatdir)
+
+# Where to install the locale charmap source files.
+ifndef i18ndir
+i18ndir = $(datadir)/i18n
+endif
+inst_i18ndir = $(install_root)$(i18ndir)
+
+# Where to install the shared object for charset transformation.
+ifndef gconvdir
+gconvdir = $(libdir)/gconv
+endif
+inst_gconvdir = $(install_root)$(gconvdir)
+
+# Where to install programs.
+ifndef bindir
+bindir = $(exec_prefix)/bin
+endif
+inst_bindir = $(install_root)$(bindir)
+
+# Where to install internal programs.
+ifndef libexecdir
+libexecdir = $(exec_prefix)/libexec
+endif
+inst_libexecdir = $(install_root)$(libexecdir)
+
+# Where to install administrative programs.
+ifndef rootsbindir
+rootsbindir = $(exec_prefix)/sbin
+endif
+inst_rootsbindir = $(install_root)$(rootsbindir)
+
+ifndef sbindir
+sbindir = $(exec_prefix)/sbin
+endif
+inst_sbindir = $(install_root)$(sbindir)
+
+# Where to install the Info files.
+ifndef infodir
+infodir = $(prefix)/info
+endif
+inst_infodir = $(install_root)$(infodir)
+
+# Where to install default configuration files.  These include the local
+# timezone specification and network data base files.
+ifndef sysconfdir
+sysconfdir = $(prefix)/etc
+endif
+inst_sysconfdir = $(install_root)$(sysconfdir)
+
+# What timezone should be the installed default (e.g., US/Eastern).
+# Run `make -C time echo-zonenames' to see a list of available zone names.
+# The local timezone can be changed with `zic -l TIMEZONE' at any time.
+ifndef localtime
+localtime = Factory
+endif
+
+# Where to install the "localtime" timezone file; this is the file whose
+# contents $(localtime) specifies.  If this is a relative pathname, it is
+# relative to $(zonedir).  It is a good idea to put this somewhere
+# other than there, so the zoneinfo directory contains only universal data,
+# localizing the configuration data elsewhere.
+ifndef localtime-file
+localtime-file = $(sysconfdir)/localtime
+inst_localtime-file = $(install_root)$(localtime-file)
+endif
+
+# What to use for leap second specifications in compiling the default
+# timezone files.  Set this to `/dev/null' for no leap second handling as
+# 1003.1 requires, or to `leapseconds' for proper leap second handling.
+# Both zone flavors are always available as `posix/ZONE' and `right/ZONE'.
+# This variable determines the default: if it's `/dev/null',
+# ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE.
+ifndef leapseconds
+leapseconds = /dev/null
+endif
+
+# What timezone's DST rules should be used when a POSIX-style TZ
+# environment variable doesn't specify any rules.  For 1003.1 compliance
+# this timezone must use rules that are as U.S. federal law defines DST.
+# Run `make -C time echo-zonenames' to see a list of available zone names.
+# This setting can be changed with `zic -p TIMEZONE' at any time.
+# If you want POSIX.1 compatibility, use `America/New_York'.
+ifndef posixrules
+posixrules = America/New_York
+endif
+
+# Where to install the "posixrules" timezone file; this is file
+# whose contents $(posixrules) specifies.  If this is a relative
+# pathname, it is relative to $(zonedir).
+ifndef posixrules-file
+posixrules-file = posixrules
+endif
+
+
+# Directory where your system's native header files live.
+# This is used on Unix systems to generate some GNU libc header files.
+ifndef sysincludedir
+sysincludedir = /usr/include
+endif
+
+
+# Commands to install files.
+ifndef INSTALL_DATA
+INSTALL_DATA = $(INSTALL) -m 644
+endif
+ifndef INSTALL_SCRIPT
+INSTALL_SCRIPT = $(INSTALL)
+endif
+ifndef INSTALL_PROGRAM
+INSTALL_PROGRAM = $(INSTALL)
+endif
+ifndef INSTALL
+INSTALL = install
+endif
+
+
+# The name of the C compiler.
+# If you've got GCC, and it works, use it.
+ifeq ($(origin CC),default)
+CC := gcc
+endif
+
+# The name of the C compiler to use for compilations of programs to run on
+# the host that is building the library.  If you set CC to a
+# cross-compiler, you must set this to the normal compiler.
+ifndef BUILD_CC
+BUILD_CC = $(CC)
+endif
+
+# Default flags to pass the C compiler.
+ifndef default_cflags
+ifeq ($(release),stable)
+default_cflags := -g -O2
+else
+default_cflags := -g -O
+endif
+endif
+
+# Flags to pass the C compiler when assembling preprocessed assembly code
+# (`.S' files).  On some systems the assembler doesn't understand the `#' line
+# directives the preprocessor produces.  If you have troubling compiling
+# assembly code, try using -P here to suppress these directives.
+ifndef asm-CPPFLAGS
+asm-CPPFLAGS =
+endif
+
+# ELF always supports init/fini sections
+ifeq ($(elf),yes)
+have-initfini = yes
+endif
+
+# Installed name of the startup code.
+ifneq ($(have-initfini),yes)
+# When not having init/fini, there is just one startfile, called crt0.o.
+start-installed-name = crt0.o
+else
+# On systems having init/fini, crt0.o is called crt1.o, and there are
+# some additional bizarre files.
+start-installed-name = crt1.o
+endif
+# On systems that do not need a special startfile for statically linked
+# binaries, simply set it to the normal name.
+ifndef static-start-installed-name
+static-start-installed-name = $(start-installed-name)
+endif
+
+ifeq (yesyesyes,$(build-shared)$(elf)$(have-z-combreloc))
+combreloc-LDFLAGS = -Wl,-z,combreloc
+LDFLAGS.so += $(combreloc-LDFLAGS)
+LDFLAGS-rtld += $(combreloc-LDFLAGS)
+endif
+
+relro-LDFLAGS = -Wl,-z,relro
+LDFLAGS.so += $(relro-LDFLAGS)
+LDFLAGS-rtld += $(relro-LDFLAGS)
+
+ifeq (yes,$(have-hash-style))
+# For the time being we unconditionally use 'both'.  At some time we
+# should declare statically linked code as 'out of luck' and compile
+# with --hash-style=gnu only.
+hashstyle-LDFLAGS = -Wl,--hash-style=both
+LDFLAGS.so += $(hashstyle-LDFLAGS)
+LDFLAGS-rtld += $(hashstyle-LDFLAGS)
+endif
+
+# Command for linking programs with the C library.
+ifndef +link
++link = $(CC) -nostdlib -nostartfiles -o $@ \
+	      $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+	      $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
+	      $(addprefix $(csu-objpfx),$(start-installed-name)) \
+	      $(+preinit) $(+prector) \
+	      $(filter-out $(addprefix $(csu-objpfx),start.o \
+						     $(start-installed-name))\
+			   $(+preinit) $(link-extra-libs) \
+			   $(common-objpfx)libc% $(+postinit),$^) \
+	      $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
+endif
+# Command for statically linking programs with the C library.
+ifndef +link-static
++link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
+	      $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F))  \
+	      $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
+	      $(+preinit) $(+prector) \
+	      $(filter-out $(addprefix $(csu-objpfx),start.o \
+						     $(start-installed-name))\
+			   $(+preinit) $(link-extra-libs-static) \
+			   $(common-objpfx)libc% $(+postinit),$^) \
+	      $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit)
+endif
+# Command for statically linking bounded-pointer programs with the C library.
+ifndef +link-bounded
++link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \
+	      $(sysdep-LDFLAGS) $(LDFLAGS)  \
+	      $(addprefix $(csu-objpfx),b$(static-start-installed-name)) \
+	      $(+preinit) $(+prector) \
+	      $(filter-out $(addprefix $(csu-objpfx),start.ob \
+						     $(start-installed-name))\
+			   $(+preinit) $(link-extra-libs-bounded) \
+			   $(common-objpfx)libc% $(+postinit),$^) \
+	      $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
+endif
+ifndef config-LDFLAGS
+ifeq (yesyes,$(build-shared)$(elf))
+config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
+endif
+endif
+ifndef link-libc
+ifeq (yes,$(build-shared))
+ifeq ($(elf),yes)
+# We need the versioned name of libc.so in the deps of $(others) et al
+# so that the symlink to libc.so is created before anything tries to
+# run the linked programs.
+link-libc = -Wl,-rpath-link=$(rpath-link) \
+	    $(common-objpfx)libc.so$(libc.so-version) \
+	    $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib)
+# This is how to find at build-time things that will be installed there.
+rpath-dirs = math elf dlfcn nss nis rt resolv crypt
+endif
+rpath-link = \
+$(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
+elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
+else
+nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
+resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
+link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
+endif
+endif
+
+# Differences in the linkers on the various platforms.
+ifeq ($(elf),yes)
+LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-soname-fname = -Wl,-soname,$(@F)
+LDFLAGS-rdynamic = -rdynamic
+LDFLAGS-Bsymbolic = -Bsymbolic
+endif
+
+# Choose the default search path for the dynamic linker based on
+# where we will install libraries.
+ifneq ($(libdir),$(slibdir))
+default-rpath = $(slibdir):$(libdir)
+else
+default-rpath = $(libdir)
+endif
+
+ifndef link-extra-libs
+link-extra-libs = $(LDLIBS-$(@F))
+link-extra-libs-static = $(link-extra-libs)
+link-extra-libs-bounded = $(link-extra-libs)
+endif
+
+# The static libraries.
+ifeq (yes,$(build-static))
+link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
+else
+ifeq (yes,$(build-shared))
+# We can try to link the programs with lib*_pic.a...
+link-libc-static = $(static-gnulib) $(common-objpfx)libc_pic.a
+endif
+endif
+link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a
+
+ifndef gnulib
+ifneq ($(have-cc-with-libunwind),yes)
+  libunwind =
+else
+  libunwind = -lunwind
+endif
+ifneq ($(have-as-needed),yes)
+ libgcc_eh := -lgcc_eh $(libunwind)
+else
+ libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed
+endif
+gnulib := -lgcc $(libgcc_eh)
+static-gnulib := -lgcc -lgcc_eh $(libunwind)
+libc.so-gnulib := -lgcc
+endif
+ifeq ($(elf),yes)
++preinit = $(addprefix $(csu-objpfx),crti.o)
++postinit = $(addprefix $(csu-objpfx),crtn.o)
++prector = `$(CC) --print-file-name=crtbegin.o`
++postctor = `$(CC) --print-file-name=crtend.o`
++interp = $(addprefix $(elf-objpfx),interp.os)
+endif
+csu-objpfx = $(common-objpfx)csu/
+elf-objpfx = $(common-objpfx)elf/
+
+# How to run a program we just linked with our library.
+# The program binary is assumed to be $(word 2,$^).
+built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
+ifeq (yesyes,$(build-shared)$(elf))
+comma = ,
+sysdep-library-path = \
+$(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
+				       $(filter -Wl$(comma)-rpath-link=%,\
+						$(sysdep-LDFLAGS)))))
+run-program-prefix = $(if $(filter $(notdir $(built-program-file)),\
+				   $(tests-static) $(xtests-static)),, \
+			  $(elf-objpfx)$(rtld-installed-name) \
+			  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)))
+else
+run-program-prefix =
+endif
+# Never use $(run-program-prefix) for the statically-linked %-bp test programs
+built-program-cmd = $(patsubst %,$(run-program-prefix),\
+			$(filter-out %-bp,$(built-program-file))) \
+		    $(built-program-file)
+
+ifndef LD
+LD := ld -X
+endif
+
+ifndef	RANLIB
+RANLIB = ranlib
+endif
+
+# Extra flags to pass to GCC.
+ifeq ($(all-warnings),yes)
++gccwarn := -Wall -Wwrite-strings -Winline -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
+else
++gccwarn := -Wall -Wwrite-strings -Winline
+endif
++gccwarn-c = -Wstrict-prototypes
+
+# We do not depend on the address of constants in different files to be
+# actually different, so allow the compiler to merge them all.
++merge-constants = -fmerge-all-constants
+
+# This is the program that generates makefile dependencies from C source files.
+# The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy
+# targets for headers so that removed headers don't break the build.
+ifndef +mkdep
++mkdep = $(CC) -M -MP
+endif
+
+# The program that makes Emacs-style TAGS files.
+ETAGS	:= etags
+
+# The `xgettext' program for producing .pot files from sources.
+ifndef XGETTEXT
+XGETTEXT = xgettext
+endif
+
+# The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
+# perhaps others) to preprocess assembly code in some cases.
+M4 = m4
+
+# To force installation of files even if they are older than the
+# installed files.  This variable is included in the dependency list
+# of all installation targets.
+ifeq ($(force-install),yes)
++force = force-install
+else
++force =
+endif
+
+####
+#### End of configuration variables.
+####
+
+# This tells some versions of GNU make before 3.63 not to export all variables.
+.NOEXPORT:
+
+# We want to echo the commands we're running without
+# umpteen zillion filenames along with it (we use `...' instead)
+# but we don't want this echoing done when the user has said
+# he doesn't want to see commands echoed by using -s.
+ifneq	"$(findstring s,$(MAKEFLAGS))" ""	# if -s
++cmdecho	:= echo >/dev/null
+else						# not -s
++cmdecho	:= echo
+endif	   					# -s
+
+# These are the flags given to the compiler to tell
+# it what sort of optimization and/or debugging output to do.
+ifndef	+cflags
+# If `CFLAGS' was defined, use that.
+ifdef		CFLAGS
++cflags	:= $(filter-out -I%,$(CFLAGS))
+endif		# CFLAGS
+endif	# +cflags
+
+# If none of the above worked, default to "-g -O".
+ifeq	"$(strip $(+cflags))" ""
++cflags	:= $(default_cflags)
+endif	# $(+cflags) == ""
+
++cflags += $(addprefix -mcpu=,$(with-cpu)) $(+gccwarn) $(+merge-constants)
++gcc-nowarn := -w
+
+# Don't duplicate options if we inherited variables from the parent.
++cflags	:= $(sort $(+cflags))
+
+
+# These are flags given to the C compiler to tell it to look for
+# include files (including ones given in angle brackets) in the parent
+# library source directory, in the include directory, and in the
+# current directory.
++sysdep-includes = $(addprefix -I,$(+sysdep_dirs))
++includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
+	    $(+sysdep-includes) $(includes) \
+	    $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
+
+# Since libio has several internal header files, we use a -I instead
+# of many little headers in the include directory.
+libio-include = -I$(..)libio
+
+# These are the variables that the implicit compilation rules use.
+# Note that we can't use -std=* in CPPFLAGS, because it overrides
+# the implicit -lang-asm and breaks cpp behavior for .S files--notably
+# it causes cpp to stop predefining __ASSEMBLER__.
+CPPFLAGS = $($(subdir)-CPPFLAGS) $(+includes) $(defines) \
+	   -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
+	   $(CPPFLAGS-$(suffix $@)) \
+	   $(foreach lib,$(libof-$(basename $(@F))) \
+		         $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
+	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
+override CFLAGS	= -std=gnu99 $(gnu89-inline-CFLAGS) \
+		  $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
+		  $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
+		  $(CFLAGS-$(@F))
+override CXXFLAGS = $(c++-sysincludes) \
+		    $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
+		    $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
+
+# If everything is compiled with -fPIC (implicitly) we must tell this by
+# defining the PIC symbol.
+ifeq (yes,$(build-pic-default))
+pic-default = -DPIC
+endif
+
+# Enable object files for different versions of the library.
+# Various things use $(object-suffixes) to know what all to make.
+# The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
+# to pass different flags for each flavor.
+libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
+all-object-suffixes := .o .os .op .og .ob .oS
+object-suffixes :=
+CPPFLAGS-.o = $(pic-default)
+CFLAGS-.o = $(filter %frame-pointer,$(+cflags))
+ifeq (yes,$(build-static))
+libtype.o := lib%.a
+object-suffixes += .o
+endif
+ifeq (yes,$(build-shared))
+# Under --enable-shared, we will build a shared library of PIC objects.
+# The PIC object files are named foo.os.
+object-suffixes += .os
+CPPFLAGS-.os = -DPIC -DSHARED
+CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
+libtype.os := lib%_pic.a
+# This can be changed by a sysdep makefile
+pic-ccflag = -fPIC
+# This one should always stay like this unless there is a very good reason.
+PIC-ccflag = -fPIC
+endif
+ifeq (yes,$(build-profile))
+# Under --enable-profile, we will build a static library of profiled objects.
+# The profiled object files are named foo.op.
+object-suffixes += .op
+CPPFLAGS-.op = -DPROF $(pic-default)
+CFLAGS-.op = -pg
+libtype.op = lib%_p.a
+endif
+ifeq (yes,$(build-omitfp))
+# Under --enable-omitfp, we build the library optimized without
+# debugging information using -fomit-frame-pointer, and build an extra
+# library with debugging information.  The debuggable objects are named foo.og.
+object-suffixes += .og
+CPPFLAGS-.og = $(pic-default)
+CFLAGS-.og = -g
+CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES
+CFLAGS-.os += -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES
+libtype.og = lib%_g.a
+endif
+
+bppfx = BP-
+ifeq (yes,$(build-bounded))
+# Under --enable-bounded, we build the library with `-fbounded-pointers -g'
+# to runtime bounds checking.  The bounded-pointer objects are named foo.ob.
+# We disable sibling-call optimizations so that stack traces will be complete
+# and thus aid debugging, since after all, BPs are a debugging tool.
+object-suffixes += .ob
+CPPFLAGS-.ob = -fbounded-pointers $(pic-default)
+CFLAGS-.ob = -g -O2 -fno-optimize-sibling-calls -fno-strict-aliasing
+libtype.ob = lib%_b.a
+endif
+
+object-suffixes-for-libc := $(object-suffixes)
+
+ifeq (yes,$(build-shared))
+# Build special library that contains the static-only routines for libc.
+object-suffixes-for-libc += .oS
+
+# Must build the routines as PIC, though, because they can end up in (users')
+# shared objects.  We don't want to use CFLAGS-os because users may, for
+# example, make that processor-specific.
+CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag)
+CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1
+libtype.oS = lib%_nonshared.a
+endif
+
+# The assembler can generate debug information too.
+ifndef ASFLAGS
+ifeq ($(have-cpp-asm-debuginfo),yes)
+ASFLAGS := $(filter -g%,$(CFLAGS))
+else
+ASFLAGS :=
+endif
+endif
+ASFLAGS += $(ASFLAGS-config)
+
+ifndef BUILD_CC
+BUILD_CC = $(CC)
+endif
+
+move-if-change = $(SHELL) $(..)scripts/move-if-change
+
+-include $(common-objpfx)sysd-sorted
+subdirs = $(sorted-subdirs)
+subdir-srcdirs = $(foreach dir,$(subdirs),\
+			   $(firstword $($(dir)-srcdir) $(..)$(dir)))
+
+ifeq (yes, $(build-shared))
+
+# This is a pair of implicit rules to preprocess a file with # comments,
+# %ifdef et al, based on config.h settings or other %include'd files.
+# We use chained rules instead of a pipeline here so that we can properly
+# check the exit status of cpp rather than using its bad output when there
+# is a preprocessing error.  Another rule should depend on the output file
+# `FOO.v', and along with that `FOO.v.i' should be given dependencies
+# listing both its input files, and any header files that it may reference
+# (but no commands).
+%.v.i: $(common-objpfx)config.h
+	sed '/^[ 	]*#/d;s/^[ 	]*%/#/' $(filter-out FORCE %.h,$^) \
+	| $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - \
+		   > $@T
+	mv -f $@T $@
+%.v: %.v.i
+	sed '/^[ 	]*#/d;/^[ 	]*$$/d' $< > $@T
+	mv -f $@T $@
+
+# Process the shlib-versions file, which tells us what shared library
+# version numbers to use when we install shared objects on this system.
+# We need to wait until $(subdirs) is complete.
+ifeq ($(sysd-sorted-done),t)
+-include $(common-objpfx)soversions.mk
+ifndef avoid-generated
+# This lets add-ons give more-specific matches that override defaults
+# in the top-level file.
+$(common-objpfx)shlib-versions.v.i: \
+	$(wildcard $(+sysdep_dirs:=/shlib-versions) \
+		   $(subdir-srcdirs:=/shlib-versions)) \
+	$(..)shlib-versions
+
+soversions-default-setname = $(patsubst %, %,\
+					$(filter-out %_default,\
+						     $(oldest-abi:%=GLIBC_%)))
+$(common-objpfx)soversions.i: $(..)scripts/soversions.awk \
+			      $(common-objpfx)shlib-versions.v
+	$(AWK) -v default_setname='$(soversions-default-setname)' \
+	       -v cpu='$(config-machine)' \
+	       -v vendor='$(config-vendor)' \
+	       -v os='$(config-os)' \
+	       -f $^ > $@T
+	mv -f $@T $@
+$(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig
+	(seen_DEFAULT=0; seen_WORDSIZE32=0; seen_WORDSIZE64=0; \
+	 while read which lib number setname; do \
+	   eval seen_$$which=1; \
+	   test x"$$which" = xDEFAULT || continue; \
+	   case $$number in \
+	     [0-9]*) echo "$$lib.so-version=.$$number"; \
+		     echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\
+	     *)	     echo "$$lib.so-version=$$number"; \
+		     echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\
+	   esac; \
+	 done; \
+	 case "$$seen_DEFAULT$$seen_WORDSIZE32$$seen_WORDSIZE64" in \
+	   100) echo biarch = no;; \
+	   101) echo biarch = 32;; \
+	   ?1?) echo biarch = 64;; \
+	   *) echo >&2 BUG; exit 2;; \
+	 esac; \
+	 echo soversions.mk-done = t;) < $< > $@T; exit 0
+	mv -f $@T $@
+endif
+endif
+
+postclean-generated += soversions.mk soversions.i \
+		       shlib-versions.v shlib-versions.v.i
+
+# Generate the header containing the names of all shared libraries.
+# We use a stamp file to avoid unnecessary recompilations.
+before-compile += $(common-objpfx)gnu/lib-names.h
+ifeq ($(soversions.mk-done),t)
+$(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @:
+$(common-objpfx)gnu/lib-names.stmp: $(..)scripts/lib-names.awk \
+				    $(common-objpfx)soversions.i
+	$(make-target-directory)
+	@rm -f ${@:stmp=T} $@
+	LC_ALL=C $(AWK) -f $^ > ${@:stmp=T}
+	$(move-if-change) ${@:stmp=T} ${@:stmp=h}
+	touch $@
+endif
+
+common-generated += gnu/lib-names.h gnu/lib-names.stmp
+
+# The name under which the run-time dynamic linker is installed.
+# We are currently going for the convention that `/lib/ld.so.1'
+# names the SVR4/ELF ABI-compliant dynamic linker.
+ifndef rtld-installed-name
+ifdef ld.so-version
+rtld-installed-name = $(ld.so-version)
+else
+rtld-installed-name = ld.so.1
+endif
+endif
+
+ifndef rtld-version-installed-name
+rtld-version-installed-name = ld-$(version).so
+endif
+
+endif # build-shared
+
+
+ifeq ($(elf),yes)
+dlfcn = dlfcn
+ifeq ($(build-shared),yes)
+libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
+else
+libdl = $(common-objpfx)dlfcn/libdl.a
+endif
+else
+ifneq (,$(findstring aix,$(config-os)))
+ifeq ($(build-shared),yes)
+dlfcn = dlfcn
+libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
+else
+# No libdl without shared libs on AIX
+dlfcn =
+libdl =
+endif
+else
+# No ELF, no AIX - no libdl, at least for now.
+dlfcn =
+libdl =
+endif
+endif
+
+# These are the subdirectories containing the library source.  The order
+# is more or less arbitrary.  The sorting step will take care of the
+# dependencies.
+all-subdirs = csu assert ctype locale intl catgets math setjmp signal	    \
+	      stdlib stdio-common libio malloc string wcsmbs time dirent    \
+	      grp pwd posix io termios resource misc socket sysvipc gmon    \
+	      gnulib iconv iconvdata wctype manual shadow po argp	    \
+	      crypt nss localedata timezone rt conform debug		    \
+	      $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
+
+ifndef avoid-generated
+all-Depend-files := $(wildcard $(foreach dir,$(all-subdirs),\
+					 $(firstword $($(dir)-srcdir) \
+						     $(..)$(dir))/Depend))
+$(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \
+			     $(common-objpfx)config.make $(..)Makeconfig \
+			     $(wildcard $(sysdirs:=/Subdirs)) \
+			     $(all-Depend-files)
+	$(AWK) -f $< \
+	       -v subdirs='$(all-subdirs)' \
+	       -v srcpfx='$(..)' \
+	       $(filter %/Subdirs %/Depend,$^) > $@-tmp
+	mv -f $@-tmp $@
+$(all-Depend-files): ;
+endif
+
+# This gives partial TARGET:SOURCE pattern pairs to have rules
+# emitted into sysd-rules.  A sysdeps Makeconfig fragment can
+# add its own special object file prefix to this list with e.g. foo-%:%
+# to have foo-*.? compiled from *.? using $(foo-CPPFLAGS).
+sysd-rules-patterns := %:% rtld-%:% m_%:s_%
+
+# Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
+sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig))
+ifneq (,$(sysdep-makeconfigs))
+include $(sysdep-makeconfigs)
+endif
+
+# Compute just the target patterns.  Makeconfig has set sysd-rules-patterns.
+sysd-rules-targets := $(foreach p,$(sysd-rules-patterns),\
+		      		$(firstword $(subst :, ,$p)))
+
+endif # Makeconfig not yet included
+
+# Local Variables:
+# mode: makefile
+# End:
diff -Naur glibc-2.8.orig/Makerules glibc-2.8/Makerules
--- glibc-2.8.orig/Makerules	2008-11-24 14:14:24.000000000 -0500
+++ glibc-2.8/Makerules	2008-11-24 14:14:26.000000000 -0500
@@ -403,7 +403,7 @@
 # Bounded pointer thunks are only built for *.ob
 elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks))
 
-elide-routines.oS += $(filter-out $(static-only-routines),\
+elide-routines.oST += $(filter-out $(static-only-routines),\
 				  $(routines) $(aux) $(sysdep_routines)) \
 		     $(elide-bp-thunks)
 elide-routines.os += $(static-only-routines) $(elide-bp-thunks)
@@ -970,7 +970,7 @@
 install: $(inst_libdir)/libc.so
 $(inst_libdir)/libc.so: $(common-objpfx)format.lds \
 			$(common-objpfx)libc.so$(libc.so-version) \
-			$(inst_libdir)/$(patsubst %,$(libtype.oS),\
+			$(inst_libdir)/$(patsubst %,$(libtype.oST),\
 						  $(libprefix)$(libc-name)) \
 			$(+force)
 	(echo '/* GNU ld script';\
@@ -978,7 +978,7 @@
 	 echo '   the static library, so try that secondarily.  */';\
 	 cat $<; \
 	 echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
-	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
+	      '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\
 	      ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \
 	) > $@.new
 	mv -f $@.new $@
diff -Naur glibc-2.8.orig/Makerules.orig glibc-2.8/Makerules.orig
--- glibc-2.8.orig/Makerules.orig	1969-12-31 19:00:00.000000000 -0500
+++ glibc-2.8/Makerules.orig	2008-09-03 10:51:30.000000000 -0400
@@ -0,0 +1,1421 @@
+# Copyright (C) 1991-2006, 2007, 2008 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
+# 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.
+
+# 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
+# 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.
+
+#
+#	Common rules for making the GNU C library.  This file is included
+#	by the top-level Makefile and by all subdirectory makefiles
+#	(through Rules).
+#
+ifneq (,)
+This makefile requires GNU Make.
+endif
+
+REQUIRED_MAKE_VERSION = 3.74
+REAL_MAKE_VERSION = $(firstword $(MAKE_VERSION))
+
+ifneq ($(REQUIRED_MAKE_VERSION), \
+       $(firstword $(sort $(REAL_MAKE_VERSION) $(REQUIRED_MAKE_VERSION))))
+Wrong GNU Make version.  See above for the version needed.
+endif
+
+
+ifdef	subdir
+..	:= ../
+endif	# subdir
+
+# If `sources' was defined by the parent makefile, undefine it so
+# we will later get it from wildcard search in this directory.
+ifneq	"$(findstring env,$(origin sources))" ""
+sources :=
+endif
+
+oPATH := $(PATH)
+PATH := this definition should take precedence over $(oPATH)
+ifeq ($(PATH),$(oPATH))
+You must not use the -e flag when building the GNU C library.
+else
+PATH := $(oPATH)
+endif
+
+ifndef +included-Makeconfig
+include $(..)Makeconfig
+endif
+
+# This variable is used in ``include $(o-iterator)'' after defining
+# $(o-iterator-doit) to produce some desired rule using $o for the object
+# suffix, and setting $(object-suffixes-left) to $(object-suffixes); a copy
+# is produced for each object suffix in use.
+o-iterator = $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left))
+
+# Include any system-specific makefiles.
+
+# This is here so things in sysdep Makefiles can easily depend on foo.h as
+# appropriate and not worry about where foo.h comes from, which may be
+# system dependent and not known by that Makefile.
+vpath %.h $(subst $(empty) ,:,$(strip $(common-objpfx) $(objpfx) \
+				      $(+sysdep_dirs) $(..)))
+
+# The same is true for RPC source files.
+vpath %.x $(subst $(empty) ,:,$(strip $(common-objpfx) $(objpfx) \
+				      $(+sysdep_dirs) $(..)))
+
+# Some sysdep makefiles use this to distinguish being included here from
+# being included individually by a subdir makefile (hurd/Makefile needs this).
+in-Makerules := yes
+
+sysdep-makefiles := $(wildcard $(sysdirs:=/Makefile))
+ifneq (,$(sysdep-makefiles))
+include $(sysdep-makefiles)
+endif
+
+
+# Reorder before-compile so that mach things come first, and hurd things
+# second, before all else.  The mach and hurd subdirectories have many
+# generated header files which the much of rest of the library depends on,
+# so it is best to build them first (and mach before hurd, at that).
+before-compile := $(filter $(common-objpfx)mach% $(common-objpfx)hurd%,\
+			   $(before-compile)) \
+		  $(filter-out $(common-objpfx)mach% $(common-objpfx)hurd%,\
+			       $(before-compile))
+
+# Even before that, we need abi-versions.h which is generated right here.
+ifeq ($(versioning),yes)
+ifndef avoid-generated
+before-compile := $(common-objpfx)abi-versions.h $(before-compile)
+$(common-objpfx)abi-versions.h: $(..)scripts/abi-versions.awk \
+				$(common-objpfx)Versions.all
+	LC_ALL=C $(AWK) -v oldest_abi=$(oldest-abi) -f $^ > $@T
+	mv -f $@T $@
+
+$(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 $@
+endif # avoid-generated
+endif # $(versioning) = yes
+
+# Make sure the subdirectory for object files gets created.
+ifdef objpfx
+ifeq (,$(wildcard $(objpfx).))
+before-compile += $(objpfx).
+$(objpfx).:
+	$(make-target-directory)
+endif
+endif
+
+# Remove existing files from `before-compile'.  Things are added there when
+# they must exist for dependency generation to work right, but once they
+# exist there is no further need for every single file to depend on them,
+# and those gratuitous dependencies result in many gratuitous
+# recompilations.
+before-compile := $(filter-out $(wildcard $(before-compile)),$(before-compile))
+
+# Don't let any before-compile file be an intermediate and get removed.
+ifdef before-compile
+$(before-compile):
+endif
+
+# We don't want $(common-objpfx) files to depend on miscellaneous stuff
+# in subdirs.
+ifdef subdir
+common-before-compile := $(filter-out $(objpfx)%,$(before-compile))
+else
+common-before-compile = $(before-compile)
+endif
+
+ifndef subdir
+# If a makefile needs to do something conditional on something that
+# can only be figured out from headers, write a FOO.make.c input
+# file that uses cpp contructs and contains @@@ LINE @@@ for each LINE
+# to emit in the generated makefile, and use -include $(common-objpfx)FOO.make.
+#
+# We only generate these in the top-level makefile, to avoid any weirdness
+# from subdir-specific makefile tweaks creeping in on an update.
+$(common-objpfx)%.make: $(..)%.make.c $(..)Makerules $(common-before-compile)
+	rm -f $@T $@.dT
+	(echo '# Generated from $*.make.c by Makerules.'; \
+	 $(CC) $(CFLAGS) $(CPPFLAGS) -E -DASSEMBLER $< \
+	       -MD -MP -MT '$$(common-objpfx)$*.make' -MF $@.dT \
+	 | sed -n '/@@@/{s/@@@[	 ]*\(.*\)@@@/\1/;s/[	 ]*$$//p;}'; \
+	 echo 'common-generated += $(@F)'; \
+	 sed $(sed-remove-objpfx) $(sed-remove-dotdot) $@.dT; \
+	 rm -f $@.dT) > $@T
+	mv -f $@T $@
+endif
+
+ifdef subdir
+sed-remove-dotdot := -e 's@  *\.\.\/\([^ 	\]*\)@ $$(..)\1@g' \
+		     -e 's@^\.\.\/\([^ 	\]*\)@$$(..)\1@g'
+else
+sed-remove-dotdot := -e 's@  *\([^ 	\/$$][^ 	\]*\)@ $$(..)\1@g' \
+		     -e 's@^\([^ 	\/$$][^ 	\]*\)@$$(..)\1@g'
+endif
+
+
+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 \
+					   %.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
+	sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
+	    $(@:.h=.h.d)T > $(@:.h=.h.d)T2
+	rm -f $(@:.h=.h.d)T
+	mv -f $(@:.h=.h.d)T2 $(@:.h=.h.d)
+	mv -f $(@:.h.d=.h)T $(@:.h.d=.h)
+vpath %.sym $(sysdirs)
+before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
+
+tests += $(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 \
+			    %.sym $(common-objpfx)%.h
+	($(AWK) '{ sub(/^/, "asconst_", $$2); print; }' $(filter %.h,$^); \
+	 $(AWK) -v test=1 -f $< $(filter %.sym,$^); \
+	 echo '#include "$(..)test-skeleton.c"') > $@T
+	mv -f $@T $@
+endif
+
+# Generate an ordered list of implicit rules which find the source files in
+# each sysdep directory.  The old method was to use vpath to search all the
+# sysdep directories.  However, that had the problem that a .S file in a
+# later directory would be chosen over a .c file in an earlier directory,
+# which does not preserve the desired sysdeps ordering behavior.
+
+# System-dependent makefiles can put in `inhibit-sysdep-asm' wildcard
+# patterns matching sysdep directories whose assembly source files should
+# be suppressed.
+ifdef inhibit-sysdep-asm
+define check-inhibit-asm
+case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) asm= ;; esac;
+endef
+endif
+
+-include $(common-objpfx)sysd-rules
+ifneq ($(sysd-rules-sysdirs),$(config-sysdirs))
+# The value of $(+sysdep_dirs) the sysd-rules was computed for
+# differs from the one we are using now.  So force a rebuild of sysd-rules.
+sysd-rules-force = FORCE
+FORCE:
+endif
+$(common-objpfx)sysd-rules: $(common-objpfx)config.make $(..)Makerules \
+			    $(sysdep-makefiles) $(sysdep-makeconfigs) \
+			    $(sysd-rules-force)
+	-@rm -f $@T
+	(echo 'sysd-rules-sysdirs := $(config-sysdirs)';		      \
+	 for dir in $(config-sysdirs); do				      \
+	   case "$$dir" in						      \
+	   /*) ;;							      \
+	   *) dir="\$$(..)$$dir" ;;					      \
+	   esac;							      \
+	   asm='.S .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 $@
+
+ifndef sysd-rules-done
+# Don't do deps until this exists, because it provides rules to make the deps.
+no_deps=t
+endif
+
+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: %.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)
+include $(o-iterator)
+
+define o-iterator-doit
+$(objpfx)%$o: %.cc $(before-compile); $$(compile-command.cc)
+endef
+object-suffixes-left := $(all-object-suffixes)
+include $(o-iterator)
+
+# Omit the objpfx rules when building in the source tree, because
+# objpfx is empty and so these rules just override the ones above.
+ifdef objpfx
+# Define first rules to find the source files in $(objpfx).
+# Generated source files will end up there.
+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)%.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)
+include $(o-iterator)
+endif
+
+# Generate version maps, but wait until sysdep-subdirs is known
+ifeq ($(sysd-sorted-done),t)
+ifeq ($(versioning),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.v.i Versions.def.v Versions.v.i Versions.v
+
+ifndef avoid-generated
+ifneq ($(sysd-versions-subdirs),$(sorted-subdirs) $(config-sysdirs))
+sysd-versions-force = FORCE
+FORCE:
+endif
+# See %.v/%.v.i implicit rules in Makeconfig.
+$(common-objpfx)Versions.def.v.i: $(..)Versions.def \
+				  $(wildcard $(add-ons:%=$(..)%/Versions.def))
+$(common-objpfx)Versions.all: $(..)scripts/firstversions.awk \
+			      $(common-objpfx)soversions.i \
+			      $(common-objpfx)Versions.def.v
+	{ 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)) \
+			      $(common-objpfx)abi-versions.h \
+			      $(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 # $(versioning) = 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)
+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)
+
+# 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.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 $@
+
+# 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.
+S-CPPFLAGS = -DASSEMBLER $(asm-CPPFLAGS)
+
+define +make-deps
+$(make-target-directory)
+$(+mkdep) $< $(if $(filter %.c,$<),$(CFLAGS)) \
+	     $(CPPFLAGS) $($(patsubst .%,%,$(suffix $(<F)))-CPPFLAGS) | sed -e\
+'s,$(subst .,\.,$(@F:.d=.o)),$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \
+$(sed-remove-objpfx) $(sed-remove-dotdot) > $(@:.d=.T)
+mv -f $(@:.d=.T) $@ $(generate-md5)
+endef
+
+ifneq (,$(objpfx))
+# Continuation lines here are dangerous because they introduce spaces!
+define sed-remove-objpfx
+-e 's@ $(subst .,\.,$(subst @,\@,$(common-objpfx)))@ $$(common-objpfx)@g' \
+-e 's@^$(subst .,\.,$(subst @,\@,$(common-objpfx)))@$$(common-objpfx)@g'
+endef
+endif
+
+# Modify the list of routines we build for different targets
+
+ifeq (yesyes,$(build-shared)$(elf))
+ifndef libc.so-version
+# Undefine this because it can't work when we libc.so is unversioned.
+static-only-routines =
+endif
+endif
+
+# Bounded pointer thunks are only built for *.ob
+elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks))
+
+elide-routines.oS += $(filter-out $(static-only-routines),\
+				  $(routines) $(aux) $(sysdep_routines)) \
+		     $(elide-bp-thunks)
+elide-routines.os += $(static-only-routines) $(elide-bp-thunks)
+
+# If we have versioned code we don't need the old versions in any of the
+# static libraries.
+elide-routines.o  += $(shared-only-routines) $(elide-bp-thunks)
+elide-routines.op += $(shared-only-routines) $(elide-bp-thunks)
+elide-routines.og += $(shared-only-routines) $(elide-bp-thunks)
+elide-routines.ob += $(shared-only-routines)
+
+# Shared library building.
+
+ifeq (yes,$(build-shared))
+
+# Reference map file only when versioning is selected and a map file name
+# is given.
+ifeq ($(versioning),yes)
+map-file = $(firstword $($(@F:.so=-map)) \
+		       $(addprefix $(common-objpfx), \
+				   $(filter $(@F:.so=.map),$(version-maps))))
+load-map-file = $(map-file:%=-Wl,--version-script=%)
+endif
+
+# Pattern rule to build a shared object from an archive of PIC objects.
+# This must come after the installation rules so Make doesn't try to
+# build shared libraries in place from the installed *_pic.a files.
+# $(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) \
+	  $(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) \
+	  -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))
+# binutils only position loadable notes into the first page for binaries,
+# not for shared objects
+$(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
+	$(LINK.o) -shared -Wl,-O1 \
+		  -nostdlib -nostartfiles \
+		  $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
+		  -Wl,--verbose 2>&1 | \
+	  sed > $@T \
+	      -e '/^=========/,/^=========/!d;/^=========/d' \
+	      $(if $(filter yes,$(have-hash-style)), \
+		   -e 's/^.*\.gnu\.hash[ 	]*:.*$$/  .note.ABI-tag : { *(.note.ABI-tag) } &/' \
+		   -e '/^[ 	]*\.hash[ 	]*:.*$$/{h;d;}' \
+		   -e '/DATA_SEGMENT_ALIGN/{H;g}' \
+		, \
+		   -e 's/^.*\.hash[ 	]*:.*$$/  .note.ABI-tag : { *(.note.ABI-tag) } &/' \
+	       ) \
+	      -e 's/^.*\*(\.dynbss).*$$/& \
+		 PROVIDE(__start___libc_freeres_ptrs = .); \
+		 *(__libc_freeres_ptrs) \
+		 PROVIDE(__stop___libc_freeres_ptrs = .);/'\
+	      -e 's@^.*\*(\.jcr).*$$@& \
+		 PROVIDE(__start___libc_subfreeres = .);\
+		 __libc_subfreeres : { *(__libc_subfreeres) }\
+		 PROVIDE(__stop___libc_subfreeres = .);\
+		 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 = .);\
+		 /DISCARD/ : { *(.gnu.glibc-stub.*) }@'
+	mv -f $@T $@
+common-generated += shlib.lds
+
+define build-shlib
+$(build-shlib-helper) -o $@ -T $(common-objpfx)shlib.lds \
+	  $(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) \
+	  -B$(csu-objpfx) $(load-map-file) \
+	  $(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 \
+	  $(csu-objpfx)abi-note.o $(build-module-objlist)
+endef
+define build-module-asneeded
+$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \
+	  $(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) \
+		      $(LDLIBS-$(@F:lib%.so=%).so)
+
+# Don't try to use -lc when making libc.so itself.
+# Also omits crti.o and crtn.o, which we do not want
+# since we define our own `.init' section specially.
+LDFLAGS-c.so = -nostdlib -nostartfiles
+# But we still want to link libc.so against $(libc.so-gnulib).
+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
+# 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 $^
+# Use our own special initializer and finalizer files for libc.so.
+$(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
+			 $(common-objpfx)libc_pic.os \
+			 $(elfobjdir)/sofini.os \
+			 $(elfobjdir)/interp.os $(elfobjdir)/ld.so \
+			 $(common-objpfx)shlib.lds
+	$(build-shlib)
+ifeq ($(versioning),yes)
+$(common-objpfx)libc.so: $(common-objpfx)libc.map
+endif
+common-generated += libc.so libc_pic.os
+ifdef libc.so-version
+$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
+	$(make-link)
+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
+
+# Figure out the source filenames in this directory.
+
+override sources := $(addsuffix .c,\
+			$(filter-out $(elided-routines),\
+			    $(routines) $(aux) \
+			    $(sysdep_routines)))
+sysdep_routines := $(sysdep_routines)
+
+headers := $(headers) $(sysdep_headers)
+
+# This is the list of all object files, gotten by
+# replacing every ".c" in `sources' with a ".o".
+# We also add bounded-pointer thunks, which are later
+# elided for all suffixes except for `.ob'.
+override objects := $(addprefix $(objpfx),$(sources:.c=.o) \
+		      $(patsubst %,$(bppfx)%.o,\
+			$(filter $(routines) $(sysdep_routines),$(bp-thunks))))
+
+
+# The makefile may define $(extra-libs) with `libfoo libbar'
+# to build libfoo.a et al from the modules listed in $(libfoo-routines).
+ifdef extra-libs
+# 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-libs-left := $(extra-libs)
+include $(patsubst %,$(..)extra-lib.mk,$(extra-libs))
+endif
+
+
+# The makefile may define $(modules-names) to build additional modules.
+# These are built with $(build-module), except any in $(modules-names-nobuild).
+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))
+
+extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names))
+$(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \
+		$(objpfx)%.os $(common-objpfx)shlib.lds \
+		$(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
+	$(build-module)
+endif
+
++depfiles := $(sources:.c=.d) \
+	     $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
+	     $(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \
+	     $(addsuffix .d,$(tests) $(xtests) $(test-srcs))
+ifeq ($(build-programs),yes)
++depfiles += $(addsuffix .d,$(others) $(sysdep-others))
+endif
++depfiles := $(addprefix $(objpfx),\
+			 $(filter-out $(addsuffix .d,$(omit-deps)),\
+				      $(+depfiles)))
+all-dt-files := $(foreach o,$(object-suffixes-for-libc),$(+depfiles:.d=$o.dt))
++depfiles := $(patsubst %.dt,%.d,$(wildcard $(all-dt-files))) \
+	     $(wildcard $(all-dt-files:.dt=.d))
+
+# This is a funny rule in that it removes its input file.
+%.d: %.dt
+	@sed $(sed-remove-objpfx) $< > $(@:.d=.T) && \
+	 mv -f $(@:.d=.T) $@ && \
+	 rm -f $<
+
+# Avoid the .h.d files for any .sym files whose .h files don't exist yet.
+# They will be generated when they're needed, and trying too early won't work.
++gen-as-const := $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
++depfiles += $(addsuffix .d,$(filter $(wildcard $(+gen-as-const)),\
+						$(+gen-as-const)))
+
+ifdef +depfiles
+ifneq ($(no_deps),t)
+-include $(+depfiles)
+endif
+endif
+
+# Maximize efficiency by minimizing the number of rules.
+.SUFFIXES:	# Clear the suffix list.  We don't use suffix rules.
+# Don't define any builtin rules.
+MAKEFLAGS := $(MAKEFLAGS)r
+
+# Generic rule for making directories.
+%/:
+# mkdir isn't smart enough to strip a trailing /.
+# We always require a mkdir which supports the -p option to avoid error
+# messages in case of races.
+	mkdir -p $(@:%/=%)
+
+# Make sure that object files are not removed
+# when they are intermediates between sources and library members.
+.PRECIOUS: $(addprefix $(objpfx)%,$(all-object-suffixes))
+
+# Make sure that the parent library archive is never removed.
+.PRECIOUS: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
+
+# Use the verbose option of ar and tar when not running silently.
+ifeq	"$(findstring s,$(MAKEFLAGS))" ""	# if not -s
+verbose := v
+else	   					# -s
+verbose	:=
+endif						# not -s
+
+ARFLAGS := r$(verbose)
+CREATE_ARFLAGS := cru$(verbose)
+
+# This makes all the object files in the parent library archive.
+
+.PHONY: lib lib-noranlib
+lib: lib-noranlib $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
+lib-noranlib: libobjs
+
+# For object-suffix $o, the list of objects with that suffix.
+# Makefiles can define `elide-routines.so = foo' to leave foo.so out.
+o-objects = $(patsubst %.o,%$o,$(filter-out $(patsubst %,$(objpfx)%.o,\
+						       $(elide-routines$o)),\
+					    $(objects))) \
+	    $(addprefix $(objpfx),$(o-objects$o))
+
+others: $(addprefix $(objpfx),$(install-lib))
+
+ifndef objects
+
+# Create the stamp$o files to keep the parent makefile happy.
+subdir_lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
+$(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o):
+	$(make-target-directory)
+	rm -f $@; > $@
+else
+
+# Define explicit rules to update each $(objpfx)stamp.SUFFIX
+# timestamp file; these rules (one explicit rule is generated for each
+# object suffix) write a list of objects to update in the stamp file.
+# The parent will then actually add them all to the archive in the
+# archive rule, below.
+define o-iterator-doit
+$(objpfx)stamp$o: $(o-objects); $$(do-stamp)
+endef
+define do-stamp
+$(make-target-directory)
+echo '$(patsubst $(objpfx)%,$(addsuffix /,$(subdir))%,$^)' > $@T
+mv -f $@T $@
+endef
+object-suffixes-left := $(object-suffixes-for-libc)
+include $(o-iterator)
+
+endif
+
+# Now define explicit rules to build the library archives; these depend
+# on the stamp files built above.
+define o-iterator-doit
+$(common-objpfx)$(patsubst %,$(libtype$o),c): \
+		$(subdirs-stamp-o) $(common-objpfx)stamp$o; $$(do-makelib)
+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))
+ifndef subdir
+$(subdirs-stamps): subdir_lib;
+endif
+object-suffixes-left = $(object-suffixes-for-libc)
+include $(o-iterator)
+
+
+# This makes all the object files.
+.PHONY: objects objs libobjs extra-objs
+objects objs: libobjs extra-objs
+libobjs: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
+extra-objs: $(addprefix $(objpfx),$(extra-objs))
+
+# Canned sequence for building an extra library archive.
+define build-extra-lib
+$(patsubst %/,cd % &&,$(objpfx)) \
+$(AR) $(CREATE_ARFLAGS) $(@:$(objpfx)%=%) \
+      $(patsubst $(objpfx)%,%,$^)
+$(RANLIB) $@
+endef
+
+# Installation.
+
+.PHONY: force-install
+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
+# $(includedir).  $(install-bin), $(install-bin-script) and $(install-sbin)
+# are installed from the object directory into $(bindir), $(bindir) and
+# $(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.
+ifndef libc-name
+libc-name := c
+endif
+
+define do-install
+$(make-target-directory)
+$(INSTALL_DATA) $< $@
+endef
+
+# Make the target directory if it doesn't exist, using the `mkinstalldirs'
+# script that does `mkdir -p' even if `mkdir' doesn't support that flag.
+define make-target-directory
+$(addprefix $(..)./scripts/mkinstalldirs ,\
+	    $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
+endef
+
+# Any directory (parent or subdir) should install libc.a; this way
+# "make install" in a subdir is guaranteed to install everything it changes.
+installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
+			     $(inst_libdir)/$(patsubst %,$(libtype$o),\
+						     $(libprefix)$(libc-name)))
+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)
+$(INSTALL_PROGRAM) $< $@.new
+mv -f $@.new $@
+endef
+
+define do-install-script
+$(make-target-directory)
+$(INSTALL_SCRIPT) $< $@.new
+mv -f $@.new $@
+endef
+
+install-lib.so := $(filter %.so,$(install-lib:%_pic.a=%.so))
+install-lib := $(filter-out %.so %_pic.a,$(install-lib))
+
+ifeq (yes,$(build-shared))
+# Find which .so's have versions.
+versioned := $(strip $(foreach so,$(install-lib.so),\
+			       $(patsubst %,$(so),$($(so)-version))))
+
+install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
+install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
+
+# For versioned libraries, we install three files:
+#	$(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))
+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$($L-version))
+
+# Install all the unversioned shared libraries.
+$(install-lib.so-unversioned:%=$(inst_slibdir)/%): $(inst_slibdir)/%.so: \
+    $(objpfx)%.so $(+force)
+	$(do-install-program)
+
+ifneq ($(findstring -s,$(LN_S)),)
+define make-link
+rm -f $@.new
+$(SHELL) $(..)scripts/rellns-sh $< $@.new
+mv -f $@.new $@
+endef
+else
+# If we have no symbolic links don't bother with rellns-sh.
+define make-link
+rm -f $@.new
+$(LN_S) $< $@.new
+mv -f $@.new $@
+endef
+endif
+
+ifeq (yes,$(build-shared))
+ifeq (no,$(cross-compiling))
+symbolic-link-prog := $(common-objpfx)elf/sln
+symbolic-link-list := $(common-objpfx)elf/symlink.list
+define make-shlib-link
+echo $(<F) $@ >> $(symbolic-link-list)
+endef
+else # cross-compiling
+# We need a definition that can be used by elf/Makefile's install rules.
+symbolic-link-prog = $(LN_S)
+endif
+endif
+ifndef make-shlib-link
+define make-shlib-link
+rm -f $@
+$(LN_S) $(<F) $@
+endef
+endif
+
+ifdef libc.so-version
+# For a library specified to be version N, install three files:
+# libc.so	->	libc.so.N	(e.g. libc.so.6)
+# libc.so.6	->	libc-VERSION.so	(e.g. libc-1.10.so)
+
+$(inst_slibdir)/libc.so$(libc.so-version): $(inst_slibdir)/libc-$(version).so \
+					   $(+force)
+	$(make-shlib-link)
+$(inst_slibdir)/libc-$(version).so: $(common-objpfx)libc.so $(+force)
+	$(do-install-program)
+install: $(inst_slibdir)/libc.so$(libc.so-version)
+
+# This fragment of linker script gives the OUTPUT_FORMAT statement
+# for the configuration we are building.  We put this statement into
+# the linker scripts we install for -lc et al so that they will not be
+# used by a link for a different format on a multi-architecture system.
+$(common-objpfx)format.lds: $(..)scripts/output-format.sed \
+			    $(common-objpfx)config.make \
+			    $(common-objpfx)config.h $(..)Makerules
+	$(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
+		  -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
+	| sed -n -f $< > $@.new
+	rm -f $@.so
+	mv -f $@.new $@
+common-generated += format.lds
+
+ifndef subdir
+# What we install as libc.so for programs to link against is in fact a
+# link script.  It contains references for the various libraries we need.
+# The libc.so object is not complete since some functions are only defined
+# in libc_nonshared.a.
+# We need to use absolute paths since otherwise local copies (if they exist)
+# of the files are taken by the linker.
+install: $(inst_libdir)/libc.so
+$(inst_libdir)/libc.so: $(common-objpfx)format.lds \
+			$(common-objpfx)libc.so$(libc.so-version) \
+			$(inst_libdir)/$(patsubst %,$(libtype.oS),\
+						  $(libprefix)$(libc-name)) \
+			$(+force)
+	(echo '/* GNU ld script';\
+	 echo '   Use the shared library, but some functions are only in';\
+	 echo '   the static library, so try that secondarily.  */';\
+	 cat $<; \
+	 echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
+	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
+	      ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \
+	) > $@.new
+	mv -f $@.new $@
+
+endif
+
+else
+install: $(inst_slibdir)/libc.so
+$(inst_slibdir)/libc.so: $(common-objpfx)libc.so $(+force)
+	$(do-install-program)
+endif
+
+ifneq (,$(versioned))
+# Produce three sets of rules as above for all the smaller versioned libraries.
+
+define o-iterator-doit
+$(inst_libdir)/$o: $(inst_slibdir)/$o$($o-version) $(+force); $$(make-link)
+endef
+object-suffixes-left := $(filter-out $(install-lib-ldscripts),$(versioned))
+ifneq (,$(object-suffixes-left))
+include $(o-iterator)
+endif
+
+# Make symlinks in the build directory, because the versioned names might
+# be referenced by a DT_NEEDED in another library.
+define o-iterator-doit
+$(objpfx)$o$($o-version): $(objpfx)$o; $$(make-link)
+endef
+object-suffixes-left := $(versioned)
+include $(o-iterator)
+
+generated += $(foreach o,$(versioned),$o$($o-version))
+
+ifeq (,$($(subdir)-version))
+define o-iterator-doit
+$(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \
+				 $(+force);
+	$$(make-shlib-link)
+endef
+object-suffixes-left := $(versioned)
+include $(o-iterator)
+
+define o-iterator-doit
+$(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);
+	$$(do-install-program)
+endef
+object-suffixes-left := $(versioned)
+include $(o-iterator)
+else
+define o-iterator-doit
+$(inst_slibdir)/$o$($o-version): \
+  $(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so $(+force);
+	$$(make-shlib-link)
+endef
+object-suffixes-left := $(versioned)
+include $(o-iterator)
+
+define o-iterator-doit
+$(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o $(+force);
+	$$(do-install-program)
+endef
+object-suffixes-left := $(versioned)
+include $(o-iterator)
+endif
+endif
+
+define do-install-so
+$(do-install-program)
+$(patsubst %,ln -s -f $(@F) $(@D)/$(patsubst %$*.so,%,$(<F))$(libprefix)$*.so,\
+	   $(filter-out %.so,$@))
+endef
+
+so-versions := $(sort $(foreach so,$(install-lib.so),.so$($(so)-version)))
+$(foreach v,$(so-versions),\
+	  $(inst_slibdir)/lib$(libprefix)%$v): $(common-objpfx)lib%.so \
+					       $(+force)
+	$(do-install-so)
+$(foreach v,$(so-versions),\
+	  $(inst_slibdir)/$(libprefix)%$v): $(common-objpfx)%.so $(+force)
+	$(do-install-so)
+endif
+
+ifdef install-bin
+$(addprefix $(inst_bindir)/,$(install-bin)): \
+    $(inst_bindir)/%: $(objpfx)% $(+force)
+	$(do-install-program)
+endif
+ifdef install-bin-script
+$(addprefix $(inst_bindir)/,$(install-bin-script)): \
+    $(inst_bindir)/%: $(objpfx)% $(+force)
+	$(do-install-script)
+endif
+ifdef install-rootsbin
+$(addprefix $(inst_rootsbindir)/,$(install-rootsbin)): \
+   $(inst_rootsbindir)/%: $(objpfx)% $(+force)
+	$(do-install-program)
+endif
+ifdef install-sbin
+$(addprefix $(inst_sbindir)/,$(install-sbin)): \
+    $(inst_sbindir)/%: $(objpfx)% $(+force)
+	$(do-install-program)
+endif
+ifdef install-lib
+install-lib.a := $(filter lib%.a,$(install-lib))
+install-lib-non.a := $(filter-out lib%.a,$(install-lib))
+ifdef install-lib-non.a
+$(addprefix $(inst_libdir)/$(libprefix),$(install-lib-non.a)): \
+  $(inst_libdir)/$(libprefix)%: $(objpfx)% $(+force)
+	$(do-install)
+endif
+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
+$(addprefix $(inst_datadir)/,$(install-data)): $(inst_datadir)/%: % $(+force)
+	$(do-install)
+endif
+headers := $(strip $(headers))
+ifdef headers
+# This implicit rule installs headers from the source directory.
+# It may be ignored in preference to rules from sysd-rules to find
+# headers in the sysdeps tree.
+$(inst_includedir)/%.h: $(objpfx)%.h $(+force)
+	$(do-install)
+$(inst_includedir)/%.h: %.h $(+force)
+	$(do-install)
+$(inst_includedir)/%.h: $(..)include/%.h $(+force)
+	$(do-install)
+headers-nonh := $(filter-out %.h,$(headers))
+ifdef headers-nonh
+$(addprefix $(inst_includedir)/,$(headers-nonh)): $(inst_includedir)/%: \
+						 % $(+force)
+	$(do-install)
+endif	# headers-nonh
+endif	# headers
+
+.PHONY: install-bin-nosubdir install-bin-script-nosubdir \
+	install-rootsbin-nosubdir install-sbin-nosubdir install-lib-nosubdir \
+	install-data-nosubdir install-headers-nosubdir
+install-bin-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin))
+install-bin-script-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin-script))
+install-rootsbin-nosubdir: \
+	$(addprefix $(inst_rootsbindir)/,$(install-rootsbin))
+install-sbin-nosubdir: $(addprefix $(inst_sbindir)/,$(install-sbin))
+install-lib-nosubdir: $(addprefix $(inst_libdir)/,\
+		       $(patsubst lib%.a,lib$(libprefix)%.a,$(install-lib.a)) \
+		       $(addprefix $(libprefix),$(install-lib-non.a)))
+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.
+# This rule makes `install-FOO' always use `install-FOO-nosubdir' as a
+# subroutine.  Then in the parent `install-FOO' also causes subdir makes.
+install-%:: install-%-nosubdir ;
+
+.PHONY: install install-no-libc.a-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
+
+# Command to compile $< in $(objdir) 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)
+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
+
+# Support the GNU standard name for this target.
+.PHONY: check
+check: tests
+# Special target to run tests which cannot be run unconditionally.
+# Maintainers should use this target.
+.PHONY: xcheck
+xcheck: xtests
+
+all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others))
+ifneq (,$(all-nonlib))
+cpp-srcs-left = $(all-nonlib:=.c) $(all-nonlib:=.cc)
+lib := nonlib
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+endif
+
+# The include magic above causes those files to use this variable for flags.
+CPPFLAGS-nonlib = -DNOT_IN_libc=1
+
+
+ifeq ($(versioning),yes)
+# Generate normalized lists of symbols, versions, and data sizes.
+# This is handy for checking against existing library binaries.
+
+%.symlist: $(..)scripts/abilist.awk %.dynsym
+	LC_ALL=C $(AWK) -f $^ > $@T
+	mv -f $@T $@
+
+%.dynsym: %.so
+	$(OBJDUMP) --dynamic-syms $< > $@T
+	mv -f $@T $@
+
+check-abi-%: $(..)scripts/extract-abilist.awk $(common-objpfx)config.make \
+	     $(..)abilist/%.abilist $(objpfx)%.symlist
+	$(check-abi)
+check-abi-%: $(..)scripts/extract-abilist.awk $(common-objpfx)config.make \
+	     $(..)abilist/%.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) ; }
+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 := tls
+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)
+update-abi-%: $(..)scripts/merge-abilist.awk $(..)abilist/%.abilist \
+	      $(common-objpfx)%.symlist
+	$(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 ***'; \
+ fi
+endef
+endif
+
+.PHONY: update-abi check-abi
+update-abi: $(patsubst %.so,update-abi-%,$(install-lib.so-versioned))
+check-abi: $(patsubst %.so,check-abi-%,$(install-lib.so-versioned))
+ifdef subdir
+subdir_check-abi: check-abi
+subdir_update-abi: update-abi
+else
+check-abi: subdir_check-abi
+update-abi: subdir_update-abi
+endif
+
+ifeq ($(subdir),elf)
+check-abi: check-abi-libc
+update-abi: update-abi-libc
+common-generated += libc.symlist
+endif
+
+ifeq ($(build-shared),yes)
+ifneq ($(enable-check-abi),no)
+ifdef subdir
+tests: check-abi
+endif
+endif
+endif
+
+endif
+
+# These will have been set by sysdeps/posix/Makefile.
+L_tmpnam  ?= 1
+TMP_MAX   ?= 0
+L_ctermid ?= 1
+L_cuserid ?= 1
+
+stdio_lim = $(common-objpfx)bits/stdio_lim.h
+
+$(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @:
+$(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)' 	\
+	      $(+includes) -xc - -o $(@:st=hT)
+	sed $(sed-remove-objpfx) $(sed-remove-dotdot)			\
+	    $(@:st=dT) > $(@:st=dt)
+	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.
+	rm -f $(@:st=hT) $(@:st=dT) $(@:st=dt)
+	touch $@
+# Get dependencies.
+ifndef no_deps
+-include $(stdio_lim:h=d)
+endif
+common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st
+
+FORCE:
+
+.PHONY: echo-headers
+echo-headers:
+	@echo $(headers)
+
+%.bz2: %; bzip2 -9vk $<
+%.gz: %; gzip -9vnc $< > $@.new && mv -f $@.new $@
+
+# Common cleaning targets.
+
+.PHONY: common-mostlyclean common-clean mostlyclean clean do-tests-clean
+clean: common-clean
+mostlyclean: common-mostlyclean
+
+do-tests-clean:
+	-rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) $(xtests) \
+						      $(test-srcs)) \
+				     $(addsuffix -bp.out,$(tests) $(xtests) \
+							 $(test-srcs)))
+
+# Remove the object files.
+common-mostlyclean:
+	-rm -f $(addprefix $(objpfx),$(tests) $(xtests) $(test-srcs) \
+				     $(others) $(sysdep-others) stubs \
+				     $(addsuffix .o,$(tests) $(xtests) \
+						    $(test-srcs) $(others) \
+						    $(sysdep-others)) \
+				     $(addsuffix -bp,$(tests) $(xtests) \
+						     $(test-srcs)) \
+				     $(addsuffix .out,$(tests) $(xtests) \
+						      $(test-srcs)) \
+				     $(addsuffix -bp.out,$(tests) $(xtests) \
+							 $(test-srcs)))
+	-rm -f $(addprefix $(objpfx),$(extra-objs) $(extra-test-objs) \
+				     $(install-lib) $(install-lib.so) \
+				     $(install-lib.so:%.so=%_pic.a))
+	-rm -f core
+	-rm -f $(objpfx)rtld-*.os
+	$(rmobjs)
+define rmobjs
+$(foreach o,$(object-suffixes-for-libc),
+-rm -f $(objpfx)stamp$o $(o-objects))
+endef
+
+# Also remove the dependencies and generated source files.
+common-clean: common-mostlyclean
+	-rm -f $(addprefix $(objpfx),$(generated))
+	-rm -f $(objpfx)*.d $(objpfx)*.dt
+	-rm -fr $(addprefix $(objpfx),$(generated-dirs))
+	-rm -f $(addprefix $(common-objpfx),$(common-generated))
+
+# 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.
+
+ifdef objpfx
+.PHONY: stubs # The parent Makefile calls this target.
+stubs: $(objpfx)stubs
+endif
+objs-for-stubs := $(foreach o,$(object-suffixes-for-libc),$(o-objects)) \
+		  $(addprefix $(objpfx),$(extra-objs))
+$(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); \
+		  stubs[$$2] = 1; } \
+		END { for (s in stubs) print "#define __stub_" s }' > $@T
+	mv -f $@T $@
+else
+	> $@
+endif
+
+ifneq (,$(strip $(gpl2lgpl)))
+ifneq (,$(wildcard $(..)gpl2lgpl.sed))
+# Snarf from the master source and frob the copying notice.
+$(gpl2lgpl): %: $(..)gpl2lgpl.sed /home/gd/gnu/lib/%
+	sed -f $^ > $@-tmp
+# 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
+
+# Local Variables:
+# mode: makefile
+# End:
diff -Naur glibc-2.8.orig/nptl/Makefile glibc-2.8/nptl/Makefile
--- glibc-2.8.orig/nptl/Makefile	2008-11-24 14:14:24.000000000 -0500
+++ glibc-2.8/nptl/Makefile	2008-11-24 14:14:26.000000000 -0500
@@ -374,7 +374,7 @@
 
 $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \
 			      $(objpfx)libpthread.so$(libpthread.so-version) \
-			      $(inst_libdir)/$(patsubst %,$(libtype.oS),\
+			      $(inst_libdir)/$(patsubst %,$(libtype.oST),\
 							$(libprefix)pthread) \
 			      $(+force)
 	(echo '/* GNU ld script';\
@@ -382,7 +382,7 @@
 	 echo '   the static library, so try that secondarily.  */';\
 	 cat $<; \
 	 echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \
-	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\
+	      '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\
 	      ')' \
 	) > $@.new
 	mv -f $@.new $@
diff -Naur glibc-2.8.orig/nptl/Makefile.orig glibc-2.8/nptl/Makefile.orig
--- glibc-2.8.orig/nptl/Makefile.orig	1969-12-31 19:00:00.000000000 -0500
+++ glibc-2.8/nptl/Makefile.orig	2008-09-03 10:51:24.000000000 -0400
@@ -0,0 +1,619 @@
+# Copyright (C) 2002,2003,2004,2005,2006,2007,2008
+#	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
+# 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.
+
+# 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
+# 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.
+
+#
+#	Sub-makefile for NPTL portion of the library.
+#
+subdir	:= nptl
+
+headers := pthread.h semaphore.h bits/semaphore.h
+
+extra-libs := libpthread
+extra-libs-others := $(extra-libs)
+install-lib-ldscripts := libpthread.so
+
+routines = alloca_cutoff forward libc-lowlevellock libc-cancellation
+shared-only-routines = forward
+
+libpthread-routines = init vars events version \
+		      pthread_create pthread_exit pthread_detach \
+		      pthread_join pthread_tryjoin pthread_timedjoin \
+		      pthread_self pthread_equal pthread_yield \
+		      pthread_getconcurrency pthread_setconcurrency \
+		      pthread_getschedparam pthread_setschedparam \
+		      pthread_setschedprio \
+		      pthread_attr_init pthread_attr_destroy \
+		      pthread_attr_getdetachstate pthread_attr_setdetachstate \
+		      pthread_attr_getguardsize pthread_attr_setguardsize \
+		      pthread_attr_getschedparam pthread_attr_setschedparam \
+		      pthread_attr_getschedpolicy pthread_attr_setschedpolicy \
+		      pthread_attr_getinheritsched \
+		      pthread_attr_setinheritsched \
+		      pthread_attr_getscope pthread_attr_setscope \
+		      pthread_attr_getstackaddr pthread_attr_setstackaddr \
+		      pthread_attr_getstacksize pthread_attr_setstacksize \
+		      pthread_attr_getstack pthread_attr_setstack \
+		      pthread_getattr_np \
+		      pthread_mutex_init pthread_mutex_destroy \
+		      pthread_mutex_lock pthread_mutex_trylock \
+		      pthread_mutex_timedlock pthread_mutex_unlock \
+		      pthread_mutexattr_init pthread_mutexattr_destroy \
+		      pthread_mutexattr_getpshared \
+		      pthread_mutexattr_setpshared \
+		      pthread_mutexattr_gettype pthread_mutexattr_settype \
+		      pthread_rwlock_init pthread_rwlock_destroy \
+		      pthread_rwlock_rdlock pthread_rwlock_timedrdlock \
+		      pthread_rwlock_wrlock pthread_rwlock_timedwrlock \
+		      pthread_rwlock_tryrdlock pthread_rwlock_trywrlock \
+		      pthread_rwlock_unlock \
+		      pthread_rwlockattr_init pthread_rwlockattr_destroy \
+		      pthread_rwlockattr_getpshared \
+		      pthread_rwlockattr_setpshared \
+		      pthread_rwlockattr_getkind_np \
+		      pthread_rwlockattr_setkind_np \
+		      pthread_cond_init pthread_cond_destroy \
+		      pthread_cond_wait pthread_cond_timedwait \
+		      pthread_cond_signal pthread_cond_broadcast \
+		      old_pthread_cond_init old_pthread_cond_destroy \
+		      old_pthread_cond_wait old_pthread_cond_timedwait \
+		      old_pthread_cond_signal old_pthread_cond_broadcast \
+		      pthread_condattr_init pthread_condattr_destroy \
+		      pthread_condattr_getpshared pthread_condattr_setpshared \
+		      pthread_condattr_getclock pthread_condattr_setclock \
+		      pthread_spin_init pthread_spin_destroy \
+		      pthread_spin_lock pthread_spin_trylock \
+		      pthread_spin_unlock \
+		      pthread_barrier_init pthread_barrier_destroy \
+		      pthread_barrier_wait \
+		      pthread_barrierattr_init pthread_barrierattr_destroy \
+		      pthread_barrierattr_getpshared \
+		      pthread_barrierattr_setpshared \
+		      pthread_key_create pthread_key_delete \
+		      pthread_getspecific pthread_setspecific \
+		      pthread_sigmask pthread_kill \
+		      pthread_cancel pthread_testcancel \
+		      pthread_setcancelstate pthread_setcanceltype \
+		      pthread_once \
+		      old_pthread_atfork pthread_atfork \
+		      pthread_getcpuclockid \
+		      pthread_clock_gettime pthread_clock_settime \
+		      sem_init sem_destroy \
+		      sem_open sem_close sem_unlink \
+		      sem_getvalue \
+		      sem_wait sem_trywait sem_timedwait sem_post \
+		      cleanup cleanup_defer cleanup_compat \
+		      cleanup_defer_compat unwind \
+		      pt-longjmp pt-cleanup\
+		      cancellation \
+		      lowlevellock lowlevelrobustlock \
+		      pt-vfork \
+		      ptw-write ptw-read ptw-close ptw-fcntl ptw-accept \
+		      ptw-connect ptw-recv ptw-recvfrom ptw-recvmsg ptw-send \
+		      ptw-sendmsg ptw-sendto ptw-fsync ptw-lseek ptw-llseek \
+		      ptw-msync ptw-nanosleep ptw-open ptw-open64 ptw-pause \
+		      ptw-pread ptw-pread64 ptw-pwrite ptw-pwrite64 \
+		      ptw-tcdrain ptw-wait ptw-waitpid ptw-msgrcv ptw-msgsnd \
+		      ptw-sigwait ptw-sigsuspend \
+		      pt-raise pt-system \
+		      flockfile ftrylockfile funlockfile \
+		      sigaction \
+		      herrno res pt-allocrtsig \
+		      pthread_kill_other_threads \
+		      pthread_getaffinity pthread_setaffinity \
+		      pthread_attr_getaffinity pthread_attr_setaffinity \
+		      pthread_mutexattr_getrobust pthread_mutexattr_setrobust \
+		      pthread_mutex_consistent \
+		      cleanup_routine unwind-forcedunwind \
+		      pthread_mutexattr_getprotocol \
+		      pthread_mutexattr_setprotocol \
+		      pthread_mutexattr_getprioceiling \
+		      pthread_mutexattr_setprioceiling tpp \
+		      pthread_mutex_getprioceiling pthread_mutex_setprioceiling
+#		      pthread_setuid pthread_seteuid pthread_setreuid \
+#		      pthread_setresuid \
+#		      pthread_setgid pthread_setegid pthread_setregid \
+#		      pthread_setresgid
+
+libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
+libpthread-static-only-routines = pthread_atfork
+
+CFLAGS-pthread_atfork.c = -DNOT_IN_libc
+
+# Since cancellation handling is in large parts handled using exceptions
+# we have to compile some files with exception handling enabled, some
+# even with asynchronous unwind tables.
+
+# init.c contains sigcancel_handler().
+CFLAGS-init.c = -fexceptions -fasynchronous-unwind-tables
+# The unwind code itself,
+CFLAGS-unwind.c = -fexceptions
+CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables
+
+# The following three functions must be async-cancel safe.
+CFLAGS-pthread_cancel.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pthread_setcancelstate.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pthread_setcanceltype.c = -fexceptions -fasynchronous-unwind-tables
+
+# These are internal functions which similar functionality as setcancelstate
+# and setcanceltype.
+CFLAGS-cancellation.c = -fasynchronous-unwind-tables
+CFLAGS-libc-cancellation.c = -fasynchronous-unwind-tables
+
+# Calling pthread_exit() must cause the registered cancel handlers to
+# be executed.  Therefore exceptions have to be thrown through this
+# function.
+CFLAGS-pthread_exit.c = -fexceptions
+
+# Among others, __pthread_unwind is forwarded.  This function must handle
+# exceptions.
+CFLAGS-forward.c = -fexceptions
+
+# The following are cancellation points.  Some of the functions can
+# block and therefore temporarily enable asynchronous cancellation.
+# Those must be compiled asynchronous unwind tables.
+CFLAGS-pthread_testcancel.c = -fexceptions
+CFLAGS-pthread_join.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pthread_timedjoin.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pthread_once.c = $(uses-callbacks) -fexceptions \
+			-fasynchronous-unwind-tables
+CFLAGS-pthread_cond_wait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pthread_cond_timedwait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sem_wait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sem_timedwait.c = -fexceptions -fasynchronous-unwind-tables
+
+# These are the function wrappers we have to duplicate here.
+CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-lockf.c = -fexceptions
+CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pwrite64.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-wait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sigwait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
+
+CFLAGS-pt-system.c = -fexceptions
+
+
+tests = tst-typesizes \
+	tst-attr1 tst-attr2 tst-attr3 \
+	tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \
+	tst-mutex7 tst-mutex8 tst-mutex9 tst-mutex5a tst-mutex7a \
+	tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \
+	tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a tst-mutexpi8 \
+	tst-mutexpi9 \
+	tst-spin1 tst-spin2 tst-spin3 \
+	tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
+	tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
+	tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
+	tst-cond20 tst-cond21 tst-cond22 \
+	tst-robust1 tst-robust2 tst-robust3 tst-robust4 tst-robust5 \
+	tst-robust6 tst-robust7 tst-robust8 tst-robust9 \
+	tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 tst-robustpi5 \
+	tst-robustpi6 tst-robustpi7 tst-robustpi8 tst-robustpi9 \
+	tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \
+	tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \
+	tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
+	tst-once1 tst-once2 tst-once3 tst-once4 \
+	tst-key1 tst-key2 tst-key3 tst-key4 \
+	tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
+	tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 \
+	tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
+	tst-align tst-align2 tst-align3 \
+	tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
+	tst-basic7 \
+	tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
+	tst-raise1 \
+	tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 tst-join6 \
+	tst-detach1 \
+	tst-eintr1 tst-eintr2 tst-eintr3 tst-eintr4 tst-eintr5 \
+	tst-tsd1 tst-tsd2 tst-tsd3 tst-tsd4 tst-tsd5 tst-tsd6 \
+	tst-tls1 tst-tls2 \
+	tst-fork1 tst-fork2 tst-fork3 tst-fork4 \
+	tst-atfork1 \
+	tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel4 tst-cancel5 \
+	tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
+	tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
+	tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
+	tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
+	tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
+	tst-flock1 tst-flock2 \
+	tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
+	tst-signal6 tst-signal7 \
+	tst-exec1 tst-exec2 tst-exec3 tst-exec4 \
+	tst-exit1 tst-exit2 tst-exit3 \
+	tst-stdio1 tst-stdio2 \
+	tst-stack1 tst-stack2 tst-stack3 \
+	tst-unload \
+	tst-dlsym1 \
+	tst-sysconf \
+	tst-locale1 tst-locale2 \
+	tst-umask1 \
+	tst-popen1 \
+	tst-clock1 \
+	tst-context1 \
+	tst-sched1 \
+	tst-backtrace1 \
+	tst-oddstacklimit \
+	tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
+	tst-getpid1 tst-getpid2 tst-getpid3 \
+	tst-initializers1 $(patsubst %,tst-initializers1-%,c89 gnu89 c99 gnu99)
+xtests = tst-setuid1 tst-setuid1-static tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
+
+# Files which must not be linked with libpthread.
+tests-nolibpthread = tst-unload
+
+# This sets the stack resource limit to 1023kb, which is not a multiple
+# of the page size since every architecture's page size is > 1k.
+tst-oddstacklimit-ENV = ; ulimit -s 1023;
+
+distribute = eintr.c tst-cleanup4aux.c
+
+gen-as-const-headers = pthread-errnos.sym
+
+LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
+
+
+include ../Makeconfig
+
+ifeq ($(have-forced-unwind),yes)
+tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \
+	 tst-cancelx6 tst-cancelx7 tst-cancelx8 tst-cancelx9 tst-cancelx10 \
+	 tst-cancelx11 tst-cancelx12 tst-cancelx13 tst-cancelx14 tst-cancelx15 \
+	 tst-cancelx16 tst-cancelx17 tst-cancelx18 tst-cancelx20 tst-cancelx21 \
+	 tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 \
+	 tst-oncex3 tst-oncex4
+endif
+ifeq ($(build-shared),yes)
+tests += tst-atfork2 tst-tls3 tst-tls4 tst-tls5 tst-_res1 tst-fini1 \
+	 tst-stackguard1
+tests-nolibpthread += tst-fini1
+ifeq ($(have-z-execstack),yes)
+tests += tst-execstack
+endif
+endif
+
+modules-names = tst-atfork2mod tst-tls3mod tst-tls4moda tst-tls4modb \
+		tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \
+		tst-tls5modd tst-tls5mode tst-tls5modf \
+		tst-_res1mod1 tst-_res1mod2 tst-execstack-mod tst-fini1mod
+extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) tst-cleanup4aux.o
+test-extras += $(modules-names)
+test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
+
+tst-atfork2mod.so-no-z-defs = yes
+tst-tls3mod.so-no-z-defs = yes
+tst-tls5mod.so-no-z-defs = yes
+tst-tls5moda.so-no-z-defs = yes
+tst-tls5modb.so-no-z-defs = yes
+tst-tls5modc.so-no-z-defs = yes
+tst-tls5modd.so-no-z-defs = yes
+tst-tls5mode.so-no-z-defs = yes
+tst-tls5modf.so-no-z-defs = yes
+
+ifeq ($(build-shared),yes)
+# Build all the modules even when not actually running test programs.
+tests: $(test-modules)
+endif
+
+ifeq ($(build-shared),yes)
+
+# Set the `multidir' variable by grabbing the variable from the compiler.
+# We do it once and save the result in a generated makefile.
+-include $(objpfx)multidir.mk
+$(objpfx)multidir.mk: $(common-objpfx)config.make
+	$(make-target-directory)
+	dir=`$(CC) $(CFLAGS) $(CPPFLAGS) -print-multi-directory`; \
+	echo "multidir := $$dir" > $@T
+	mv -f $@T $@
+
+crti-objs := crti.o
+crtn-objs := crtn.o
+ifneq (,$(patsubst .,,$(multidir)))
+generated-dirs := $(firstword $(subst /, , $(multidir)))
+crti-objs += $(multidir)/crti.o
+crtn-objs += $(multidir)/crtn.o
+omit-deps += $(multidir)/crti $(multidir)/crtn
+$(objpfx)$(multidir):
+	mkdir -p $@
+endif
+extra-objs += $(crti-objs) $(crtn-objs)
+omit-deps += crti crtn
+
+CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions $(fno-unit-at-a-time)
+endif
+
+CFLAGS-flockfile.c = -D_IO_MTSAFE_IO
+CFLAGS-ftrylockfile.c = -D_IO_MTSAFE_IO
+CFLAGS-funlockfile.c = -D_IO_MTSAFE_IO
+
+link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
+		    $(common-objpfx)libc.a
+
+ifeq ($(build-static),yes)
+tests-static += tst-locale1 tst-locale2 tst-stackguard1-static
+tests += tst-stackguard1-static
+xtests-static += tst-setuid1-static
+endif
+# These tests are linked with libc before libpthread
+tests-reverse += tst-cancel5 tst-cancel23 tst-vfork1x tst-vfork2x
+
+include ../Rules
+
+ifeq (yes,$(build-shared))
+# Make sure these things are built in the `make lib' pass so they can be used
+# to run programs during the `make others' pass.
+lib-noranlib: $(addprefix $(objpfx),$(extra-objs))
+
+# What we install as libpthread.so for programs to link against is in fact a
+# link script.  It contains references for the various libraries we need.
+# The libpthread.so object is not complete since some functions are only
+# defined in libpthread_nonshared.a.
+# We need to use absolute paths since otherwise local copies (if they exist)
+# of the files are taken by the linker.
+install: $(inst_libdir)/libpthread.so
+
+$(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \
+			      $(objpfx)libpthread.so$(libpthread.so-version) \
+			      $(inst_libdir)/$(patsubst %,$(libtype.oS),\
+							$(libprefix)pthread) \
+			      $(+force)
+	(echo '/* GNU ld script';\
+	 echo '   Use the shared library, but some functions are only in';\
+	 echo '   the static library, so try that secondarily.  */';\
+	 cat $<; \
+	 echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \
+	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\
+	      ')' \
+	) > $@.new
+	mv -f $@.new $@
+endif
+
+
+# 'pthread_self' is a simple memory or register load.  Setting up the
+# stack frame is more work than the actual operation.  Disable the
+# frame creation entirely.  This will help applications which call the
+# function frequently to get a thread-specific handle.
+CFLAGS-pthread_self.os += -fomit-frame-pointer
+
+# Run the cancellation and cleanup tests also for the modern, exception-based
+# implementation.  For this we have to pass the -fexceptions parameter.
+CFLAGS-tst-cancelx2.c += -fexceptions
+CFLAGS-tst-cancelx3.c += -fexceptions
+CFLAGS-tst-cancelx4.c += -fexceptions
+CFLAGS-tst-cancelx5.c += -fexceptions
+CFLAGS-tst-cancelx6.c += -fexceptions
+CFLAGS-tst-cancelx7.c += -fexceptions
+CFLAGS-tst-cancelx8.c += -fexceptions
+CFLAGS-tst-cancelx9.c += -fexceptions
+CFLAGS-tst-cancelx10.c += -fexceptions
+CFLAGS-tst-cancelx11.c += -fexceptions
+CFLAGS-tst-cancelx12.c += -fexceptions
+CFLAGS-tst-cancelx13.c += -fexceptions
+CFLAGS-tst-cancelx14.c += -fexceptions
+CFLAGS-tst-cancelx15.c += -fexceptions
+CFLAGS-tst-cancelx16.c += -fexceptions
+CFLAGS-tst-cancelx17.c += -fexceptions
+CFLAGS-tst-cancelx18.c += -fexceptions
+CFLAGS-tst-cancelx20.c += -fexceptions -fasynchronous-unwind-tables
+CFLAGS-tst-cancelx21.c += -fexceptions -fasynchronous-unwind-tables
+CFLAGS-tst-cleanupx0.c += -fexceptions -fasynchronous-unwind-tables
+CFLAGS-tst-cleanupx1.c += -fexceptions -fasynchronous-unwind-tables
+CFLAGS-tst-cleanupx2.c += -fexceptions
+CFLAGS-tst-cleanupx3.c += -fexceptions
+CFLAGS-tst-cleanupx4.c += -fexceptions
+CFLAGS-tst-oncex3.c += -fexceptions
+CFLAGS-tst-oncex4.c += -fexceptions
+CFLAGS-tst-align.c += $(stack-align-test-flags)
+CFLAGS-tst-align3.c += $(stack-align-test-flags)
+CFLAGS-tst-initializers1.c = -W -Wall -Werror
+CFLAGS-tst-initializers1-< = $(CFLAGS-tst-initializers1.c) \
+			     $(patsubst tst-initializers1-%.c,-std=%,$<)
+CFLAGS-tst-initializers1-c89.c = $(CFLAGS-tst-initializers1-<)
+CFLAGS-tst-initializers1-c99.c = $(CFLAGS-tst-initializers1-<)
+CFLAGS-tst-initializers1-gnu89.c = $(CFLAGS-tst-initializers1-<)
+CFLAGS-tst-initializers1-gnu99.c = $(CFLAGS-tst-initializers1-<)
+
+tst-cancel7-ARGS = --command "$(built-program-cmd)"
+tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
+tst-umask1-ARGS = $(objpfx)tst-umask1.temp
+
+$(objpfx)tst-atfork2: $(libdl) $(shared-thread-library)
+LDFLAGS-tst-atfork2 = -rdynamic
+tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
+$(objpfx)tst-atfork2mod.so: $(shared-thread-library)
+
+tests: $(objpfx)tst-stack3-mem
+tst-stack3-ENV = MALLOC_TRACE=$(objpfx)tst-stack3.mtrace
+$(objpfx)tst-stack3-mem: $(objpfx)tst-stack3.out
+	$(common-objpfx)malloc/mtrace $(objpfx)tst-stack3.mtrace > $@
+generated += tst-stack3-mem tst-stack3.mtrace
+
+$(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o $(shared-thread-library)
+$(objpfx)tst-cleanupx4: $(objpfx)tst-cleanup4aux.o $(shared-thread-library)
+
+$(objpfx)tst-tls3: $(libdl) $(shared-thread-library)
+LDFLAGS-tst-tls3 = -rdynamic
+$(objpfx)tst-tls3.out: $(objpfx)tst-tls3mod.so
+$(objpfx)tst-tls3mod.so: $(shared-thread-library)
+
+$(objpfx)tst-tls4: $(libdl) $(shared-thread-library)
+$(objpfx)tst-tls4.out: $(objpfx)tst-tls4moda.so $(objpfx)tst-tls4modb.so
+
+$(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so $(shared-thread-library)
+LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
+
+ifeq ($(build-shared),yes)
+tests: $(objpfx)tst-tls6.out
+$(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
+		       $(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \
+		       $(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
+		       $(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
+	$(SHELL) -e tst-tls6.sh $(common-objpfx) $(elf-objpfx) \
+		    $(rtld-installed-name)
+endif
+
+$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
+
+$(objpfx)tst-fini1: $(shared-thread-library) $(objpfx)tst-fini1mod.so
+
+ifeq (yes,$(build-shared))
+$(objpfx)tst-cond11: $(common-objpfx)rt/librt.so
+$(objpfx)tst-cond19: $(common-objpfx)rt/librt.so
+$(objpfx)tst-cancel17: $(common-objpfx)rt/librt.so
+$(objpfx)tst-cancelx17: $(common-objpfx)rt/librt.so
+$(objpfx)tst-cancel18: $(common-objpfx)rt/librt.so
+$(objpfx)tst-cancelx18: $(common-objpfx)rt/librt.so
+$(objpfx)tst-clock2: $(common-objpfx)rt/librt.so
+$(objpfx)tst-rwlock14: $(common-objpfx)rt/librt.so
+$(objpfx)tst-_res1mod2.so: $(objpfx)tst-_res1mod1.so
+LDFLAGS-tst-_res1mod1.so = -Wl,-soname,tst-_res1mod1.so
+LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so
+$(objpfx)tst-_res1: $(objpfx)tst-_res1mod2.so $(shared-thread-library)
+else
+$(objpfx)tst-cond11: $(common-objpfx)rt/librt.a
+$(objpfx)tst-cond19: $(common-objpfx)rt/librt.a
+$(objpfx)tst-cancel17: $(common-objpfx)rt/librt.a
+$(objpfx)tst-cancelx17: $(common-objpfx)rt/librt.a
+$(objpfx)tst-cancel18: $(common-objpfx)rt/librt.a
+$(objpfx)tst-cancelx18: $(common-objpfx)rt/librt.a
+$(objpfx)tst-clock2: $(common-objpfx)rt/librt.a
+$(objpfx)tst-rwlock14: $(common-objpfx)rt/librt.a
+endif
+
+LDFLAGS-tst-cancel24 = -lstdc++
+
+extra-B-pthread.so = -B$(common-objpfx)nptl/
+$(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
+$(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs))
+$(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs))
+
+# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
+# This ensures they will load libc.so for needed symbols if loaded by
+# a statically-linked program that hasn't already loaded it.
+# Depend on ld.so too to get proper versions of ld.so symbols.
+$(objpfx)libpthread.so: $(common-objpfx)libc.so \
+			$(common-objpfx)libc_nonshared.a \
+			$(if $(filter yes,$(elf)), $(elfobjdir)/ld.so)
+
+# Make sure we link with the thread library.
+ifeq ($(build-shared),yes)
+$(addprefix $(objpfx), \
+  $(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \
+    $(tests-nolibpthread), \
+    $(tests) $(xtests) $(test-srcs))): $(objpfx)libpthread.so \
+				       $(objpfx)libpthread_nonshared.a
+$(objpfx)tst-unload: $(common-objpfx)dlfcn/libdl.so
+# $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
+# since otherwise libpthread.so comes before libc.so when linking.
+$(addprefix $(objpfx), $(tests-reverse)): \
+  $(objpfx)../libc.so $(objpfx)libpthread.so \
+  $(objpfx)libpthread_nonshared.a
+$(objpfx)../libc.so: $(common-objpfx)libc.so ;
+$(addprefix $(objpfx),$(tests-static) $(xtests-static)): $(objpfx)libpthread.a
+
+$(objpfx)tst-atfork2.out: $(objpfx)tst-atfork2mod.so
+else
+$(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
+endif
+
+ifeq ($(build-shared),yes)
+vpath pt-initfini.c $(sysdirs)
+
+$(objpfx)pt-initfini.s: pt-initfini.c
+	$(compile.c) -S $(CFLAGS-pt-initfini.s) -finhibit-size-directive \
+		$(patsubst -f%,-fno-%,$(exceptions)) -o $@
+
+$(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0
+	$(make-test-out) 2>&1 | cmp - tst-cleanup0.expect >& $@
+
+# We only have one kind of startup code files.  Static binaries and
+# shared libraries are build using the PIC version.
+$(objpfx)crti.S: $(objpfx)pt-initfini.s
+	sed -n -e '1,/@HEADER_ENDS/p' \
+	       -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
+	       -e '/@TRAILER_BEGINS/,$$p' $< > $@
+$(objpfx)crtn.S: $(objpfx)pt-initfini.s
+	sed -n -e '1,/@HEADER_ENDS/p' \
+	       -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
+	       -e '/@TRAILER_BEGINS/,$$p' $< > $@
+
+$(objpfx)defs.h: $(objpfx)pt-initfini.s
+	sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
+		$(AWK) -f ../csu/defs.awk > $@
+
+$(objpfx)crti.o: $(objpfx)crti.S $(objpfx)defs.h
+	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
+
+$(objpfx)crtn.o: $(objpfx)crtn.S $(objpfx)defs.h
+	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
+
+ifneq ($(multidir),.)
+$(objpfx)$(multidir)/crti.o: $(objpfx)crti.o $(objpfx)$(multidir)/
+	ln -f $< $@
+
+$(objpfx)$(multidir)/crtn.o: $(objpfx)crtn.o $(objpfx)$(multidir)/
+	ln -f $< $@
+endif
+
+generated += crti.S crtn.S defs.h pt-initfini.s  libpthread_nonshared.a \
+	     multidir.mk tst-atfork2.mtrace tst-cancel-wrappers.out \
+	     tst-tls6.out
+
+generated += $(objpfx)tst-atfork2.mtrace \
+	     $(addsuffix .so,$(strip $(modules-names)))
+
+$(objpfx)version.d: $(objpfx)banner.h
+$(objpfx)version.os: $(objpfx)banner.h
+$(objpfx)banner.h: Banner
+	sed 's/\(.*\)/"\1\\n"/' $< > $@
+generated += banner.h
+# Give libpthread.so an entry point and make it directly runnable itself.
+LDFLAGS-pthread.so += -e __nptl_main
+endif
+
+ifeq (no,$(cross-compiling))
+ifeq (yes,$(build-shared))
+tests: $(objpfx)tst-cancel-wrappers.out
+$(objpfx)tst-cancel-wrappers.out: tst-cancel-wrappers.sh
+	$(SHELL) $< $(common-objpfx)libc_pic.a \
+		    $(common-objpfx)libc.a \
+		    $(objpfx)libpthread_pic.a \
+		    $(objpfx)libpthread.a > $@
+endif
+endif
+
+tst-exec4-ARGS = $(built-program-cmd)
+
+$(objpfx)tst-execstack: $(libdl)
+$(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
+LDFLAGS-tst-execstack = -Wl,-z,noexecstack
+
+$(objpfx)tst-fini1mod.so: $(shared-thread-library)
+
+tst-stackguard1-ARGS = --command "$(built-program-cmd) --child"
+tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
+
+# The tests here better do not run in parallel
+ifneq ($(filter %tests,$(MAKECMDGOALS)),)
+.NOTPARALLEL:
+endif
diff -Naur glibc-2.8.orig/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.8/sysdeps/sparc/sparc32/sparcv9/Makefile
--- glibc-2.8.orig/sysdeps/sparc/sparc32/sparcv9/Makefile	2008-11-24 14:14:24.000000000 -0500
+++ glibc-2.8/sysdeps/sparc/sparc32/sparcv9/Makefile	2008-11-24 14:14:26.000000000 -0500
@@ -10,4 +10,4 @@
 ASFLAGS-.op += -Wa,-Av9a
 ASFLAGS-.og += -Wa,-Av9a
 ASFLAGS-.ob += -Wa,-Av9a
-ASFLAGS-.oS += -Wa,-Av9a
+ASFLAGS-.oST += -Wa,-Av9a
