summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog31
-rw-r--r--Makeconfig6
-rw-r--r--Makerules5
-rw-r--r--cppflags-iterator.mk2
-rw-r--r--extra-lib.mk16
-rw-r--r--locale/Makefile2
-rw-r--r--nscd/Makefile2
-rw-r--r--sunrpc/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h7
9 files changed, 56 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 124102b00e..603482dca4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2002-10-16  Roland McGrath  <roland@redhat.com>
+
+	* cppflags-iterator.mk (CPPFLAGS-$(cpp-src)): Variable removed.
+	instead of += to append, to be sure $(lib) gets expanded at defn time.
+	(libof-$(cpp-src)): New variable, define this instead.
+	* extra-lib.mk (cpp-srcs-left): Reduce duplication in include setup.
+	(lib): Don't use override.
+	(CPPFLAGS-$(lib)): New variable, put -D's here.
+	* Makeconfig (CPPFLAGS): Use basename fn for CPPFLAGS-basename.
+	Also add $(CPPFLAGS-LIB) before the file-specific flags, for each
+	LIB found by $(libof-*) for basename, target, or source.
+	* Makerules (CPPFLAGS-nonlib): New variable.
+	* nscd/Makefile (lib): Set to nonlib when using cppflags-iterator.mk.
+	* locale/Makefile (lib): Likewise.
+	* sunrpc/Makefile (lib): Likewise.
+
+	* sysdeps/unix/sysv/linux/fpathconf.c (LINUX_LINK_MAX): Move macro ...
+	* sysdeps/unix/sysv/linux/linux_fsinfo.h (LINUX_LINK_MAX): ... here.
+	* sysdeps/unix/sysv/linux/pathconf.h: New file.
+	(statfs_link_max): New function, guts from fpathconf.c.
+	* sysdeps/unix/sysv/linux/fpathconf.c: Rewritten using that.
+	* sysdeps/unix/sysv/linux/pathconf.c (__pathconf): Likewise.
+	* sysdeps/unix/sysv/linux/alpha/pathconf.c (__pathconf): Rewritten
+	to use the linux/pathconf.c code by #include rather than duplication.
+	* sysdeps/unix/sysv/linux/alpha/fpathconf.c (__pathconf): Likewise.
+
+2002-10-16  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (SYSCALL_ERROR_HANDLER):
+	Use __libc_errno only for libc itself.
+
 2002-10-16  Andreas Jaeger  <aj@suse.de>
 
 	* sysdeps/x86_64/_mcount.S: Fix off-by-1 error in argument access.
diff --git a/Makeconfig b/Makeconfig
index dd03ae803e..b6a1b4aeb1 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -632,8 +632,10 @@ libio-include = -I$(..)libio
 # it causes cpp to stop predefining __ASSEMBLER__.
 CPPFLAGS = $($(subdir)-CPPFLAGS) $(+includes) $(defines) \
 	   -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
-	   $(CPPFLAGS-$(suffix $@)) $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) \
-	   $(CPPFLAGS-$(patsubst %$(suffix $@),%,$(@F)))
+	   $(CPPFLAGS-$(suffix $@)) \
+	   $(foreach L,$(libof-$(basename $(@F))) $(libof-$<) $(libof-$(@F)),\
+		     $(CPPFLAGS-$L)) \
+	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
 override CFLAGS	= -std=gnu99 \
 		  $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
 		  $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
diff --git a/Makerules b/Makerules
index 3fa3f63a7f..d66feb5b75 100644
--- a/Makerules
+++ b/Makerules
@@ -1057,9 +1057,12 @@ xcheck: xtests
 all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others))
 ifneq (,$(all-nonlib))
 cpp-srcs-left = $(all-nonlib:=.c)
-lib := tests
+lib := nonlib
 include $(patsubst %,$(..)cppflags-iterator.mk,$(all-nonlib))
 endif
+
+# The include magic above causes those files to use this variable for flags.
+CPPFLAGS-nonlib = -DNOT_IN_libc=1
 
 .PHONY: TAGS
 TAGS: $(objpfx)distinfo $(..)MakeTAGS
diff --git a/cppflags-iterator.mk b/cppflags-iterator.mk
index 26db7b042e..d4e6375416 100644
--- a/cppflags-iterator.mk
+++ b/cppflags-iterator.mk
@@ -4,4 +4,4 @@
 cpp-src := $(firstword $(cpp-srcs-left))
 cpp-srcs-left := $(filter-out $(cpp-src),$(cpp-srcs-left))
 
-CPPFLAGS-$(cpp-src) += -DNOT_IN_libc=1 -DIS_IN_$(lib)=1
+libof-$(cpp-src) := $(lib)
diff --git a/extra-lib.mk b/extra-lib.mk
index d48f0faaa1..5428523e06 100644
--- a/extra-lib.mk
+++ b/extra-lib.mk
@@ -6,7 +6,7 @@
 # to be included in that library.  A sysdep Makefile can add to
 # $(lib)-sysdep_routines to include additional modules.
 
-override lib := $(firstword $(extra-libs-left))
+lib := $(firstword $(extra-libs-left))
 extra-libs-left := $(filter-out $(lib),$(extra-libs-left))
 
 object-suffixes-$(lib) := $(filter-out $($(lib)-inhibit-o),$(object-suffixes))
@@ -79,12 +79,10 @@ endif
 
 endif
 
-cpp-srcs-left = $(lib)-routines
-ifneq (,$($(lib)-routines))
-cpp-srcs-left = $($(lib)-routines)
-include $(patsubst %,$(..)cppflags-iterator.mk,$($(lib)-routines))
-endif
-ifneq (,$($(lib)-sysdep_routines))
-cpp-srcs-left = $($(lib)-sysdep_routines)
-include $(patsubst %,$(..)cppflags-iterator.mk,$($(lib)-sysdep_routines))
+# This will define `libof-ROUTINE := LIB' for each of the routines.
+cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines)
+ifneq (,$(cpp-srcs-left))
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
 endif
+
+CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1
diff --git a/locale/Makefile b/locale/Makefile
index ec47bde054..976926bb8e 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -104,7 +104,7 @@ CFLAGS-charmap-dir.c = -Wno-write-strings
 # This makes sure -DNOT_IN_libc is passed for all these modules.
 cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
 			        $(locale-modules) $(lib-modules))
-lib := locale_programs
+lib := nonlib
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
 
 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
diff --git a/nscd/Makefile b/nscd/Makefile
index 0bd320e402..e3c7af9c0a 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -55,7 +55,7 @@ include ../Rules
 
 # This makes sure -DNOT_IN_libc is passed for all these modules.
 cpp-srcs-left := $(nscd-modules:=.c)
-lib := nscd
+lib := nonlib
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
 
 $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index f80b190d14..9ee809ff21 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -132,7 +132,7 @@ $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \
 
 # This makes sure -DNOT_IN_libc is passed for all these modules.
 cpp-srcs-left := $(rpcgen-objs:.o=.c)
-lib := rpcgen
+lib := nonlib
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
 
 # Tell rpcgen where to find the C preprocessor.
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index adccc50bba..2da4d41fac 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -93,9 +93,14 @@
   orq $-1, %rax;				\
   jmp L(pseudo_end);
 #elif USE___THREAD
+# ifndef NOT_IN_libc
+#  define SYSCALL_ERROR_ERRNO __libc_errno
+# else
+#  define SYSCALL_ERROR_ERRNO errno
+# endif
 # define SYSCALL_ERROR_HANDLER			\
 0:						\
-  movq __libc_errno@GOTTPOFF(%rip), %rcx;	\
+  movq SYSCALL_ERROR_ERRNO@GOTTPOFF(%rip), %rcx;\
   xorq %rdx, %rdx;				\
   subq %rax, %rdx;				\
   movl %edx, %fs:(%rcx);			\