From 9cd4747089e6b0d6ed6b2b6c75798912489c7bab Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Wed, 19 Nov 2014 12:13:54 +0530 Subject: 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. --- nscd/Makefile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'nscd') diff --git a/nscd/Makefile b/nscd/Makefile index 639d87b9f8..7ab4e9de9d 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) -- cgit v1.2.3