$(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
$(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
(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.
\f
# 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))
$(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
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
$(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
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`; \
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)
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.
# 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)
# 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
-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