* Makerules ($(common-objpfx)shlib.lds): New target.

(common-generated): Add it.
	(build-shlib, build-module): Use that instead of generating every time.
	($(common-objpfx)libc.so): Depend on it.
	(lib%.so rule): Likewise.
	(build-module-helper-objlist): Remove %.lds.
	* iconvdata/extra-module.mk ($(objpfx)$(mod).so):
	Depend on $(common-objpfx)shlib.lds.
	* dlfcn/Makefile ($(test-modules)): Likewise.
This commit is contained in:
Roland McGrath 2003-04-26 23:38:49 +00:00
parent d3f063bc78
commit 358cad7c11
4 changed files with 35 additions and 23 deletions

View File

@ -1,3 +1,15 @@
2003-04-26 Roland McGrath <roland@redhat.com>
* Makerules ($(common-objpfx)shlib.lds): New target.
(common-generated): Add it.
(build-shlib, build-module): Use that instead of generating every time.
($(common-objpfx)libc.so): Depend on it.
(lib%.so rule): Likewise.
(build-module-helper-objlist): Remove %.lds.
* iconvdata/extra-module.mk ($(objpfx)$(mod).so):
Depend on $(common-objpfx)shlib.lds.
* dlfcn/Makefile ($(test-modules)): Likewise.
2003-04-26 Roland McGrath <roland@frob.com> 2003-04-26 Roland McGrath <roland@frob.com>
* sysdeps/mach/hurd/tmpfile.c: Remove USE_IN_LIBIO conditionals. * sysdeps/mach/hurd/tmpfile.c: Remove USE_IN_LIBIO conditionals.

View File

@ -511,17 +511,23 @@ endif
ifeq (yes,$(elf)) ifeq (yes,$(elf))
# binutils only position loadable notes into the first page for binaries, # binutils only position loadable notes into the first page for binaries,
# not for shared objects # not for shared objects
define build-shlib $(common-objpfx)shlib.lds: $(common-objpfx)config.make
$(build-shlib-helper) \ $(LINK.o) -shared -Wl,-O1 \
-o $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \ $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
$(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \ -Wl,--verbose 2>&1 | \
sed -e '/^=========/,/^=========/!d;/^=========/d' \ sed > $@T \
-e '/^=========/,/^=========/!d;/^=========/d' \
-e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \ -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
$(LDSEDCMD-$(@F:lib%.so=%).so) > $@.lds -e 's/^.*\*(\.dynbss).*$$/& \
rm -f $@.new PROVIDE(__start___libc_freeres_ptrs = .); \
$(build-shlib-helper) -o $@ -T $@.lds \ *(__libc_freeres_ptrs) \
PROVIDE(__stop___libc_freeres_ptrs = .);/'
mv -f $@T $@
common-generated += shlib.lds
define build-shlib
$(build-shlib-helper) -o $@ -T $(common-objpfx)shlib.lds \
$(csu-objpfx)abi-note.o $(build-shlib-objlist) $(csu-objpfx)abi-note.o $(build-shlib-objlist)
rm -f $@.lds
endef endef
else else
ifneq (,$(findstring aix,$(config-os))) ifneq (,$(findstring aix,$(config-os)))
@ -561,16 +567,8 @@ ifeq (yes,$(elf))
# binutils only position loadable notes into the first page for binaries, # binutils only position loadable notes into the first page for binaries,
# not for shared objects # not for shared objects
define build-module define build-module
$(build-module-helper) \ $(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \
-o $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \
$(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \
sed -e '/^=========/,/^=========/!d;/^=========/d' \
-e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \
> $@.lds
rm -f $@.new
$(build-module-helper) -o $@ -T $@.lds \
$(csu-objpfx)abi-note.o $(build-module-objlist) $(csu-objpfx)abi-note.o $(build-module-objlist)
rm -f $@.lds
endef endef
else else
ifneq (,$(findstring aix,$(config-os))) ifneq (,$(findstring aix,$(config-os)))
@ -592,7 +590,7 @@ endif
build-module-helper-objlist = \ build-module-helper-objlist = \
$(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\ $(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
$(filter-out $(map-file) $(+preinit) $(+postinit),$^)) $(filter-out %.lds $(map-file) $(+preinit) $(+postinit),$^))
whole-archive := -Wl,--whole-archive whole-archive := -Wl,--whole-archive
build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so) build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so)
@ -618,12 +616,13 @@ ifeq ($(elf),yes)
$(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a $(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
$(LINK.o) -nostdlib -nostartfiles -r -o $@ \ $(LINK.o) -nostdlib -nostartfiles -r -o $@ \
$(LDFLAGS-c_pic.os) -Wl,-d -Wl,--whole-archive $^ $(LDFLAGS-c_pic.os) -Wl,-d -Wl,--whole-archive $^
LDSEDCMD-c.so = -e 's/^.*\*(\.dynbss).*$$/& __start___libc_freeres_ptrs = .; *(__libc_freeres_ptrs) __stop___libc_freeres_ptrs = .;/' LDSEDCMD-c.so = -e 's/^.*\*(\.dynbss).*$$/& *(__libc_freeres_ptrs)/'
# Use our own special initializer and finalizer files for libc.so. # Use our own special initializer and finalizer files for libc.so.
$(common-objpfx)libc.so: $(elfobjdir)/soinit.os \ $(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
$(common-objpfx)libc_pic.os \ $(common-objpfx)libc_pic.os \
$(elfobjdir)/sofini.os \ $(elfobjdir)/sofini.os \
$(elfobjdir)/interp.os $(elfobjdir)/ld.so $(elfobjdir)/interp.os $(elfobjdir)/ld.so \
$(common-objpfx)shlib.lds
$(build-shlib) $(build-shlib)
ifeq ($(versioning),yes) ifeq ($(versioning),yes)
$(common-objpfx)libc.so: $(common-objpfx)libc.map $(common-objpfx)libc.so: $(common-objpfx)libc.map

View File

@ -62,7 +62,7 @@ include ../Rules
LDFLAGS-dl.so = -Wl,-dynamic-linker,$(slibdir)/$(rtld-installed-name) LDFLAGS-dl.so = -Wl,-dynamic-linker,$(slibdir)/$(rtld-installed-name)
test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names))) test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
$(test-modules): $(objpfx)%.so: $(objpfx)%.os $(test-modules): $(objpfx)%.so: $(objpfx)%.os $(common-objpfx)shlib.lds
$(build-module) $(build-module)
$(objpfx)glrefmain: $(libdl) $(objpfx)glrefmain: $(libdl)

View File

@ -3,7 +3,8 @@ extra-modules-left := $(strip $(filter-out $(mod),$(extra-modules-left)))
extra-objs := $(extra-objs) $(patsubst %,%.os,$($(mod)-routines)) extra-objs := $(extra-objs) $(patsubst %,%.os,$($(mod)-routines))
$(objpfx)$(mod).so: $(addprefix $(objpfx),$(addsuffix .os,$($(mod)-routines))) $(objpfx)$(mod).so: $(addprefix $(objpfx),$(addsuffix .os,$($(mod)-routines)))\
$(common-objpfx)shlib.lds
$(build-module) $(build-module)
# Depend on libc.so so a DT_NEEDED is generated in the shared objects. # Depend on libc.so so a DT_NEEDED is generated in the shared objects.