This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.20-204-g130ac68


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  130ac68ca25c9aa65e027e3e37337bc048205c69 (commit)
       via  286663c34b006c1409df4a71f89d6d4d5d01df09 (commit)
       via  9cd4747089e6b0d6ed6b2b6c75798912489c7bab (commit)
      from  d71035bd9a3a1dc5077ab8d978398f2f960d3555 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=130ac68ca25c9aa65e027e3e37337bc048205c69

commit 130ac68ca25c9aa65e027e3e37337bc048205c69
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Wed Nov 19 12:16:00 2014 +0530

    Auto-generate libc-modules.h
    
    Remove libc-modules.h from the tree and auto-generate it from
    soversions.i and the list of modules in the built-modules variable
    defined in Makeconfig.  Macros generated have increasing numbered
    values, with built-modules having lower values starting from 1,
    following which a separator value LIBS_BEGIN is added and then finally
    the library names from soversions.i are appended to the list.  This
    allows us to conveniently differentiate between the versioned
    libraries and other built modules, which is needed in errno.h and
    netdb.h to decide whether to use an internal symbol or an external
    one.
    
    Verified that generated code remains unchanged on x86_64.
    
    	* Makeconfig (built-modules): List non-library modules to be
    	built.
    	(module-cppflags): Include libc-modules.h for
    	everything except shlib-versions.v.i.
    	(CPPFLAGS): Use it.
    	(before-compile): Add libc-modules.h.
    	($(common-objpfx)libc-modules.h,
    	$(common-objpfx)libc-modules.stmp): New targets.
    	(common-generated): Add libc-modules.h and libc-modules.stmp.
    	($(common-objpfx)Versions.v.i): Depend on libc-modules.h.
    	* include/libc-symbols.h: Don't include libc-modules.h.
    	* include/libc-modules.h: Remove file.
    	* scripts/gen-libc-modules.awk: New script to generate
    	libc-modules.h.
    	* sysdeps/unix/Makefile ($(common-objpfx)sysd-syscalls):
    	Depend on libc-modules.stmp.

diff --git a/ChangeLog b/ChangeLog
index d2460f8..09e308c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2014-11-19  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
+	* Makeconfig (built-modules): List non-library modules to be
+	built.
+	(module-cppflags): Include libc-modules.h for
+	everything except shlib-versions.v.i.
+	(CPPFLAGS): Use it.
+	(before-compile): Add libc-modules.h.
+	($(common-objpfx)libc-modules.h,
+	$(common-objpfx)libc-modules.stmp): New targets.
+	(common-generated): Add libc-modules.h and libc-modules.stmp.
+	($(common-objpfx)Versions.v.i): Depend on libc-modules.h.
+	* include/libc-symbols.h: Don't include libc-modules.h.
+	* include/libc-modules.h: Remove file.
+	* scripts/gen-libc-modules.awk: New script to generate
+	libc-modules.h.
+	* sysdeps/unix/Makefile ($(common-objpfx)sysd-syscalls):
+	Depend on libc-modules.stmp.
+
 	* include/shlib-compat.h (_SHLIB_COMPAT): Use IS_IN.
 
 	* Makeconfig (in-module): Get value of libof set for the
diff --git a/Makeconfig b/Makeconfig
index 9f88f7c..1a26cc5 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -813,20 +813,39 @@ endif	# $(+cflags) == ""
 # of many little headers in the include directory.
 libio-include = -I$(..)libio
 
+# List of non-library modules that we build.
+built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \
+		libSegFault libpcprofile librpcsvc locale-programs \
+		memusagestat nonlib nscd extramodules libnldbl
+
+# We don't include libc-modules.h when these targets are being built.  These
+# targets don't (and will likely never need to) use the IS_IN facility.  In
+# fact, shlib-versions should not use it because that will create a circular
+# dependency as libc-modules.h is generated from shlib-versions.
+skip-module-cppflags = shlib-versions.v.i Versions.v.i
+
 in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \
 				    $(libof-$(<F)) \
 				    $(libof-$(@F)) \
 				    libc))
 
+module-cppflags-real = -include $(common-objpfx)libc-modules.h \
+		       -DIN_MODULE=MODULE_$(in-module)
+
+# We don't need libc-modules.h and the IN_MODULE definition for
+# shlib-version.v.i.
+module-cppflags = $(if $(filter $(@F),$(skip-module-cppflags)), \
+		       ,$(module-cppflags-real))
+
 # These are the variables that the implicit compilation rules use.
 # Note that we can't use -std=* in CPPFLAGS, because it overrides
 # the implicit -lang-asm and breaks cpp behavior for .S files--notably
 # it causes cpp to stop predefining __ASSEMBLER__.
 CPPFLAGS = $(config-extra-cppflags) $(CPPUNDEFS) $(CPPFLAGS-config) \
 	   $($(subdir)-CPPFLAGS) \
-	   $(+includes) $(defines) \
+	   $(+includes) $(defines) $(module-cppflags) \
 	   -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
-	   $(CPPFLAGS-$(suffix $@)) -DIN_MODULE=MODULE_$(in-module) \
+	   $(CPPFLAGS-$(suffix $@)) \
 	   $(foreach lib,$(libof-$(basename $(@F))) \
 			 $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
 	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
@@ -986,6 +1005,23 @@ endif
 postclean-generated += soversions.mk soversions.i \
 		       shlib-versions.v shlib-versions.v.i
 
+before-compile += $(common-objpfx)libc-modules.h
+ifeq ($(soversions.mk-done),t)
+# Generate a header with macro definitions for use with the IS_IN macro.
+# These are the possible values for the IN_MODULE macro defined when building
+# sources, to identify which module the translation unit is going to be built
+# into.
+$(common-objpfx)libc-modules.h: $(common-objpfx)libc-modules.stmp; @:
+$(common-objpfx)libc-modules.stmp: $(..)scripts/gen-libc-modules.awk \
+				   $(common-objpfx)soversions.i
+	$(AWK) -v buildlist="$(subst -,_,$(built-modules))" -f $^ > ${@:stmp=T}
+	$(move-if-change) ${@:stmp=T} ${@:stmp=h}
+	touch $@
+
+endif
+
+common-generated += libc-modules.h libc-modules.stmp
+
 # The name under which the run-time dynamic linker is installed.
 # We are currently going for the convention that `/lib/ld.so.1'
 # names the SVR4/ELF ABI-compliant dynamic linker.
diff --git a/include/libc-modules.h b/include/libc-modules.h
deleted file mode 100644
index 029b600..0000000
--- a/include/libc-modules.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Valid values for the IN_MODULE macro, which is defined for each source file
-   during compilation to indicate which module it is to be built into.
-
-   TODO: This file should eventually be auto-generated.  */
-#define MODULE_libc		1
-#define MODULE_libpthread	2
-#define MODULE_rtld		3
-#define MODULE_libdl		4
-#define MODULE_libm		5
-#define MODULE_iconvprogs	6
-#define MODULE_iconvdata	7
-#define MODULE_lddlibc4		8
-#define MODULE_locale_programs	9
-#define MODULE_memusagestat	10
-#define MODULE_libutil		12
-#define MODULE_libBrokenLocale	13
-#define MODULE_libmemusage	15
-#define MODULE_libresolv	16
-#define MODULE_libnss_db	17
-#define MODULE_libnss_files	18
-#define	MODULE_libnss_dns	19
-#define MODULE_libnss_compat	20
-#define MODULE_libnss_hesiod	21
-#define MODULE_libnss_nis	22
-#define MODULE_libnss_nisplus	23
-#define MODULE_libanl		24
-#define MODULE_librt		25
-#define MODULE_libSegFault	26
-#define MODULE_libthread_db	27
-#define MODULE_libcidn		28
-#define MODULE_libcrypt		29
-#define MODULE_libnsl		30
-#define MODULE_libpcprofile	31
-#define MODULE_librpcsvc	32
-#define MODULE_nscd		33
-#define MODULE_ldconfig 	34
-#define MODULE_libnldbl 	35
-
-/* Catch-all for test modules and other binaries.  */
-#define MODULE_nonlib		98
-#define MODULE_extramodules	99
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 58c3577..9c5c9bb 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -20,9 +20,6 @@
 #ifndef _LIBC_SYMBOLS_H
 #define _LIBC_SYMBOLS_H	1
 
-/* Pull in definitions for the MODULE_* macros.  */
-#include <libc-modules.h>
-
 #define IS_IN(lib) (IN_MODULE == MODULE_##lib)
 
 /* This file's macros are included implicitly in the compilation of every
diff --git a/scripts/gen-libc-modules.awk b/scripts/gen-libc-modules.awk
new file mode 100644
index 0000000..2f92cd4
--- /dev/null
+++ b/scripts/gen-libc-modules.awk
@@ -0,0 +1,34 @@
+# Generate a header file that defines the MODULE_* macros for each library and
+# module we build in glibc.  The library names are pulled in from soversions.i
+# and the additional modules are passed in the BUILDLIST variable.
+BEGIN {
+  # BUILDLIST is set from the build-list variable in Makeconfig and is a space
+  # separated list of non-library modules that we build in glibc.
+  num = split (buildlist, libs, " ")
+  # Separate the built modules from the libraries.
+  libs[++num] = "LIBS_BEGIN"
+}
+
+# Skip over comments.
+$1 == "#" {
+  next
+}
+
+# We have only one special case in soversions.i parsing, which is to replace ld
+# with rtld since that's what we call it throughout the sources.
+match (FILENAME, ".*soversions.i") {
+  name = $2
+  if (name == "ld")
+    name = "rtld"
+
+  # Library names are not duplicated in soversions.i.
+  libs[++num] = name
+}
+
+# Finally, print out the header file.
+END {
+  printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n\n")
+  for (l in libs) {
+    printf ("#define MODULE_%s %d\n", libs[l], l)
+  }
+}
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index 0e535b6..573e90d 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -79,7 +79,8 @@ compile-syscall = $(COMPILE.S) -o $@ -x assembler-with-cpp - \
 
 ifndef avoid-generated
 $(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
-			       $(wildcard $(+sysdep_dirs:%=%/syscalls.list))
+			       $(wildcard $(+sysdep_dirs:%=%/syscalls.list)) \
+			       $(common-objpfx)libc-modules.stmp
 	for dir in $(+sysdep_dirs); do \
 	  test -f $$dir/syscalls.list && \
 	  { sysdirs='$(sysdirs)' \

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=286663c34b006c1409df4a71f89d6d4d5d01df09

commit 286663c34b006c1409df4a71f89d6d4d5d01df09
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Wed Nov 19 12:15:01 2014 +0530

    Fix -Wundef warning in SHLIB_COMPAT
    
    Replace the IS_IN_##lib with IS_IN(lib).  Verified that the generated
    code remains the same.
    
    	* include/shlib-compat.h (_SHLIB_COMPAT): Use IS_IN.

diff --git a/ChangeLog b/ChangeLog
index 038b134..d2460f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-11-19  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
+	* include/shlib-compat.h (_SHLIB_COMPAT): Use IS_IN.
+
 	* Makeconfig (in-module): Get value of libof set for the
 	translation unit.
 	(CPPFLAGS): Use $(in-module).
diff --git a/include/shlib-compat.h b/include/shlib-compat.h
index fac0814..30804d3 100644
--- a/include/shlib-compat.h
+++ b/include/shlib-compat.h
@@ -41,7 +41,7 @@
 # define SHLIB_COMPAT(lib, introduced, obsoleted)			      \
   _SHLIB_COMPAT (lib, introduced, obsoleted)
 # define _SHLIB_COMPAT(lib, introduced, obsoleted)			      \
-  ((IS_IN_##lib - 0)							      \
+  (IS_IN (lib)								      \
    && (!(ABI_##lib##_##obsoleted - 0)					      \
        || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0))))
 

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9cd4747089e6b0d6ed6b2b6c75798912489c7bab

commit 9cd4747089e6b0d6ed6b2b6c75798912489c7bab
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Wed Nov 19 12:13:54 2014 +0530

    Add new macro IN_MODULE to identify module in which source is built
    
    The current scheme to identify which module a translation unit is
    built in depends on defining multiple macros IS_IN_* and also defining
    NOT_IN_libc if we're building a non-libc module.  In addition, there
    is an IN_LIB macro that does effectively the same thing, but for
    different modules (notably the systemtap probes).  This macro scheme
    unifies both ideas to use just one macro IN_MODULE and assign it a
    value depending on the module it is being built into.  If the module
    is not defined, it defaults to MODULE_libc.
    
    Patches that follow will replace uses of IS_IN_* variables with the
    IS_IN() macro.  libc-symbols.h has been converted already to give an
    example of how such a transition will look.
    
    Verified that there are no relevant binary changes.  One source change
    that will crop up repeatedly is that of nscd_stat, since it uses the
    build timestamp as a constant in its logic.
    
    	* Makeconfig (in-module): Get value of libof set for the
    	translation unit.
    	(CPPFLAGS): Use $(in-module).
    	* Makerules: Don't suffix routine names for nonlib.
    	* include/libc-modules.h: New file.
    	* include/libc-symbols.h: Include libc-modules.h
    	(IS_IN): New macro to replace IS_IN_* macros.
    	* elf/Makefile: Set libof-* for each routine.
    	* elf/rtld-Rules: Likewise.
    	* extra-modules.mk: Likewise.
    	* iconv/Makefile: Likewise.
    	* iconvdata/Makefile: Likewise.
    	* locale/Makefile: Likewise.
    	* malloc/Makefile: Likewise.
    	* nss/Makefile: Likewise.
    	* sysdeps/gnu/Makefile: Likewise.
    	* sysdeps/ieee754/ldbl-opt/Makefile: Likewise.
    	* sysdeps/unix/sysv/linux/Makefile: Likewise.
    	* sysdeps/s390/s390-64/Makefile: Likewise.
    	* nscd/Makefile: Set libof-* for each routine.  Set CFLAGS and
    	CPPFLAGS for nscd instead of nonlib.

diff --git a/ChangeLog b/ChangeLog
index 37b1459..038b134 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2014-11-19  Siddhesh Poyarekar  <siddhesh@redhat.com>
+
+	* Makeconfig (in-module): Get value of libof set for the
+	translation unit.
+	(CPPFLAGS): Use $(in-module).
+	* Makerules: Don't suffix routine names for nonlib.
+	* include/libc-modules.h: New file.
+	* include/libc-symbols.h: Include libc-modules.h
+	(IS_IN): New macro to replace IS_IN_* macros.
+	* elf/Makefile: Set libof-* for each routine.
+	* elf/rtld-Rules: Likewise.
+	* extra-modules.mk: Likewise.
+	* iconv/Makefile: Likewise.
+	* iconvdata/Makefile: Likewise.
+	* locale/Makefile: Likewise.
+	* malloc/Makefile: Likewise.
+	* nss/Makefile: Likewise.
+	* sysdeps/gnu/Makefile: Likewise.
+	* sysdeps/ieee754/ldbl-opt/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/Makefile: Likewise.
+	* sysdeps/s390/s390-64/Makefile: Likewise.
+	* nscd/Makefile: Set libof-* for each routine.  Set CFLAGS and
+	CPPFLAGS for nscd instead of nonlib.
+
 2014-11-18  Roland McGrath  <roland@hack.frob.com>
 
 	* nptl/createthread.c: New file.
diff --git a/Makeconfig b/Makeconfig
index 24a3b82..9f88f7c 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -813,6 +813,11 @@ endif	# $(+cflags) == ""
 # of many little headers in the include directory.
 libio-include = -I$(..)libio
 
+in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \
+				    $(libof-$(<F)) \
+				    $(libof-$(@F)) \
+				    libc))
+
 # These are the variables that the implicit compilation rules use.
 # Note that we can't use -std=* in CPPFLAGS, because it overrides
 # the implicit -lang-asm and breaks cpp behavior for .S files--notably
@@ -821,7 +826,7 @@ CPPFLAGS = $(config-extra-cppflags) $(CPPUNDEFS) $(CPPFLAGS-config) \
 	   $($(subdir)-CPPFLAGS) \
 	   $(+includes) $(defines) \
 	   -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
-	   $(CPPFLAGS-$(suffix $@)) \
+	   $(CPPFLAGS-$(suffix $@)) -DIN_MODULE=MODULE_$(in-module) \
 	   $(foreach lib,$(libof-$(basename $(@F))) \
 			 $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
 	   $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
diff --git a/Makerules b/Makerules
index 4f2eec3..3cf4c40 100644
--- a/Makerules
+++ b/Makerules
@@ -1223,7 +1223,7 @@ xcheck: xtests
 
 all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others))
 ifneq (,$(all-nonlib))
-cpp-srcs-left = $(all-nonlib:=.c) $(all-nonlib:=.cc)
+cpp-srcs-left = $(all-nonlib)
 lib := nonlib
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
 endif
diff --git a/elf/Makefile b/elf/Makefile
index 34f0b1f..f013c22 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -436,7 +436,8 @@ $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
 
 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
-		    -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
+		    -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1 -DNOT_IN_libc=1
+libof-ldconfig = ldconfig
 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
 CFLAGS-cache.c = $(SYSCONF-FLAGS)
 CFLAGS-rtld.c = $(SYSCONF-FLAGS)
@@ -444,6 +445,10 @@ CFLAGS-rtld.c = $(SYSCONF-FLAGS)
 CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
 		     -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
 
+cpp-srcs-left := $(all-rtld-routines:=.os)
+lib := rtld
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+
 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
 generated += $(addsuffix .so,$(strip $(modules-names)))
 
diff --git a/elf/rtld-Rules b/elf/rtld-Rules
index 0a5d6af..f2cc4a1 100644
--- a/elf/rtld-Rules
+++ b/elf/rtld-Rules
@@ -138,6 +138,11 @@ ifdef rtld-depfiles
 -include $(rtld-depfiles)
 endif
 
+# Set libof-* for each routine.
+cpp-srcs-left := $(rtld-modules:%.os=%)
+lib := rtld
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+
 # This here is the whole point of all the shenanigans.
 rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld
 
diff --git a/extra-modules.mk b/extra-modules.mk
index c7ed850..9c2e4d2 100644
--- a/extra-modules.mk
+++ b/extra-modules.mk
@@ -6,4 +6,5 @@
 module := $(firstword $(extra-modules-left))
 extra-modules-left := $(filter-out $(module),$(extra-modules-left))
 
+libof-$(notdir $(module)) := extramodules
 CPPFLAGS-$(module).c += -DNOT_IN_libc
diff --git a/iconv/Makefile b/iconv/Makefile
index 48d17d7..8031a88 100644
--- a/iconv/Makefile
+++ b/iconv/Makefile
@@ -52,11 +52,12 @@ CFLAGS-gconv_cache.c += -DGCONV_DIR='"$(gconvdir)"'
 CFLAGS-gconv_conf.c = -DGCONV_PATH='"$(gconvdir)"'
 CFLAGS-iconvconfig.c = -DGCONV_PATH='"$(gconvdir)"' -DGCONV_DIR='"$(gconvdir)"'
 
-CPPFLAGS-iconv_charmap = -DNOT_IN_libc
-CPPFLAGS-linereader = -DNOT_IN_libc
-CPPFLAGS-strtab = -DNOT_IN_libc
-CPPFLAGS-charmap = -DNOT_IN_libc
-CPPFLAGS-charmap-dir = -DNOT_IN_libc
+CPPFLAGS-iconvprogs = -DNOT_IN_libc
+
+# Set libof-* for each routine.
+cpp-srcs-left := $(iconv_prog-modules) $(iconvconfig-modules)
+lib := iconvprogs
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
 
 ifeq ($(run-built-tests),yes)
 xtests-special += $(objpfx)test-iconvconfig.out
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index b6327d6..e0252ee 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -211,6 +211,7 @@ $(objpfx)iconv-rules: Makefile
 	$(AWK) 'NR == 1 { \
 		  for (i = 1; i <= NF; i++) { \
 		    printf "%s-routines := %s\n", $$i, tolower($$i); \
+		    printf "libof-%s := iconvdata\n", tolower($$i); \
 		    printf "%s-map := gconv.map\n", $$i; \
 		  } \
 		}; \
@@ -273,6 +274,11 @@ endif
 
 include ../Rules
 
+# Set libof-* for each routine.
+cpp-srcs-left := $(modules) $(generated-modules)
+lib := iconvdata
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+
 tst-loading-ENV = MALLOC_TRACE=$(objpfx)tst-loading.mtrace
 $(objpfx)mtrace-tst-loading.out: $(objpfx)tst-loading.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-loading.mtrace > $@; \
diff --git a/include/libc-modules.h b/include/libc-modules.h
new file mode 100644
index 0000000..029b600
--- /dev/null
+++ b/include/libc-modules.h
@@ -0,0 +1,41 @@
+/* Valid values for the IN_MODULE macro, which is defined for each source file
+   during compilation to indicate which module it is to be built into.
+
+   TODO: This file should eventually be auto-generated.  */
+#define MODULE_libc		1
+#define MODULE_libpthread	2
+#define MODULE_rtld		3
+#define MODULE_libdl		4
+#define MODULE_libm		5
+#define MODULE_iconvprogs	6
+#define MODULE_iconvdata	7
+#define MODULE_lddlibc4		8
+#define MODULE_locale_programs	9
+#define MODULE_memusagestat	10
+#define MODULE_libutil		12
+#define MODULE_libBrokenLocale	13
+#define MODULE_libmemusage	15
+#define MODULE_libresolv	16
+#define MODULE_libnss_db	17
+#define MODULE_libnss_files	18
+#define	MODULE_libnss_dns	19
+#define MODULE_libnss_compat	20
+#define MODULE_libnss_hesiod	21
+#define MODULE_libnss_nis	22
+#define MODULE_libnss_nisplus	23
+#define MODULE_libanl		24
+#define MODULE_librt		25
+#define MODULE_libSegFault	26
+#define MODULE_libthread_db	27
+#define MODULE_libcidn		28
+#define MODULE_libcrypt		29
+#define MODULE_libnsl		30
+#define MODULE_libpcprofile	31
+#define MODULE_librpcsvc	32
+#define MODULE_nscd		33
+#define MODULE_ldconfig 	34
+#define MODULE_libnldbl 	35
+
+/* Catch-all for test modules and other binaries.  */
+#define MODULE_nonlib		98
+#define MODULE_extramodules	99
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index b1ac9db..58c3577 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -20,6 +20,11 @@
 #ifndef _LIBC_SYMBOLS_H
 #define _LIBC_SYMBOLS_H	1
 
+/* Pull in definitions for the MODULE_* macros.  */
+#include <libc-modules.h>
+
+#define IS_IN(lib) (IN_MODULE == MODULE_##lib)
+
 /* This file's macros are included implicitly in the compilation of every
    file in the C library by -imacros.
 
@@ -448,7 +453,7 @@ for linking")
    If the function should be internal to multiple objects, say ld.so and
    libc.so, the best way is to use:
 
-   #if !defined NOT_IN_libc || defined IS_IN_rtld
+   #if IS_IN (libc) || IS_IN (rtld)
    hidden_proto (foo)
    #endif
 
@@ -564,7 +569,7 @@ for linking")
 # define libc_hidden_data_ver(local, name)
 #endif
 
-#ifdef IS_IN_rtld
+#if IS_IN (rtld)
 # define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define rtld_hidden_def(name) hidden_def (name)
@@ -584,7 +589,7 @@ for linking")
 # define rtld_hidden_data_ver(local, name)
 #endif
 
-#ifdef IS_IN_libm
+#if IS_IN (libm)
 # define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define libm_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libm_hidden_def(name) hidden_def (name)
@@ -604,7 +609,7 @@ for linking")
 # define libm_hidden_data_ver(local, name)
 #endif
 
-#ifdef IS_IN_libresolv
+#if IS_IN (libresolv)
 # define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define libresolv_hidden_tls_proto(name, attrs...) \
   hidden_tls_proto (name, ##attrs)
@@ -625,7 +630,7 @@ for linking")
 # define libresolv_hidden_data_ver(local, name)
 #endif
 
-#ifdef IS_IN_librt
+#if IS_IN (librt)
 # define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define librt_hidden_tls_proto(name, attrs...) \
   hidden_tls_proto (name, ##attrs)
@@ -646,7 +651,7 @@ for linking")
 # define librt_hidden_data_ver(local, name)
 #endif
 
-#ifdef IS_IN_libdl
+#if IS_IN (libdl)
 # define libdl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define libdl_hidden_tls_proto(name, attrs...) \
   hidden_tls_proto (name, ##attrs)
@@ -667,7 +672,7 @@ for linking")
 # define libdl_hidden_data_ver(local, name)
 #endif
 
-#ifdef IS_IN_libnss_files
+#if IS_IN (libnss_files)
 # define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define libnss_files_hidden_tls_proto(name, attrs...) \
   hidden_tls_proto (name, ##attrs)
@@ -688,7 +693,7 @@ for linking")
 # define libnss_files_hidden_data_ver(local, name)
 #endif
 
-#ifdef IS_IN_libnsl
+#if IS_IN (libnsl)
 # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define libnsl_hidden_tls_proto(name, attrs...) \
   hidden_tls_proto (name, ##attrs)
@@ -709,7 +714,7 @@ for linking")
 # define libnsl_hidden_data_ver(local, name)
 #endif
 
-#ifdef IS_IN_libnss_nisplus
+#if IS_IN (libnss_nisplus)
 # define libnss_nisplus_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define libnss_nisplus_hidden_tls_proto(name, attrs...) \
   hidden_tls_proto (name, ##attrs)
@@ -738,7 +743,7 @@ for linking")
 # define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
 #endif
 
-#ifdef IS_IN_libutil
+#if IS_IN (libutil)
 # define libutil_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define libutil_hidden_tls_proto(name, attrs...) \
   hidden_tls_proto (name, ##attrs)
diff --git a/locale/Makefile b/locale/Makefile
index e4c3878..bbbb3e5 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -96,7 +96,7 @@ CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
 CFLAGS-charmap-dir.c = -Wno-write-strings
 
 # This makes sure -DNOT_IN_libc et al are passed for all these modules.
-cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
-				$(locale-modules) $(lib-modules))
+cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \
+		 $(lib-modules)
 lib := locale-programs
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
diff --git a/malloc/Makefile b/malloc/Makefile
index 9e93523..fbfada2 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -89,6 +89,11 @@ endif
 do-memusagestat: $(objpfx)memusagestat
 
 memusagestat-modules = memusagestat
+
+cpp-srcs-left := $(memusagestat-modules)
+lib := memusagestat
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+
 $(objpfx)memusagestat: $(memusagestat-modules:%=$(objpfx)%.o)
 	$(LINK.o) -o $@ $^ $(libgd-LDFLAGS) -lgd -lpng -lz -lm
 
diff --git a/nscd/Makefile b/nscd/Makefile
index 639d87b..7ab4e9d 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -79,23 +79,22 @@ CFLAGS-nscd_gethst_r.c = -fexceptions
 CFLAGS-nscd_getai.c = -fexceptions
 CFLAGS-nscd_initgroups.c = -fexceptions
 
-CPPFLAGS-nonlib += -DIS_IN_nscd=1 -D_FORTIFY_SOURCE=2
+CPPFLAGS-nscd += -DIS_IN_nscd=1 -D_FORTIFY_SOURCE=2 -DNOT_IN_libc=1
 
 ifeq (yesyes,$(have-fpie)$(build-shared))
-CFLAGS-nonlib += $(pie-ccflag)
+CFLAGS-nscd += $(pie-ccflag)
 endif
 ifeq (yes,$(have-ssp))
-CFLAGS-nonlib += -fstack-protector
+CFLAGS-nscd += -fstack-protector
 endif
 
 ifeq (yesyes,$(have-fpie)$(build-shared))
 LDFLAGS-nscd = -Wl,-z,now
 endif
 
-# This makes sure CPPFLAGS-nonlib and CFLAGS-nonlib are passed
-# for all these modules.
-cpp-srcs-left := $(nscd-modules:=.c)
-lib := nonlib
+# Set libof-nscd.
+cpp-srcs-left := $(nscd-modules)
+lib := nscd
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
 
 $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
diff --git a/nss/Makefile b/nss/Makefile
index 1fa7f1f..7114d74 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -105,7 +105,8 @@ $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o)
 $(inst_vardbdir)/Makefile: db-Makefile $(+force)
 	$(do-install)
 
-CFLAGS-nss_test1.c = -DNOT_IN_libc=1
+libof-nss_test1 = extramodules
+CPPFLAGS-nss_test1 = -DNOT_IN_libc=1
 $(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(link-libc-deps)
 	$(build-module)
 ifdef libnss_test1.so-version
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 9b2271b..da6e076 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -145,6 +145,7 @@ LDFLAGS-tst-putenv = $(no-as-needed)
 
 $(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps)
 	$(build-module)
+libof-tst-putenvmod = extramodules
 CFLAGS-tst-putenvmod.c = -DNOT_IN_libc=1
 
 $(objpfx)bug-getcontext: $(libm)
diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
index c05708d..b5b2cf0 100644
--- a/sysdeps/gnu/Makefile
+++ b/sysdeps/gnu/Makefile
@@ -29,6 +29,8 @@ ifeq ($(subdir),stdio-common)
 
 errlist-c = $(firstword $(wildcard $(addsuffix /errlist.c,$(sysdirs) .)))
 
+libof-errlist-compat = extramodules
+
 ifeq ($(build-shared),yes)
 $(objpfx)errlist-compat.c: $(errlist-c) $(..)sysdeps/gnu/errlist-compat.awk \
 			   $(common-objpfx)Versions.v.i $(before-compile)
diff --git a/sysdeps/s390/s390-64/Makefile b/sysdeps/s390/s390-64/Makefile
index fe5030e..ce4f0c5 100644
--- a/sysdeps/s390/s390-64/Makefile
+++ b/sysdeps/s390/s390-64/Makefile
@@ -28,6 +28,10 @@ s390x-iconv-modules = ISO-8859-1_CP037_Z900 UTF8_UTF16_Z9 UTF16_UTF32_Z9 UTF8_UT
 extra-modules-left += $(s390x-iconv-modules)
 include extra-module.mk
 
+cpp-srcs-left := $(foreach mod,$(s390x-iconv-modules),$($(mod)-routines))
+lib := iconvdata
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+
 extra-objs      += $(addsuffix .so, $(s390x-iconv-modules))
 install-others  += $(patsubst %, $(inst_gconvdir)/%.so, $(s390x-iconv-modules))
 
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 9ad6d22..2d6d8bb 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -178,6 +178,7 @@ ifeq ($(subdir),elf)
 sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir \
 			dl-fxstatat64
 
+libof-lddlibc4 = lddlibc4
 CPPFLAGS-lddlibc4 += -DNOT_IN_libc
 
 others += pldd

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                        |   43 ++++++++++++++++++++++++++++++++++++++
 Makeconfig                       |   43 +++++++++++++++++++++++++++++++++++++-
 Makerules                        |    2 +-
 elf/Makefile                     |    7 +++++-
 elf/rtld-Rules                   |    5 ++++
 extra-modules.mk                 |    1 +
 iconv/Makefile                   |   11 +++++----
 iconvdata/Makefile               |    6 +++++
 include/libc-symbols.h           |   22 ++++++++++--------
 include/shlib-compat.h           |    2 +-
 locale/Makefile                  |    4 +-
 malloc/Makefile                  |    5 ++++
 nscd/Makefile                    |   13 +++++------
 nss/Makefile                     |    3 +-
 scripts/gen-libc-modules.awk     |   34 ++++++++++++++++++++++++++++++
 stdlib/Makefile                  |    1 +
 sysdeps/gnu/Makefile             |    2 +
 sysdeps/s390/s390-64/Makefile    |    4 +++
 sysdeps/unix/Makefile            |    3 +-
 sysdeps/unix/sysv/linux/Makefile |    1 +
 20 files changed, 182 insertions(+), 30 deletions(-)
 create mode 100644 scripts/gen-libc-modules.awk


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]