aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-30 10:21:24 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-30 10:21:24 +0000
commiteb226e3be7a90edf895a30168ede734c9301930b (patch)
tree1def1e1cd8d4f120cb9327c87ecdf786b177568b
parent9f415b2389c923098128385f72ca94ca67a73a23 (diff)
downloadglibc-eb226e3be7a90edf895a30168ede734c9301930b.zip
glibc-eb226e3be7a90edf895a30168ede734c9301930b.tar.gz
glibc-eb226e3be7a90edf895a30168ede734c9301930b.tar.bz2
Handle them here instead. Use
$(object-suffixes-for-libc) instead of $(object-suffixes) when dealing with libc routines. ($(objpfx)%.So): New rules for static-only routines. (elide-routines.So): Elide all routines except static-only routines. ($(objpfx)stamp.So-$(subdir)): Special rule for when static-only-routines is empty. ($(inst_libdir)/libc.so): Use libc_nonshared.a instead of libc.a. Remove explicit reference to the dynamic linker.
-rw-r--r--Makerules69
1 files changed, 49 insertions, 20 deletions
diff --git a/Makerules b/Makerules
index 7c44bd5..b36d884 100644
--- a/Makerules
+++ b/Makerules
@@ -171,16 +171,19 @@ $(objpfx)%.o: %.S $(before-compile); $(compile-command.S)
$(objpfx)%.so: %.S $(before-compile); $(compile-command.S)
$(objpfx)%.po: %.S $(before-compile); $(compile-command.S)
$(objpfx)%.go: %.S $(before-compile); $(compile-command.S)
+$(objpfx)%.So: %.S $(before-compile); $(compile-command.S)
$(objpfx)%.d: %.S $(before-compile); $(+make-deps)
$(objpfx)%.o: %.s $(before-compile); $(compile-command.s)
$(objpfx)%.so: %.s $(before-compile); $(compile-command.s)
$(objpfx)%.po: %.s $(before-compile); $(compile-command.s)
$(objpfx)%.go: %.s $(before-compile); $(compile-command.s)
+$(objpfx)%.So: %.s $(before-compile); $(compile-command.s)
$(objpfx)%.d: %.s $(common-objpfx)dummy.d; $(make-dummy-dep)
$(objpfx)%.o: %.c $(before-compile); $(compile-command.c)
$(objpfx)%.so: %.c $(before-compile); $(compile-command.c)
$(objpfx)%.po: %.c $(before-compile); $(compile-command.c)
$(objpfx)%.go: %.c $(before-compile); $(compile-command.c)
+$(objpfx)%.So: %.c $(before-compile); $(compile-command.c)
$(objpfx)%.d: %.c $(before-compile); $(+make-deps)
# Omit the objpfx rules when building in the source tree, because
@@ -192,16 +195,19 @@ $(objpfx)%.o: $(objpfx)%.S $(before-compile); $(compile-command.S)
$(objpfx)%.so: $(objpfx)%.S $(before-compile); $(compile-command.S)
$(objpfx)%.po: $(objpfx)%.S $(before-compile); $(compile-command.S)
$(objpfx)%.go: $(objpfx)%.S $(before-compile); $(compile-command.S)
+$(objpfx)%.So: $(objpfx)%.S $(before-compile); $(compile-command.S)
$(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps)
$(objpfx)%.o: $(objpfx)%.s $(before-compile); $(compile-command.s)
$(objpfx)%.so: $(objpfx)%.s $(before-compile); $(compile-command.s)
$(objpfx)%.po: $(objpfx)%.s $(before-compile); $(compile-command.s)
$(objpfx)%.go: $(objpfx)%.s $(before-compile); $(compile-command.s)
+$(objpfx)%.So: $(objpfx)%.s $(before-compile); $(compile-command.s)
$(objpfx)%.d: $(objpfx)%.s $(common-objpfx)dummy.d; $(make-dummy-dep)
$(objpfx)%.o: $(objpfx)%.c $(before-compile); $(compile-command.c)
$(objpfx)%.so: $(objpfx)%.c $(before-compile); $(compile-command.c)
$(objpfx)%.po: $(objpfx)%.c $(before-compile); $(compile-command.c)
$(objpfx)%.go: $(objpfx)%.c $(before-compile); $(compile-command.c)
+$(objpfx)%.So: $(objpfx)%.c $(before-compile); $(compile-command.c)
$(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps)
endif
@@ -343,6 +349,21 @@ $(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
(rm -f $@$($(@F)-version); $(LN_S) $(@F) $@$($(@F)-version))
endef
+ifndef libc.so-version
+# Undefine this because it can't work when we libc.so is unversioned.
+static-only-routines =
+endif
+elide-routines.So = $(filter-out $(static-only-routines),\
+ $(routines) $(aux) $(sysdep_routines))
+
+ifdef static-only-routines
+# These routines are to be omitted from the shared library object,
+# so we replace the PIC objects for them with the empty object file.
+$(static-only-routines:%=$(objpfx)%.so): %.so: $(common-objpfx)empty.o
+ rm -f $@
+ ln $< $@
+endif
+
# 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.
@@ -422,7 +443,7 @@ endif
# Make sure that object files are not removed
# when they are intermediates between sources and library members.
-.PRECIOUS: $(addprefix $(objpfx)%,$(object-suffixes))
+.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))
@@ -450,7 +471,7 @@ o-objects = $(patsubst %.o,%$o,$(filter-out $(patsubst %,$(objpfx)%.o,\
$(elide-routines$o)),\
$(objects)))
-libobjs: $(foreach o,$(object-suffixes),\
+libobjs: $(foreach o,$(object-suffixes-for-libc),\
$(common-objpfx)$(patsubst %,$(libtype$o),c)(\
$(notdir $(o-objects))))
lib-noranlib: libobjs
@@ -459,8 +480,8 @@ others: $(addprefix $(objpfx),$(install-lib))
ifndef objects
# Create the stamp$o files to keep the parent makefile happy.
-subdir_lib: $(foreach o,$(object-suffixes),$(objpfx)stamp$o-$(subdir))
-$(foreach o,$(object-suffixes),$(objpfx)stamp$o-$(subdir)):
+subdir_lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o-$(subdir))
+$(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o-$(subdir)):
$(make-target-directory)
rm -f $@; > $@
else
@@ -474,7 +495,7 @@ $(common-objpfx)$(patsubst %,$(libtype$o),c)(\
$(addsuffix .%,$(filter-out $(elide-routines$o),$(notdir $(objects:.o=))))): \
$(objpfx)stamp.%-$(subdir) ;
endef
-object-suffixes-left := $(object-suffixes)
+object-suffixes-left := $(object-suffixes-for-libc)
include $(o-iterator)
# The pattern rule tells Make to remake $(objpfx)stamp.%-$(subdir) as
@@ -486,7 +507,11 @@ include $(o-iterator)
define o-iterator-doit
$(objpfx)stamp$o-$(subdir): $(objpfx)stamp%-$(subdir): $(o-objects); $$(do-ar)
endef
+ifdef static-only-routines
+object-suffixes-left := $(object-suffixes-for-libc)
+else
object-suffixes-left := $(object-suffixes)
+endif
include $(o-iterator)
define do-ar
topdir=`cd $(..).; pwd`; \
@@ -500,12 +525,20 @@ O%-lib = $(..)$(patsubst %,$(libtype$*),c)
endif
+ifndef static-only-routines
+subdir_lib: $(objpfx)stamp.So-$(subdir)
+$(objpfx)stamp.So-$(subdir):
+ $(make-target-directory)
+ rm -f $@; > $@
+endif
+
# Rules to update the $(ar-symtab-name) member with ranlib,
# one for each object flavor.
define o-iterator-doit
$(common-objpfx)$(patsubst %,$(libtype$o),c)($(ar-symtab-name)): \
+ $(filter-out $(common-objpfx)$(patsubst %,$(libtype$o),c)(),\
$(common-objpfx)$(patsubst %,$(libtype$o),c)(\
- $(patsubst $(objpfx)%,%,$(o-objects))) $(subdirs-stamp-o); \
+ $(patsubst $(objpfx)%,%,$(o-objects)))) $(subdirs-stamp-o); \
$(SHELL) $$(..)./autolock.sh \
$$(common-objpfx)$$(patsubst %,$$(libtype$o),c).lck \
$$(RANLIB) $$(common-objpfx)$$(patsubst %,$$(libtype$o),c)
@@ -515,13 +548,13 @@ subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%-$d)
subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
$(subdirs-stamps): subdir_lib;
endif
-object-suffixes-left = $(object-suffixes)
+object-suffixes-left = $(object-suffixes-for-libc)
include $(o-iterator)
# This makes all the object files.
.PHONY: objects objs
-objects objs: $(foreach o,$(object-suffixes),$(o-objects)) \
+objects objs: $(foreach o,$(object-suffixes-for-libc),$(o-objects)) \
$(addprefix $(objpfx),$(extra-objs))
# Canned sequence for building an extra library archive.
@@ -565,10 +598,9 @@ endef
# should install libc.a; this way "make install" in a subdir is guaranteed
# to install everything it changes.
ifdef objects
-installed-libcs := $(foreach o,$(object-suffixes),\
+installed-libcs := $(foreach o,$(filter-out .so,$(object-suffixes-for-libc)),\
$(inst_libdir)/$(patsubst %,$(libtype$o),\
$(libprefix)$(libc-name)))
-installed-libcs := $(filter-out %_pic.a,$(installed-libcs))
install: $(installed-libcs)
$(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib
$(make-target-directory)
@@ -645,18 +677,15 @@ ifndef subdir
# in libc.a and the dynamic linker is an etra object.
install: $(inst_libdir)/libc.so
$(inst_libdir)/libc.so: $(common-objpfx)libc.so$(libc.so-version) \
- $(elfobjdir)/$(rtld-installed-name) \
- $(inst_libdir)/lib$(libc-name).a
+ $(inst_libdir)/$(patsubst %,$(libtype.So),\
+ $(libprefix)$(libc-name))
(echo '/* GNU ld script';\
echo ' Use the shared library, but some functions are only in';\
- echo ' the static library, so try that secondarily.'; \
- echo ' The dynamic linker defines some functions used by $(<F),';\
- echo ' but ld uses definitions from libc.a before examining the';\
- echo ' dependencies of $(<F) to find $(rtld-installed-name). */';\
+ echo ' the static library, so try that secondarily. */';\
echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
- '$(slibdir)/$(rtld-installed-name)' \
- '$(libdir)/lib$(libc-name).a )' \
- ) > $@.new
+ '$(libdir)/$(patsubst %,$(libtype.So),$(libprefix)$(libc-name))'\
+ ')' \
+ ) > $@.new
mv -f $@.new $@
endif
@@ -846,7 +875,7 @@ common-mostlyclean:
-rm -f core $(common-objpfx)stub-$(subdir)
$(rmobjs)
define rmobjs
-$(foreach o,$(object-suffixes),
+$(foreach o,$(object-suffixes-for-libc),
-rm -f $(addprefix $(objpfx),stamp$o-$(subdir)) $(o-objects))
endef