@@ -1092,8 +1092,6 @@ subdir-srcdirs = $(foreach dir,$(subdirs),\
sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T
mv -f $@T $@
-ifeq (yes, $(build-shared))
-
# To generate a header to support more than one ABI for different
# architecture variants, the CPU/Makefile defines abi-variants to be a
# list of names for those variants (e.g. 32 64), and, for each variant,
@@ -1176,7 +1174,6 @@ endif
# Generate version maps, but wait until sysdep-subdirs is known
ifeq ($(sysd-sorted-done),t)
-ifeq ($(build-shared),yes)
-include $(common-objpfx)sysd-versions
-include $(common-objpfx)Versions.mk
$(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions
@@ -1226,12 +1223,12 @@ $(common-objpfx)versions.stmp: $(common-objpfx)Versions.all \
mv -f $(common-objpfx)sysd-versionsT $(common-objpfx)sysd-versions
touch $@
endif # avoid-generated
-endif # $(build-shared) = yes
endif # sysd-sorted-done
# 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.
+ifeq ($(build-shared),yes)
ifndef rtld-installed-name
ifdef ld.so-version
rtld-installed-name = $(ld.so-version)
@@ -583,11 +583,15 @@ endef
# (which we do not build) that GCC-compiled programs depend on.
+ifeq (yes, $(build-shared))
ifeq (,$(CXX))
LINKS_DSO_PROGRAM = links-dso-program-c
else
LINKS_DSO_PROGRAM = links-dso-program
endif
+else
+LINKS_DSO_PROGRAM =
+endif
$(tests-container) $(addsuffix /tests,$(subdirs)) : \
$(objpfx)testroot.pristine/install.stamp
@@ -93,7 +93,6 @@ before-compile := $(filter $(common-objpfx)mach% $(common-objpfx)hurd%,\
$(before-compile))
# Even before that, we need abi-versions.h which is generated right here.
-ifeq ($(build-shared),yes)
ifndef avoid-generated
before-compile := $(common-objpfx)abi-versions.h $(before-compile)
$(common-objpfx)abi-versions.h: $(..)scripts/abi-versions.awk \
@@ -113,7 +112,6 @@ before-compile := $(common-objpfx)first-versions.h \
$(common-objpfx)first-versions.h: $(common-objpfx)versions.stmp
$(common-objpfx)ldbl-compat-choose.h: $(common-objpfx)versions.stmp
endif # avoid-generated
-endif # $(build-shared) = yes
ifndef avoid-generated
ifneq (,$(CXX))
@@ -280,6 +278,7 @@ $(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.py \
vpath %.sym $(sysdirs)
before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
+ifeq (yes, $(build-shared))
tests-internal += $(gen-as-const-headers:%.sym=test-as-const-%)
generated += $(gen-as-const-headers:%.sym=test-as-const-%.c)
$(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.py $(..)Makerules \
@@ -288,6 +287,7 @@ $(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.py $(..)Makerules \
$(PYTHON) $< --test $(filter %.sym,$^)) > $@T
mv -f $@T $@
endif
+endif
ifeq (yes,$(build-shared))
# Generate the header containing the names of all shared libraries.
@@ -1049,6 +1049,7 @@ $(LN_S) `$(..)scripts/rellns-sh -p $< $@` $@
endef
endif
+ifeq ($(build-shared),yes)
ifdef libc.so-version
# For a library specified to be version N, install three files:
# libc.so -> libc.so.N (e.g. libc.so.6)
@@ -1102,7 +1103,8 @@ else
install: $(inst_slibdir)/libc.so
$(inst_slibdir)/libc.so: $(common-objpfx)libc.so $(+force)
$(do-install-program)
-endif
+endif # libc.so-version
+endif # build-shared
ifneq (,$(versioned))
# Produce three sets of rules as above for all the smaller versioned libraries.
@@ -104,21 +104,6 @@
_compat_symbol_unique (lib, name, _compat_symbol_unique_alias (name), \
version)
-#else
-
-/* Not compiling ELF shared libraries at all, so never any old versions. */
-# define SHLIB_COMPAT(lib, introduced, obsoleted) 0
-
-/* No versions to worry about, just make this the global definition. */
-# define versioned_symbol(lib, local, symbol, version) \
- weak_alias (local, symbol)
-
-/* This should not appear outside `#if SHLIB_COMPAT (...)'. */
-# define compat_symbol(lib, local, symbol, version) ...
-# define compat_symbol_unique(lib, name, version) ...
-
-#endif
-
/* Use compat_symbol_reference for a reference *or* definition of a
specific version of a symbol. Definitions are primarily used to
ensure tests reference the exact compat symbol required, or define an
@@ -146,4 +131,23 @@
(!(ABI_##lib##_##obsoleted - 0) \
|| ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0)))
+#else
+
+/* Not compiling ELF shared libraries at all, so never any old versions. */
+# define SHLIB_COMPAT(lib, introduced, obsoleted) 0
+
+/* No versions to worry about, just make this the global definition. */
+# define versioned_symbol(lib, local, symbol, version) \
+ weak_alias (local, symbol)
+
+/* This should not appear outside `#if SHLIB_COMPAT (...)'. */
+# define compat_symbol(lib, local, symbol, version) ...
+# define compat_symbol_unique(lib, name, version) ...
+
+# define compat_symbol_reference(lib, local, symbol, version)
+
+# define TEST_COMPAT(lib, introduced, obsoleted) 0
+
+#endif /* SHARED */
+
#endif /* shlib-compat.h */
@@ -314,7 +314,7 @@ main (int argc, char **argv)
# endif
#endif
-#ifdef USE_NSCD
+#if defined SHARED && defined USE_NSCD
/* Make sure we do not get recursive calls. */
__nss_disable_nscd (register_traced_file);
#endif
@@ -55,6 +55,9 @@ __libc_lock_define (static, nss_module_list_lock);
static bool is_nscd;
/* The callback passed to the init functions when nscd is used. */
static void (*nscd_init_cb) (size_t, struct traced_file *);
+#else
+# define is_nscd (0)
+# define nscd_init_cb (NULL)
#endif
/* Allocate the service NAME with length NAME_LENGTH. If the service
@@ -211,12 +211,16 @@ CFLAGS-support_paths.c = \
# -fexcess-precision=standard.
CFLAGS-timespec.c += -fexcess-precision=standard
+ifeq (yes, $(build-shared))
ifeq (,$(CXX))
LINKS_DSO_PROGRAM = links-dso-program-c
else
LINKS_DSO_PROGRAM = links-dso-program
LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind)
endif
+else
+LINKS_DSO_PROGRAM =
+endif
ifeq (yes,$(have-selinux))
LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux
@@ -1,9 +1,7 @@
ifeq ($(subdir),elf)
-ifeq ($(build-shared),yes)
# This is needed for DSO loading from static binaries.
sysdep-dl-routines += dl-static
endif
-endif
ifeq ($(subdir),misc)
sysdep_headers += sys/elf.h
@@ -13,10 +13,8 @@ gen-as-const-headers += ucontext_i.sym
endif
ifeq ($(subdir),elf)
-ifeq ($(build-shared),yes)
# This is needed for DSO loading from static binaries.
sysdep-dl-routines += dl-static
-endif
# Otherwise tst-tls-dlinfo fails due to tst-tlsmod2.so using static tls.
LDFLAGS-tst-tlsmod2.so += -Wl,--no-tls-get-addr-optimize
endif