From 9634cf9d4f30861dbf3ee057a1219227d8c8f19d Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 16 Dec 2002 20:52:36 +0000 Subject: [PATCH] Update. 2002-12-16 Jakub Jelinek * sysdeps/unix/sysv/linux/i386/socket.S: Use CENABLE and CDISABLE macros instead of doing the calls directly. * sysdeps/unix/make-syscalls.sh: Add ptw-*.$o target name to rules. * Makerules ($(+sysdir_pfx)sysd-rules): Emit rules for ptw-% targets. 2002-12-16 Jakub Jelinek * sysdeps/i386/fpu/bits/mathinline.h: Backout last change. * sysdeps/ieee754/bits/nan.h: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (__syscall_open, __syscall_wait4, __syscall_ioctl, __syscall_write): Add. --- ChangeLog | 16 + Makerules | 2544 ++++++++++---------- nptl/ChangeLog | 41 + nptl/Makefile | 15 +- nptl/libc-cancellation.c | 4 + nptl/pt-accept.c | 37 - nptl/pt-close.c | 42 - nptl/pt-connect.c | 38 - nptl/pt-fcntl.c | 53 - nptl/pt-fsync.c | 41 - nptl/pt-lseek.c | 42 - nptl/pt-lseek64.c | 37 - nptl/pt-msgrcv.c | 37 - nptl/pt-msgsnd.c | 43 - nptl/pt-msync.c | 41 - nptl/pt-nanosleep.c | 42 - nptl/pt-open.c | 51 - nptl/pt-open64.c | 52 - nptl/pt-pause.c | 37 - nptl/pt-pread.c | 37 - nptl/pt-pread64.c | 38 - nptl/pt-pwrite.c | 37 - nptl/pt-pwrite64.c | 38 - nptl/pt-read.c | 42 - nptl/pt-recv.c | 37 - nptl/pt-recvfrom.c | 38 - nptl/pt-recvmsg.c | 37 - nptl/pt-send.c | 38 - nptl/pt-sendmsg.c | 37 - nptl/pt-sendto.c | 38 - nptl/pt-sigtimedwait.c | 43 - nptl/pt-sigwait.c | 58 - nptl/pt-tcdrain.c | 37 - nptl/pt-wait.c | 38 - nptl/pt-waitpid.c | 37 - nptl/pt-write.c | 42 - nptl/pthreadP.h | 12 +- sysdeps/unix/make-syscalls.sh | 1 + sysdeps/unix/sysv/linux/i386/socket.S | 4 +- sysdeps/unix/sysv/linux/ia64/syscalls.list | 4 + 40 files changed, 1364 insertions(+), 2542 deletions(-) delete mode 100644 nptl/pt-accept.c delete mode 100644 nptl/pt-close.c delete mode 100644 nptl/pt-connect.c delete mode 100644 nptl/pt-fcntl.c delete mode 100644 nptl/pt-fsync.c delete mode 100644 nptl/pt-lseek.c delete mode 100644 nptl/pt-lseek64.c delete mode 100644 nptl/pt-msgrcv.c delete mode 100644 nptl/pt-msgsnd.c delete mode 100644 nptl/pt-msync.c delete mode 100644 nptl/pt-nanosleep.c delete mode 100644 nptl/pt-open.c delete mode 100644 nptl/pt-open64.c delete mode 100644 nptl/pt-pause.c delete mode 100644 nptl/pt-pread.c delete mode 100644 nptl/pt-pread64.c delete mode 100644 nptl/pt-pwrite.c delete mode 100644 nptl/pt-pwrite64.c delete mode 100644 nptl/pt-read.c delete mode 100644 nptl/pt-recv.c delete mode 100644 nptl/pt-recvfrom.c delete mode 100644 nptl/pt-recvmsg.c delete mode 100644 nptl/pt-send.c delete mode 100644 nptl/pt-sendmsg.c delete mode 100644 nptl/pt-sendto.c delete mode 100644 nptl/pt-sigtimedwait.c delete mode 100644 nptl/pt-sigwait.c delete mode 100644 nptl/pt-tcdrain.c delete mode 100644 nptl/pt-wait.c delete mode 100644 nptl/pt-waitpid.c delete mode 100644 nptl/pt-write.c diff --git a/ChangeLog b/ChangeLog index bd7c21328d..710832543c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2002-12-16 Jakub Jelinek + + * sysdeps/unix/sysv/linux/i386/socket.S: Use CENABLE and CDISABLE + macros instead of doing the calls directly. + * sysdeps/unix/make-syscalls.sh: Add ptw-*.$o target name to rules. + * Makerules ($(+sysdir_pfx)sysd-rules): Emit rules for ptw-% + targets. + +2002-12-16 Jakub Jelinek + + * sysdeps/i386/fpu/bits/mathinline.h: Backout last change. + * sysdeps/ieee754/bits/nan.h: Likewise. + + * sysdeps/unix/sysv/linux/ia64/syscalls.list (__syscall_open, + __syscall_wait4, __syscall_ioctl, __syscall_write): Add. + 2002-12-16 Roland McGrath * sunrpc/xdr_mem.c (xdrmem_inline): Fix argument type. diff --git a/Makerules b/Makerules index 5329de1b8c..d4e75c88cc 100644 --- a/Makerules +++ b/Makerules @@ -1,1266 +1,1278 @@ -# Copyright (C) 1991-1999,2000,01,02 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 - -# `configure' writes a definition of `config-sysdirs' in `config.make'. -sysdirs = $(strip $(full_config_sysdirs)) - -+sysdir_pfx = $(common-objpfx) - -export sysdirs := $(sysdirs) - -+sysdep_dirs := $(full_config_sysdirs) -ifdef objdir -+sysdep_dirs := $(objdir) $(+sysdep_dirs) -endif - -# Add -I switches to get the right sysdep directories. -# `+includes' in Makeconfig references $(+sysdep-includes). -+sysdep-includes := $(addprefix -I,$(+sysdep_dirs)) - -# 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 $(full_config_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 - -# When we have no deps pass doing it, then make sure the subdirectory -# for object files gets created. -ifdef no_deps -ifdef 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 - -# 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. -$(common-objpfx)%.make: $(..)%.make.c $(..)Makerules - rm -f $@T $@.dT - (echo '# Generated from $*.make.c by Makerules.'; \ - SUNPRO_DEPENDENCIES='$@.dT $$(common-objpfx)$*.make' \ - $(CC) $(CFLAGS) $(CPPFLAGS) -E $< \ - | sed -n '/@@@/{s/@@@[ ]*\(.*\)@@@/\1/;s/[ ]*$$//p;}'; \ - echo 'common-generated += $(@F)'; \ - cat $@.dT; rm -f $@.dT) > $@T - mv -f $@T $@ - -# 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. - -# When making the list of .d files to include, we can't know which ones -# have source in .s files, and thus do not in fact need a .d file. -# So we must define rules to make .d files for .s files. -define make-dummy-dep -$(addprefix ln $(common-objpfx)dummy.d ,$(filter-out $(wildcard $@),$@)) -endef -$(common-objpfx)dummy.d: - echo '# .s files cannot contain includes, so they need no deps.' > $@ - -# It matters that this set of rules, for compiling from sources in -# the current directory (the $srcdir/$subdir) come before the -# generated sysdep rules in included from sysd-rules below. When -# compiling in the source tree, generated sources go into the current -# directory, and those should be chosen before any sources in sysdeps. -define o-iterator-doit -$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S) -endef -object-suffixes-left := $(all-object-suffixes) -include $(o-iterator) -$(objpfx)%.d: %.S $(before-compile); $(+make-deps) - -define o-iterator-doit -$(objpfx)%$o: %.s $(before-compile); $$(compile-command.s) -endef -object-suffixes-left := $(all-object-suffixes) -include $(o-iterator) -$(objpfx)%.d: %.s $(common-objpfx)dummy.d; $(make-dummy-dep) - -define o-iterator-doit -$(objpfx)%$o: %.c $(before-compile); $$(compile-command.c) -endef -object-suffixes-left := $(all-object-suffixes) -include $(o-iterator) -$(objpfx)%.d: %.c $(before-compile); $(+make-deps) - -# 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) -$(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps) - -define o-iterator-doit -$(objpfx)%$o: $(objpfx)%.s $(before-compile); $$(compile-command.s) -endef -object-suffixes-left := $(all-object-suffixes) -include $(o-iterator) -$(objpfx)%.d: $(objpfx)%.s $(common-objpfx)dummy.d; $(make-dummy-dep) - -define o-iterator-doit -$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c) -endef -object-suffixes-left := $(all-object-suffixes) -include $(o-iterator) -$(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps) -endif - -# 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 open-check-inhibit-asm -case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) : ;; *) -endef -close-check-inhibit-asm = ;; esac ; -endif - --include $(+sysdir_pfx)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 -$(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \ - $(wildcard $(foreach dir,$(sysdirs),\ - $(dir)/Makefile))\ - $(sysd-rules-force) - -@rm -f $@T - (echo 'sysd-rules-sysdirs := $(config-sysdirs)'; \ - for dir in $(config-sysdirs:%='$$(..)%'); do \ - for o in $(all-object-suffixes); do \ - $(open-check-inhibit-asm) \ - echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile); \ - \$$(compile-command.S)"; \ - echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile); \ - \$$(compile-command.s)"; \ - echo "\$$(objpfx)rtld-%$$o: $$dir/%.S \$$(before-compile); \ - \$$(compile-command.S)"; \ - echo "\$$(objpfx)rtld-%$$o: $$dir/%.s \$$(before-compile); \ - \$$(compile-command.s)"; \ - $(close-check-inhibit-asm) \ - echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile); \ - \$$(compile-command.c)"; \ - echo "\$$(objpfx)rtld-%$$o: $$dir/%.c \$$(before-compile); \ - \$$(compile-command.c)"; \ - done; \ - $(open-check-inhibit-asm) \ - echo "\$$(objpfx)%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \ - \$$(make-dummy-dep)"; \ - echo "\$$(objpfx)rtld-%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \ - \$$(make-dummy-dep)"; \ - echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \ - \$$(+make-deps)"; \ - echo "\$$(objpfx)rtld-%.d: $$dir/%.S \$$(before-compile); \ - \$$(+make-deps)"; \ - $(close-check-inhibit-asm) \ - echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \ - \$$(+make-deps)"; \ - echo "\$$(objpfx)rtld-%.d: $$dir/%.c \$$(before-compile); \ - \$$(+make-deps)"; \ - echo "\$$(objpfx)m_%.S: $$dir/s_%.S; \$$(+make-include-of-dep)"; \ - echo "\$$(objpfx)m_%.c: $$dir/s_%.c; \$$(+make-include-of-dep)"; \ - 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 - -# This is used by the m_%.[Sc] pattern rules in sysd-rules. -define +make-include-of-dep -echo '#include <$<>' > $@T -mv -f $@T $@ -endef - -# 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),$(all-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 lib version setname; do \ - 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 $(all-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 = $(all-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 - - -ifndef compile-command.S -compile-command.S = $(compile.S) $(OUTPUT_OPTION) -endif -ifndef compile-command.s -compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION) -endif -ifndef compile-command.c -compile-command.c = $(compile.c) $(OUTPUT_OPTION) -endif - -# GCC can grok options after the file name, and it looks nicer that way. -compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS) -compile.S = \ - $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@)) -COMPILE.S = \ - $(CC) -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@)) -COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS) - -# If we want to generate MD5 checksums for the sources do this now. -ifeq ($(md5),yes) -generate-md5 = ; rm -f $(@:.d=.md5); \ -$(CC) -E $< $(CFLAGS) $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \ -sed '/^\#/d;/^[[:space:]]*$$/d' | md5sum > $(@:.d=.md5) -else -generate-md5 = -endif - -# 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 = $(asm-CPPFLAGS) -define +make-deps -$(make-target-directory) -$(+mkdep) $< $(if $(filter %.c,$<),$(CFLAGS)) \ - $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | sed \ --e 's,$(subst .,\.,$*)\.o,$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \ -$(sed-remove-objpfx) > $(@:.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) $(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 -define build-shlib -$(build-shlib-helper) \ - -o $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \ - $(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \ - sed -e '/^=========/,/^=========/!d;/^=========/d' \ - -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \ - $(LDSEDCMD-$(@F:lib%.so=%).so) > $@.lds -rm -f $@.new -$(build-shlib-helper) -o $@ -T $@.lds \ - $(csu-objpfx)abi-note.o $(build-shlib-objlist) -rm -f $@.lds -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) \ - -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 $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \ - $(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \ - sed -e '/^=========/,/^=========/!d;/^=========/d' \ - -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \ - > $@.lds -rm -f $@.new -$(build-module-helper) -o $@ -T $@.lds \ - $(csu-objpfx)abi-note.o $(build-module-objlist) -rm -f $@.lds -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 $(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 $(gnulib). -LDLIBS-c.so += $(gnulib) -# Give libc.so an entry point and make it directly runnable itself. -LDFLAGS-c.so += -e __libc_main -# Force the backward compatibility EH functions to be linked. -LDFLAGS-c.so += -u __register_frame -# 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 $^ -LDSEDCMD-c.so = -e 's/^.*\*(\.dynbss).*$$/& __start___libc_freeres_ptrs = .; *(__libc_freeres_ptrs) __stop___libc_freeres_ptrs = .;/' -# 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 - $(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 - -+depfiles := $(sources:.c=.d) \ - $(patsubst %.o,%.d,$(filter %.o,$(extra-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))) - -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 /. - mkdir $(@:%/=%) - -# 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 -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) 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)) - -install-lib-nosubdir: $(install-lib.so-versioned:%=$(inst_libdir)/%) \ - $(install-lib.so-unversioned:%=$(inst_slibdir)/%) - -# 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 $(> $(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) $( 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))'\ - ')' \ - ) > $@.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 := $(versioned) -include $(o-iterator) - -# 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,%,$( $@T - mv -f $@T $@ - -%.dynsym: %.so - $(OBJDUMP) --dynamic-syms $< > $@T - mv -f $@T $@ - -tests: $(patsubst %.so,$(objpfx)%.symlist,$(install-lib.so-versioned)) -generated += $(install-lib.so-versioned:.so=.symlist) - -ifeq ($(subdir),elf) -tests: $(common-objpfx)libc.symlist -common-generated += libc.symlist -endif -endif - -.PHONY: TAGS -TAGS: $(objpfx)distinfo $(..)MakeTAGS - $(MAKE) $(addprefix -f ,$^) $@ - -$(..)po/%.pot: $(objpfx)distinfo $(..)MakeTAGS FORCE - $(MAKE) $(addprefix -f ,$(filter-out FORCE,$^)) $@ -FORCE: - - -.PHONY: echo-headers -echo-headers: - @echo $(headers) - - -# 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) $(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)) $(+depfiles) - -rm -f $(objpfx)rtld-*.d - -rm -fr $(addprefix $(objpfx),$(generated-dirs)) - -rm -f $(addprefix $(common-objpfx),$(common-generated)) - -rm -f $(objpfx)distinfo - -# 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 . 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 -s = $(sysdep_dir)/generic -$(objpfx)stubs: $(+depfiles) -# Use /dev/null since `...` might expand to empty. - (s=`cd $s && $(PWD_P)`; \ - $(patsubst %/,cd % &&,$(objpfx)) \ - sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \ - `sed -n -e '\@ $s/[^ ]*\.c@{; s@^.* $s/\([^ ]*\.c\).*$$@'"$$s"'/\1@; h; }' \ - -e '/stub-tag\.h/{; g; p; }' \ - $(patsubst $(objpfx)%,%,$^) /dev/null` \ - /dev/null) > $@T - mv -f $@T $@ - -# Make the distribution tar file. - -.PHONY: dist -dist: $(objpfx)distinfo $(..)Make-dist - $(MAKE) -f $< -f $(word 2,$^) $(Make-dist-args) - -# Avoid depending on source files found in sysdeps dirs, -# because the references affect implicit rule selection. -dist: $(filter-out %.c %.S %.s,$(distribute)) - -# We used to simply export all these variables, but that frequently made the -# environment get too large. Instead, we write all the information into -# a generated makefile fragment `distinfo', and then include it with -f in -# the sub-make that makes the distribution (above). -$(objpfx)distinfo: Makefile $(..)Makerules \ - $(wildcard $(foreach dir,$(sysdirs),$(dir)/Makefile)) - $(make-target-directory) - $(distinfo-vars) - mv -f $@.new $@ -.PHONY: subdir_distinfo -subdir_distinfo: $(objpfx)distinfo - -define distinfo-vars -rm -f $@.new -echo > $@.new 'subdir := $(subdir)' -$(foreach var,subdir-dirs sources elided-routines sysdep_routines \ - headers sysdep_headers distribute dont_distribute generated \ - others tests xtests test-srcs extra-libs versioned \ - $(extra-libs:%=%-routines) \ - $(addprefix install-,lib lib.so data bin bin-script sbin others), -echo >> $@.new '$(subdir)-$(var) := $($(var))' -echo >> $@.new '$(var) = $$($(subdir)-$(var))') -endef - -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: +# Copyright (C) 1991-1999,2000,01,02 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 + +# `configure' writes a definition of `config-sysdirs' in `config.make'. +sysdirs = $(strip $(full_config_sysdirs)) + ++sysdir_pfx = $(common-objpfx) + +export sysdirs := $(sysdirs) + ++sysdep_dirs := $(full_config_sysdirs) +ifdef objdir ++sysdep_dirs := $(objdir) $(+sysdep_dirs) +endif + +# Add -I switches to get the right sysdep directories. +# `+includes' in Makeconfig references $(+sysdep-includes). ++sysdep-includes := $(addprefix -I,$(+sysdep_dirs)) + +# 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 $(full_config_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 + +# When we have no deps pass doing it, then make sure the subdirectory +# for object files gets created. +ifdef no_deps +ifdef 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 + +# 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. +$(common-objpfx)%.make: $(..)%.make.c $(..)Makerules + rm -f $@T $@.dT + (echo '# Generated from $*.make.c by Makerules.'; \ + SUNPRO_DEPENDENCIES='$@.dT $$(common-objpfx)$*.make' \ + $(CC) $(CFLAGS) $(CPPFLAGS) -E $< \ + | sed -n '/@@@/{s/@@@[ ]*\(.*\)@@@/\1/;s/[ ]*$$//p;}'; \ + echo 'common-generated += $(@F)'; \ + cat $@.dT; rm -f $@.dT) > $@T + mv -f $@T $@ + +# 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. + +# When making the list of .d files to include, we can't know which ones +# have source in .s files, and thus do not in fact need a .d file. +# So we must define rules to make .d files for .s files. +define make-dummy-dep +$(addprefix ln $(common-objpfx)dummy.d ,$(filter-out $(wildcard $@),$@)) +endef +$(common-objpfx)dummy.d: + echo '# .s files cannot contain includes, so they need no deps.' > $@ + +# It matters that this set of rules, for compiling from sources in +# the current directory (the $srcdir/$subdir) come before the +# generated sysdep rules in included from sysd-rules below. When +# compiling in the source tree, generated sources go into the current +# directory, and those should be chosen before any sources in sysdeps. +define o-iterator-doit +$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) +$(objpfx)%.d: %.S $(before-compile); $(+make-deps) + +define o-iterator-doit +$(objpfx)%$o: %.s $(before-compile); $$(compile-command.s) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) +$(objpfx)%.d: %.s $(common-objpfx)dummy.d; $(make-dummy-dep) + +define o-iterator-doit +$(objpfx)%$o: %.c $(before-compile); $$(compile-command.c) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) +$(objpfx)%.d: %.c $(before-compile); $(+make-deps) + +# 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) +$(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps) + +define o-iterator-doit +$(objpfx)%$o: $(objpfx)%.s $(before-compile); $$(compile-command.s) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) +$(objpfx)%.d: $(objpfx)%.s $(common-objpfx)dummy.d; $(make-dummy-dep) + +define o-iterator-doit +$(objpfx)%$o: $(objpfx)%.c $(before-compile); $$(compile-command.c) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) +$(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps) +endif + +# 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 open-check-inhibit-asm +case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) : ;; *) +endef +close-check-inhibit-asm = ;; esac ; +endif + +-include $(+sysdir_pfx)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 +$(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \ + $(wildcard $(foreach dir,$(sysdirs),\ + $(dir)/Makefile))\ + $(sysd-rules-force) + -@rm -f $@T + (echo 'sysd-rules-sysdirs := $(config-sysdirs)'; \ + for dir in $(config-sysdirs:%='$$(..)%'); do \ + for o in $(all-object-suffixes); do \ + $(open-check-inhibit-asm) \ + echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile); \ + \$$(compile-command.S)"; \ + echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile); \ + \$$(compile-command.s)"; \ + echo "\$$(objpfx)rtld-%$$o: $$dir/%.S \$$(before-compile); \ + \$$(compile-command.S)"; \ + echo "\$$(objpfx)rtld-%$$o: $$dir/%.s \$$(before-compile); \ + \$$(compile-command.s)"; \ + echo "\$$(objpfx)ptw-%$$o: $$dir/%.S \$$(before-compile); \ + \$$(compile-command.S)"; \ + echo "\$$(objpfx)ptw-%$$o: $$dir/%.s \$$(before-compile); \ + \$$(compile-command.s)"; \ + $(close-check-inhibit-asm) \ + echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile); \ + \$$(compile-command.c)"; \ + echo "\$$(objpfx)rtld-%$$o: $$dir/%.c \$$(before-compile); \ + \$$(compile-command.c)"; \ + echo "\$$(objpfx)ptw-%$$o: $$dir/%.c \$$(before-compile); \ + \$$(compile-command.c)"; \ + done; \ + $(open-check-inhibit-asm) \ + echo "\$$(objpfx)%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \ + \$$(make-dummy-dep)"; \ + echo "\$$(objpfx)rtld-%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \ + \$$(make-dummy-dep)"; \ + echo "\$$(objpfx)ptw-%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \ + \$$(make-dummy-dep)"; \ + echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \ + \$$(+make-deps)"; \ + echo "\$$(objpfx)rtld-%.d: $$dir/%.S \$$(before-compile); \ + \$$(+make-deps)"; \ + echo "\$$(objpfx)ptw-%.d: $$dir/%.S \$$(before-compile); \ + \$$(+make-deps)"; \ + $(close-check-inhibit-asm) \ + echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \ + \$$(+make-deps)"; \ + echo "\$$(objpfx)rtld-%.d: $$dir/%.c \$$(before-compile); \ + \$$(+make-deps)"; \ + echo "\$$(objpfx)ptw-%.d: $$dir/%.c \$$(before-compile); \ + \$$(+make-deps)"; \ + echo "\$$(objpfx)m_%.S: $$dir/s_%.S; \$$(+make-include-of-dep)"; \ + echo "\$$(objpfx)m_%.c: $$dir/s_%.c; \$$(+make-include-of-dep)"; \ + 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 + +# This is used by the m_%.[Sc] pattern rules in sysd-rules. +define +make-include-of-dep +echo '#include <$<>' > $@T +mv -f $@T $@ +endef + +# 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),$(all-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 lib version setname; do \ + 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 $(all-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 = $(all-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 + + +ifndef compile-command.S +compile-command.S = $(compile.S) $(OUTPUT_OPTION) +endif +ifndef compile-command.s +compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION) +endif +ifndef compile-command.c +compile-command.c = $(compile.c) $(OUTPUT_OPTION) +endif + +# GCC can grok options after the file name, and it looks nicer that way. +compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS) +compile.S = \ + $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@)) +COMPILE.S = \ + $(CC) -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@)) +COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS) + +# If we want to generate MD5 checksums for the sources do this now. +ifeq ($(md5),yes) +generate-md5 = ; rm -f $(@:.d=.md5); \ +$(CC) -E $< $(CFLAGS) $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \ +sed '/^\#/d;/^[[:space:]]*$$/d' | md5sum > $(@:.d=.md5) +else +generate-md5 = +endif + +# 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 = $(asm-CPPFLAGS) +define +make-deps +$(make-target-directory) +$(+mkdep) $< $(if $(filter %.c,$<),$(CFLAGS)) \ + $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | sed \ +-e 's,$(subst .,\.,$*)\.o,$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \ +$(sed-remove-objpfx) > $(@:.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) $(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 +define build-shlib +$(build-shlib-helper) \ + -o $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \ + $(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \ + sed -e '/^=========/,/^=========/!d;/^=========/d' \ + -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \ + $(LDSEDCMD-$(@F:lib%.so=%).so) > $@.lds +rm -f $@.new +$(build-shlib-helper) -o $@ -T $@.lds \ + $(csu-objpfx)abi-note.o $(build-shlib-objlist) +rm -f $@.lds +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) \ + -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 $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \ + $(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \ + sed -e '/^=========/,/^=========/!d;/^=========/d' \ + -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \ + > $@.lds +rm -f $@.new +$(build-module-helper) -o $@ -T $@.lds \ + $(csu-objpfx)abi-note.o $(build-module-objlist) +rm -f $@.lds +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 $(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 $(gnulib). +LDLIBS-c.so += $(gnulib) +# Give libc.so an entry point and make it directly runnable itself. +LDFLAGS-c.so += -e __libc_main +# Force the backward compatibility EH functions to be linked. +LDFLAGS-c.so += -u __register_frame +# 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 $^ +LDSEDCMD-c.so = -e 's/^.*\*(\.dynbss).*$$/& __start___libc_freeres_ptrs = .; *(__libc_freeres_ptrs) __stop___libc_freeres_ptrs = .;/' +# 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 + $(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 + ++depfiles := $(sources:.c=.d) \ + $(patsubst %.o,%.d,$(filter %.o,$(extra-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))) + +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 /. + mkdir $(@:%/=%) + +# 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 +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) 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)) + +install-lib-nosubdir: $(install-lib.so-versioned:%=$(inst_libdir)/%) \ + $(install-lib.so-unversioned:%=$(inst_slibdir)/%) + +# 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 $(> $(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) $( 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))'\ + ')' \ + ) > $@.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 := $(versioned) +include $(o-iterator) + +# 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,%,$( $@T + mv -f $@T $@ + +%.dynsym: %.so + $(OBJDUMP) --dynamic-syms $< > $@T + mv -f $@T $@ + +tests: $(patsubst %.so,$(objpfx)%.symlist,$(install-lib.so-versioned)) +generated += $(install-lib.so-versioned:.so=.symlist) + +ifeq ($(subdir),elf) +tests: $(common-objpfx)libc.symlist +common-generated += libc.symlist +endif +endif + +.PHONY: TAGS +TAGS: $(objpfx)distinfo $(..)MakeTAGS + $(MAKE) $(addprefix -f ,$^) $@ + +$(..)po/%.pot: $(objpfx)distinfo $(..)MakeTAGS FORCE + $(MAKE) $(addprefix -f ,$(filter-out FORCE,$^)) $@ +FORCE: + + +.PHONY: echo-headers +echo-headers: + @echo $(headers) + + +# 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) $(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)) $(+depfiles) + -rm -f $(objpfx)rtld-*.d + -rm -fr $(addprefix $(objpfx),$(generated-dirs)) + -rm -f $(addprefix $(common-objpfx),$(common-generated)) + -rm -f $(objpfx)distinfo + +# 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 . 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 +s = $(sysdep_dir)/generic +$(objpfx)stubs: $(+depfiles) +# Use /dev/null since `...` might expand to empty. + (s=`cd $s && $(PWD_P)`; \ + $(patsubst %/,cd % &&,$(objpfx)) \ + sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \ + `sed -n -e '\@ $s/[^ ]*\.c@{; s@^.* $s/\([^ ]*\.c\).*$$@'"$$s"'/\1@; h; }' \ + -e '/stub-tag\.h/{; g; p; }' \ + $(patsubst $(objpfx)%,%,$^) /dev/null` \ + /dev/null) > $@T + mv -f $@T $@ + +# Make the distribution tar file. + +.PHONY: dist +dist: $(objpfx)distinfo $(..)Make-dist + $(MAKE) -f $< -f $(word 2,$^) $(Make-dist-args) + +# Avoid depending on source files found in sysdeps dirs, +# because the references affect implicit rule selection. +dist: $(filter-out %.c %.S %.s,$(distribute)) + +# We used to simply export all these variables, but that frequently made the +# environment get too large. Instead, we write all the information into +# a generated makefile fragment `distinfo', and then include it with -f in +# the sub-make that makes the distribution (above). +$(objpfx)distinfo: Makefile $(..)Makerules \ + $(wildcard $(foreach dir,$(sysdirs),$(dir)/Makefile)) + $(make-target-directory) + $(distinfo-vars) + mv -f $@.new $@ +.PHONY: subdir_distinfo +subdir_distinfo: $(objpfx)distinfo + +define distinfo-vars +rm -f $@.new +echo > $@.new 'subdir := $(subdir)' +$(foreach var,subdir-dirs sources elided-routines sysdep_routines \ + headers sysdep_headers distribute dont_distribute generated \ + others tests xtests test-srcs extra-libs versioned \ + $(extra-libs:%=%-routines) \ + $(addprefix install-,lib lib.so data bin bin-script sbin others), +echo >> $@.new '$(subdir)-$(var) := $($(var))' +echo >> $@.new '$(var) = $$($(subdir)-$(var))') +endef + +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 --git a/nptl/ChangeLog b/nptl/ChangeLog index a291a07d57..49c94ee3b3 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,44 @@ +2002-12-16 Jakub Jelinek + + * libc-cancellation.c: Guard both function with + #if !defined NOT_IN_libc. + * Makefile (libpthread-routines): Use ptw-, not pt- prefix for the + automatically provided pthread wrappers. + * pthreadP.h (LIBC_CANCEL_ASYNC, LIBC_CANCEL_RESET): Define to + CANCEL_* if IS_IN_libpthread and to dummy versions if not in libc + nor in libpthread. + * pt-open.c: Removed. + * pt-fcntl.c: Removed. + * pt-fsync.c: Removed. + * pt-lseek.c: Removed. + * pt-msgrcv.c: Removed. + * pt-msgsnd.c: Removed. + * pt-msync.c: Removed. + * pt-nanosleep.c: Removed. + * pt-open64.c: Removed. + * pt-pause.c: Removed. + * pt-pread.c: Removed. + * pt-pread64.c: Removed. + * pt-pwrite.c: Removed. + * pt-pwrite64.c: Removed. + * pt-read.c: Removed. + * pt-recv.c: Removed. + * pt-recvfrom.c: Removed. + * pt-recvmsg.c: Removed. + * pt-send.c: Removed. + * pt-sendto.c: Removed. + * pt-sigtimedwait.c: Removed. + * pt-sigwait.c: Removed. + * pt-wait.c: Removed. + * pt-waitpid.c: Removed. + * pt-write.c: Removed. + * pt-accept.c: Removed. + * pt-close.c: Removed. + * pt-connect.c: Removed. + * pt-lseek64.c: Removed. + * pt-sendmsg.c: Removed. + * pt-tcdrain.c: Removed. + 2002-12-15 Ulrich Drepper * init.c (__pthread_initialize_minimal_internal): Renamed from diff --git a/nptl/Makefile b/nptl/Makefile index 409b9dec85..88f038deff 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -94,13 +94,14 @@ libpthread-routines = init events \ lowlevellock lowlevelmutex lowlevelcond lowlevelrwlock \ lowlevelsem \ pt-vfork \ - pt-write pt-read pt-close pt-fcntl pt-accept pt-connect \ - pt-recv pt-recvfrom pt-recvmsg pt-send pt-sendmsg \ - pt-sendto pt-fsync pt-lseek pt-lseek64 pt-msync \ - pt-nanosleep pt-open pt-open64 pt-pause pt-pread \ - pt-pread64 pt-pwrite pt-pwrite64 pt-tcdrain pt-system \ - pt-wait pt-waitpid pt-msgrcv pt-msgsnd pt-sigwait \ - pt-raise \ + 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 \ + pt-raise pt-system \ flockfile ftrylockfile funlockfile \ sigaction \ herrno res pt-allocrtsig \ diff --git a/nptl/libc-cancellation.c b/nptl/libc-cancellation.c index ae568cfa78..1db99ea18a 100644 --- a/nptl/libc-cancellation.c +++ b/nptl/libc-cancellation.c @@ -23,6 +23,8 @@ #include "atomic.h" +#if !defined NOT_IN_libc + /* The next two functions are similar to pthread_setcanceltype() but more specialized for the use in the cancelable functions like write(). They do not need to check parameters etc. */ @@ -82,3 +84,5 @@ __libc_disable_asynccancel (int oldtype) break; } } + +#endif diff --git a/nptl/pt-accept.c b/nptl/pt-accept.c deleted file mode 100644 index 1b25e9eff8..0000000000 --- a/nptl/pt-accept.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -int -accept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len) -{ - int oldtype = CANCEL_ASYNC (); - - int result = __libc_accept (fd, addr, addr_len); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-close.c b/nptl/pt-close.c deleted file mode 100644 index 0edde5ea5d..0000000000 --- a/nptl/pt-close.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -int -__close (int fd) -{ - int oldtype = CANCEL_ASYNC (); - -#ifdef INLINE_SYSCALL - int result = INLINE_SYSCALL (close, 1, fd); -#else - int result = __libc_close (fd); -#endif - - CANCEL_RESET (oldtype); - - return result; -} -strong_alias (__close, close) diff --git a/nptl/pt-connect.c b/nptl/pt-connect.c deleted file mode 100644 index 44d2e3ae21..0000000000 --- a/nptl/pt-connect.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -int -__connect (int fd, __CONST_SOCKADDR_ARG addr, socklen_t addr_len) -{ - int oldtype = CANCEL_ASYNC (); - - int result = __libc_connect (fd, addr, addr_len); - - CANCEL_RESET (oldtype); - - return result; -} -strong_alias (__connect, connect) diff --git a/nptl/pt-fcntl.c b/nptl/pt-fcntl.c deleted file mode 100644 index 7d4a92cea1..0000000000 --- a/nptl/pt-fcntl.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include -#include -#include "pthreadP.h" - - -int -__fcntl (int fd, int cmd, ...) -{ - int oldtype = 0; - va_list ap; - - if (cmd == F_SETLKW) - oldtype = CANCEL_ASYNC (); - - va_start (ap, cmd); - -#ifdef INLINE_SYSCALL - int result = INLINE_SYSCALL (fcntl64, 3, fd, cmd, va_arg (ap, long int)); -#else - int result = __libc_fcntl (fd, cmd, va_arg (ap, long int)); -#endif - - va_end (ap); - - if (cmd == F_SETLKW) - CANCEL_RESET (oldtype); - - return result; -} -strong_alias (__fcntl, fcntl) diff --git a/nptl/pt-fsync.c b/nptl/pt-fsync.c deleted file mode 100644 index 91fd266ed9..0000000000 --- a/nptl/pt-fsync.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -int -fsync (int fd) -{ - int oldtype = CANCEL_ASYNC (); - -#ifdef INLINE_SYSCALL - int result = INLINE_SYSCALL (fsync, 1, fd); -#else - int result = __libc_fsync (fd); -#endif - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-lseek.c b/nptl/pt-lseek.c deleted file mode 100644 index 9b530ea9e7..0000000000 --- a/nptl/pt-lseek.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -off_t -__lseek (int fd, off_t offset, int whence) -{ - int oldtype = CANCEL_ASYNC (); - -#ifdef INLINE_SYSCALL - off_t result = INLINE_SYSCALL (lseek, 3, fd, offset, whence); -#else - off_t result = __libc_lseek (fd, offset, whence); -#endif - - CANCEL_RESET (oldtype); - - return result; -} -strong_alias (__lseek, lseek) diff --git a/nptl/pt-lseek64.c b/nptl/pt-lseek64.c deleted file mode 100644 index bdedd6e1cf..0000000000 --- a/nptl/pt-lseek64.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -off64_t -lseek64 (int fd, off64_t offset, int whence) -{ - int oldtype = CANCEL_ASYNC (); - - off64_t result = __libc_lseek64 (fd, offset, whence); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-msgrcv.c b/nptl/pt-msgrcv.c deleted file mode 100644 index 383cefaa40..0000000000 --- a/nptl/pt-msgrcv.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -int -msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg) -{ - int oldtype = CANCEL_ASYNC (); - - int result = __libc_msgrcv (msqid, msgp, msgsz, msgtyp, msgflg); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-msgsnd.c b/nptl/pt-msgsnd.c deleted file mode 100644 index bc09779c2e..0000000000 --- a/nptl/pt-msgsnd.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include -#include "pthreadP.h" - - -int -msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg) -{ - int oldtype = CANCEL_ASYNC (); - -#if defined INLINE_SYSCALL && defined __NR_ipc - int result = INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz, - msgflg, (void *) msgp); -#else - int result = __libc_msgsnd (msqid, msgp, msgsz, msgflg); -#endif - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-msync.c b/nptl/pt-msync.c deleted file mode 100644 index 18f3eeb284..0000000000 --- a/nptl/pt-msync.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -int -msync (void *addr, size_t length, int flags) -{ - int oldtype = CANCEL_ASYNC (); - -#ifdef INLINE_SYSCALL - int result = INLINE_SYSCALL (msync, 3, addr, length, flags); -#else - int result = __libc_msync (addr, length, flags); -#endif - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-nanosleep.c b/nptl/pt-nanosleep.c deleted file mode 100644 index 91f111766a..0000000000 --- a/nptl/pt-nanosleep.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -int -__nanosleep (const struct timespec *requested_time, struct timespec *remaining) -{ - int oldtype = CANCEL_ASYNC (); - -#ifdef INLINE_SYSCALL - int result = INLINE_SYSCALL (nanosleep, 2, requested_time, remaining); -#else - int result = __libc_nanosleep (requested_time, remaining); -#endif - - CANCEL_RESET (oldtype); - - return result; -} -strong_alias (__nanosleep, nanosleep) diff --git a/nptl/pt-open.c b/nptl/pt-open.c deleted file mode 100644 index be790b8b90..0000000000 --- a/nptl/pt-open.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include -#include "pthreadP.h" - - -int -__open (const char *pathname, int flags, ...) -{ - va_list ap; - - va_start (ap, flags); - - int oldtype = CANCEL_ASYNC (); - -#ifdef INLINE_SYSCALL - int result = INLINE_SYSCALL (open, 3, pathname, flags, - va_arg (ap, __typeof ((mode_t) 0 + 0))); -#else - int result = __libc_open (pathname, flags, - va_arg (ap, __typeof ((mode_t) 0 + 0))); -#endif - - CANCEL_RESET (oldtype); - - va_end (ap); - - return result; -} -strong_alias (__open, open) diff --git a/nptl/pt-open64.c b/nptl/pt-open64.c deleted file mode 100644 index 27757f5ed4..0000000000 --- a/nptl/pt-open64.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include -#include -#include "pthreadP.h" - - -int -__open64 (const char *pathname, int flags, ...) -{ - va_list ap; - - va_start (ap, flags); - - int oldtype = CANCEL_ASYNC (); - -#if defined INLINE_SYSCALL && defined O_LARGEFILE - int result = INLINE_SYSCALL (open, 3, pathname, flags | O_LARGEFILE, - va_arg (ap, __typeof ((mode_t) 0 + 0))); -#else - int result = __libc_open64 (pathname, flags, - va_arg (ap, __typeof ((mode_t) 0 + 0))); -#endif - - CANCEL_RESET (oldtype); - - va_end (ap); - - return result; -} -strong_alias (__open64, open64) diff --git a/nptl/pt-pause.c b/nptl/pt-pause.c deleted file mode 100644 index bb878f0500..0000000000 --- a/nptl/pt-pause.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -int -pause (void) -{ - int oldtype = CANCEL_ASYNC (); - - int result = __libc_pause (); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-pread.c b/nptl/pt-pread.c deleted file mode 100644 index 6169ca8532..0000000000 --- a/nptl/pt-pread.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -pread (int fd, void *buf, size_t count, off_t offset) -{ - int oldtype = CANCEL_ASYNC (); - - ssize_t result = __libc_pread (fd, buf, count, offset); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-pread64.c b/nptl/pt-pread64.c deleted file mode 100644 index a80e3e0852..0000000000 --- a/nptl/pt-pread64.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -__pread64 (int fd, void *buf, size_t count, off64_t offset) -{ - int oldtype = CANCEL_ASYNC (); - - ssize_t result = __libc_pread64 (fd, buf, count, offset); - - CANCEL_RESET (oldtype); - - return result; -} -strong_alias (__pread64, pread64) diff --git a/nptl/pt-pwrite.c b/nptl/pt-pwrite.c deleted file mode 100644 index e3906a1868..0000000000 --- a/nptl/pt-pwrite.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -pwrite (int fd, const void *buf, size_t count, off_t offset) -{ - int oldtype = CANCEL_ASYNC (); - - ssize_t result = __libc_pwrite (fd, buf, count, offset); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-pwrite64.c b/nptl/pt-pwrite64.c deleted file mode 100644 index 18a9621220..0000000000 --- a/nptl/pt-pwrite64.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -__pwrite64 (int fd, const void *buf, size_t count, off64_t offset) -{ - int oldtype = CANCEL_ASYNC (); - - ssize_t result = __libc_pwrite64 (fd, buf, count, offset); - - CANCEL_RESET (oldtype); - - return result; -} -strong_alias (__pwrite64, pwrite64) diff --git a/nptl/pt-read.c b/nptl/pt-read.c deleted file mode 100644 index 7eaafa0cd6..0000000000 --- a/nptl/pt-read.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -__read (int fd, void *buf, size_t count) -{ - int oldtype = CANCEL_ASYNC (); - -#ifdef INLINE_SYSCALL - ssize_t result = INLINE_SYSCALL (read, 3, fd, buf, count); -#else - ssize_t result = __libc_read (fd, buf, count); -#endif - - CANCEL_RESET (oldtype); - - return result; -} -strong_alias (__read, read) diff --git a/nptl/pt-recv.c b/nptl/pt-recv.c deleted file mode 100644 index 1280447864..0000000000 --- a/nptl/pt-recv.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -recv (int fd, __ptr_t buf, size_t n, int flags) -{ - int oldtype = CANCEL_ASYNC (); - - ssize_t result = __libc_recv (fd, buf, n, flags); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-recvfrom.c b/nptl/pt-recvfrom.c deleted file mode 100644 index 27d0195297..0000000000 --- a/nptl/pt-recvfrom.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -recvfrom (int fd, __ptr_t buf, size_t n, int flags, __SOCKADDR_ARG addr, - socklen_t *addr_len) -{ - int oldtype = CANCEL_ASYNC (); - - ssize_t result = __libc_recvfrom (fd, buf, n, flags, addr, addr_len); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-recvmsg.c b/nptl/pt-recvmsg.c deleted file mode 100644 index e4f7dbfd39..0000000000 --- a/nptl/pt-recvmsg.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -recvmsg (int fd, struct msghdr *message, int flags) -{ - int oldtype = CANCEL_ASYNC (); - - ssize_t result = __libc_recvmsg (fd, message, flags); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-send.c b/nptl/pt-send.c deleted file mode 100644 index 5af725e36f..0000000000 --- a/nptl/pt-send.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -__send (int fd, const __ptr_t buf, size_t n, int flags) -{ - int oldtype = CANCEL_ASYNC (); - - ssize_t result = __libc_send (fd, buf, n, flags); - - CANCEL_RESET (oldtype); - - return result; -} -strong_alias (__send, send) diff --git a/nptl/pt-sendmsg.c b/nptl/pt-sendmsg.c deleted file mode 100644 index 8017f0d402..0000000000 --- a/nptl/pt-sendmsg.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -sendmsg (int fd, const struct msghdr *message, int flags) -{ - int oldtype = CANCEL_ASYNC (); - - ssize_t result = __libc_sendmsg (fd, message, flags); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-sendto.c b/nptl/pt-sendto.c deleted file mode 100644 index 1123bc41cb..0000000000 --- a/nptl/pt-sendto.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -sendto (int fd, const __ptr_t buf, size_t n, int flags, - __CONST_SOCKADDR_ARG addr, socklen_t addr_len) -{ - int oldtype = CANCEL_ASYNC (); - - ssize_t result = __libc_sendto (fd, buf, n, flags, addr, addr_len); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-sigtimedwait.c b/nptl/pt-sigtimedwait.c deleted file mode 100644 index f2a00d4c88..0000000000 --- a/nptl/pt-sigtimedwait.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -int -sigtimedwait (const sigset_t *set, siginfo_t *info, - const struct timespec *timeout) -{ - int oldtype = CANCEL_ASYNC (); - -#ifdef INLINE_SYSCALL - int result = INLINE_SYSCALL (rt_sigtimedwait, 4, set, info, timeout, - _NSIG / 8); -#else - int result = __sigtimedwait (set, info, timeout); -#endif - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-sigwait.c b/nptl/pt-sigwait.c deleted file mode 100644 index 88dca893b8..0000000000 --- a/nptl/pt-sigwait.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -int -sigwait (const sigset_t *set, int *sig) -{ - int oldtype = CANCEL_ASYNC (); - -#ifdef INTERNAL_SYSCALL - int result = INTERNAL_SYSCALL (rt_sigtimedwait, 4, set, NULL, NULL, - _NSIG / 8); - if (! INTERNAL_SYSCALL_ERROR_P (result)) - { - *sig = result; - result = 0; - } - else - result = INTERNAL_SYSCALL_ERRNO (result); -#elif defined INLINE_SYSCALL - int result = INLINE_SYSCALL (rt_sigtimedwait, 4, set, NULL, NULL, _NSIG / 8); - if (result != -1) - { - *sig = result; - result = 0; - } - else - result = errno; -#else - int result = __sigwait (set, sig); -#endif - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-tcdrain.c b/nptl/pt-tcdrain.c deleted file mode 100644 index ba1c4b77b4..0000000000 --- a/nptl/pt-tcdrain.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -int -tcdrain (int fd) -{ - int oldtype = CANCEL_ASYNC (); - - int result = __libc_tcdrain (fd); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-wait.c b/nptl/pt-wait.c deleted file mode 100644 index fa25f21343..0000000000 --- a/nptl/pt-wait.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -pid_t -__wait (__WAIT_STATUS_DEFN stat_loc) -{ - int oldtype = CANCEL_ASYNC (); - - pid_t result = __libc_wait (stat_loc); - - CANCEL_RESET (oldtype); - - return result; -} -strong_alias (__wait, wait) diff --git a/nptl/pt-waitpid.c b/nptl/pt-waitpid.c deleted file mode 100644 index 86fa30c4b4..0000000000 --- a/nptl/pt-waitpid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -pid_t -waitpid (pid_t pid, int *stat_loc, int options) -{ - int oldtype = CANCEL_ASYNC (); - - pid_t result = __libc_waitpid (pid, stat_loc, options); - - CANCEL_RESET (oldtype); - - return result; -} diff --git a/nptl/pt-write.c b/nptl/pt-write.c deleted file mode 100644 index c8856e0835..0000000000 --- a/nptl/pt-write.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2002. - - 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. */ - -#include -#include -#include -#include -#include "pthreadP.h" - - -ssize_t -__write (int fd, const void *buf, size_t count) -{ - int oldtype = CANCEL_ASYNC (); - -#ifdef INLINE_SYSCALL - ssize_t result = INLINE_SYSCALL (write, 3, fd, buf, count); -#else - ssize_t result = __libc_write (fd, buf, count); -#endif - - CANCEL_RESET (oldtype); - - return result; -} -strong_alias (__write, write) diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index e759e83062..c666387008 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -129,12 +129,20 @@ extern struct pthread_functions __libc_pthread_functions attribute_hidden; #define CANCEL_RESET(oldtype) \ __pthread_disable_asynccancel (oldtype) +#if !defined NOT_IN_libc /* Same as CANCEL_ASYNC, but for use in libc.so. */ -#define LIBC_CANCEL_ASYNC() \ +# define LIBC_CANCEL_ASYNC() \ __libc_enable_asynccancel () /* Same as CANCEL_RESET, but for use in libc.so. */ -#define LIBC_CANCEL_RESET(oldtype) \ +# define LIBC_CANCEL_RESET(oldtype) \ __libc_disable_asynccancel (oldtype) +#elif defined NOT_IN_libc && defined IS_IN_libpthread +# define LIBC_CANCEL_ASYNC() CANCEL_ASYNC () +# define LIBC_CANCEL_RESET(val) CANCEL_RESET (val) +#else +# define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */ +# define LIBC_CANCEL_RESET(val) ((void)(val)) /* Nothing, but evaluate it. */ +#endif /* This function is responsible for calling all registered cleanup diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh index 7b53651240..932f48d295 100644 --- a/sysdeps/unix/make-syscalls.sh +++ b/sysdeps/unix/make-syscalls.sh @@ -134,6 +134,7 @@ shared-only-routines += $file *) echo "\ \$(foreach o,\$(object-suffixes),\$(objpfx)$file\$o) \ +\$(foreach o,\$(object-suffixes),\$(objpfx)ptw-$file\$o) \ \$(objpfx)rtld-$file.os: \\" ;; esac diff --git a/sysdeps/unix/sysv/linux/i386/socket.S b/sysdeps/unix/sysv/linux/i386/socket.S index 866a67462d..ab4741b8d1 100644 --- a/sysdeps/unix/sysv/linux/i386/socket.S +++ b/sysdeps/unix/sysv/linux/i386/socket.S @@ -76,7 +76,7 @@ L(pseudo_end): 1: pushl %esi /* Enable asynchronous cancellation. */ - call __libc_enable_asynccancel /* No @plt */ + CENABLE movl %eax, %esi /* Save registers. */ @@ -93,7 +93,7 @@ L(pseudo_end): /* Restore the cancellation. */ xchgl %esi, %eax - call __libc_disable_asynccancel /* No @plt */ + CDISABLE /* Restore registers. */ movl %esi, %eax diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list index a18d5efd44..7c0f11f668 100644 --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list @@ -81,6 +81,10 @@ s_stat xstat stat i:sp __syscall_stat s_lstat lxstat lstat i:sp __syscall_lstat s_fstat fxstat fstat i:ip __syscall_fstat s_sysctl sysctl _sysctl i:p __syscall__sysctl +s_open open open i:siv __syscall_open +s_wait4 wait4 wait4 i:iWiP __syscall_wait4 +s_ioctl ioctl ioctl i:iiI __syscall_ioctl +s_write write write i:ibn __syscall_write # IA-64 specific getunwind EXTRA getunwind i:pi getunwind