From 358cad7c11db498d30cc756cd0881aee2e7270ff Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 26 Apr 2003 23:38:49 +0000 Subject: * 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. --- ChangeLog | 12 ++++++++++++ Makerules | 41 ++++++++++++++++++++--------------------- dlfcn/Makefile | 2 +- iconvdata/extra-module.mk | 3 ++- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b75fdbba8..a970370b69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2003-04-26 Roland McGrath + + * 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 * sysdeps/mach/hurd/tmpfile.c: Remove USE_IN_LIBIO conditionals. diff --git a/Makerules b/Makerules index d8eae55a3b..ec44400863 100644 --- a/Makerules +++ b/Makerules @@ -511,17 +511,23 @@ endif ifeq (yes,$(elf)) # binutils only position loadable notes into the first page for binaries, # not for shared objects -define build-shlib -$(build-shlib-helper) \ - -o $@.new $(csu-objpfx)abi-note.o -Wl,--verbose \ - $(LDLIBS-$(@F:lib%.so=%).so) 2>&1 | \ - sed -e '/^=========/,/^=========/!d;/^=========/d' \ +$(common-objpfx)shlib.lds: $(common-objpfx)config.make + $(LINK.o) -shared -Wl,-O1 \ + $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \ + -Wl,--verbose 2>&1 | \ + sed > $@T \ + -e '/^=========/,/^=========/!d;/^=========/d' \ -e 's/^.*\.hash[ ]*:.*$$/ .note.ABI-tag : { *(.note.ABI-tag) } &/' \ - $(LDSEDCMD-$(@F:lib%.so=%).so) > $@.lds -rm -f $@.new -$(build-shlib-helper) -o $@ -T $@.lds \ + -e 's/^.*\*(\.dynbss).*$$/& \ + PROVIDE(__start___libc_freeres_ptrs = .); \ + *(__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) -rm -f $@.lds endef else ifneq (,$(findstring aix,$(config-os))) @@ -561,16 +567,8 @@ ifeq (yes,$(elf)) # binutils only position loadable notes into the first page for binaries, # not for shared objects define build-module -$(build-module-helper) \ - -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 \ +$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \ $(csu-objpfx)abi-note.o $(build-module-objlist) -rm -f $@.lds endef else ifneq (,$(findstring aix,$(config-os))) @@ -592,7 +590,7 @@ endif build-module-helper-objlist = \ $(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 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 $(LINK.o) -nostdlib -nostartfiles -r -o $@ \ $(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. $(common-objpfx)libc.so: $(elfobjdir)/soinit.os \ $(common-objpfx)libc_pic.os \ $(elfobjdir)/sofini.os \ - $(elfobjdir)/interp.os $(elfobjdir)/ld.so + $(elfobjdir)/interp.os $(elfobjdir)/ld.so \ + $(common-objpfx)shlib.lds $(build-shlib) ifeq ($(versioning),yes) $(common-objpfx)libc.so: $(common-objpfx)libc.map diff --git a/dlfcn/Makefile b/dlfcn/Makefile index 9115d30c2a..c3d7ecbfc7 100644 --- a/dlfcn/Makefile +++ b/dlfcn/Makefile @@ -62,7 +62,7 @@ include ../Rules LDFLAGS-dl.so = -Wl,-dynamic-linker,$(slibdir)/$(rtld-installed-name) 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) $(objpfx)glrefmain: $(libdl) diff --git a/iconvdata/extra-module.mk b/iconvdata/extra-module.mk index e00eb5e8d2..7eda4e25aa 100644 --- a/iconvdata/extra-module.mk +++ b/iconvdata/extra-module.mk @@ -3,7 +3,8 @@ extra-modules-left := $(strip $(filter-out $(mod),$(extra-modules-left))) 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) # Depend on libc.so so a DT_NEEDED is generated in the shared objects. -- cgit v1.2.3