diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2011-07-22 13:43:39 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2011-07-22 13:43:39 +0000 |
commit | c837cf0bbdd09079d64188bf0028bb21df2faec7 (patch) | |
tree | d3ead9b4b8d60f25f78b12417b2ba02f14971704 /libc/Makerules | |
parent | a63bdad03a9963d53373008e78fc29ee48f161af (diff) | |
download | eglibc2-c837cf0bbdd09079d64188bf0028bb21df2faec7.tar.gz |
Merge changes between 14282 and r14661 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@14662 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/Makerules')
-rw-r--r-- | libc/Makerules | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/libc/Makerules b/libc/Makerules index f12679354..58047249d 100644 --- a/libc/Makerules +++ b/libc/Makerules @@ -502,6 +502,11 @@ endif endif ifeq (yes,$(elf)) +ifeq (yes,$(use-default-link)) +# If the linker is good enough, we can let it use its default linker script. +shlib-lds = +shlib-lds-flags = +else # binutils only position loadable notes into the first page for binaries, # not for shared objects $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules @@ -537,8 +542,12 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules mv -f $@T $@ common-generated += shlib.lds +shlib-lds = $(common-objpfx)shlib.lds +shlib-lds-flags = -T $(shlib-lds) +endif + define build-shlib -$(build-shlib-helper) -o $@ -T $(common-objpfx)shlib.lds \ +$(build-shlib-helper) -o $@ $(shlib-lds-flags) \ $(csu-objpfx)abi-note.o $(build-shlib-objlist) endef else @@ -580,11 +589,11 @@ 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 $@ -T $(common-objpfx)shlib.lds \ +$(build-module-helper) -o $@ $(shlib-lds-flags) \ $(csu-objpfx)abi-note.o $(build-module-objlist) endef define build-module-asneeded -$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \ +$(build-module-helper) -o $@ $(shlib-lds-flags) \ $(csu-objpfx)abi-note.o \ -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed endef @@ -635,7 +644,24 @@ endif 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 $^ + $(LDFLAGS-c_pic.os) -Wl,-d -Wl,--whole-archive $^ -o $@ + +ifeq (,$(strip $(shlib-lds-flags))) +# Generate a list of -R options to excise .gnu.glibc-stub.* sections. +$(common-objpfx)libc_pic.opts: $(common-objpfx)libc_pic.os + $(OBJDUMP) -h $< | \ + $(AWK) '$$2 ~ /\.gnu\.glibc-stub\./ { print "-R", $$2 }' \ + > $@T + mv -f $@T $@ +# Apply those -R options. +$(common-objpfx)libc_pic.os.clean: $(common-objpfx)libc_pic.opts \ + $(common-objpfx)libc_pic.os + $(OBJCOPY) @$^ $@ +generated += libc_pic.opts libc_pic.os.clean + +libc_pic_clean := .clean +endif + ifneq ($(versioning),yes) # When EGLIBC is built without symbol versioning, local copy of # unwind-dw2-fde-glibc.c is not compiled, so we need to link against @@ -644,10 +670,10 @@ libc_gcclibs := -lgcc_eh endif # Use our own special initializer and finalizer files for libc.so. $(common-objpfx)libc.so: $(elfobjdir)/soinit.os \ - $(common-objpfx)libc_pic.os \ + $(common-objpfx)libc_pic.os$(libc_pic_clean) \ $(elfobjdir)/sofini.os \ $(elfobjdir)/interp.os $(elfobjdir)/ld.so \ - $(common-objpfx)shlib.lds + $(shlib-lds) $(build-shlib) $(libc_gcclibs) # eglibc: ifeq ($(versioning),yes) $(common-objpfx)libc.so: $(common-objpfx)libc.map @@ -721,7 +747,7 @@ include $(patsubst %,$(..)extra-modules.mk,$(modules-names)) extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names)) $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \ - $(objpfx)%.os $(common-objpfx)shlib.lds \ + $(objpfx)%.os $(shlib-lds) \ $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a $(build-module) endif @@ -1013,10 +1039,15 @@ install: $(inst_slibdir)/libc.so$(libc.so-version) $(common-objpfx)format.lds: $(..)scripts/output-format.sed \ $(common-objpfx)config.make \ $(common-objpfx)config.h $(..)Makerules +ifneq (unknown,$(output-format)) + echo > $@.new 'OUTPUT_FORMAT($(output-format))' +else $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \ -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \ | sed -n -f $< > $@.new + test -s $@.new rm -f $@.so +endif mv -f $@.new $@ common-generated += format.lds |