aboutsummaryrefslogtreecommitdiff
path: root/Makerules
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2011-06-25 00:06:42 -0700
committerRoland McGrath <roland@hack.frob.com>2011-07-02 15:21:27 -0700
commit1b74661a6b93a892ecb1c717dedeedba5c2a976c (patch)
tree56bd14f4f2ea8e15e03fc80c8044ba96fbfa5514 /Makerules
parentf781ef4015504e8a1da649c266584976238aa079 (diff)
downloadglibc-1b74661a6b93a892ecb1c717dedeedba5c2a976c.zip
glibc-1b74661a6b93a892ecb1c717dedeedba5c2a976c.tar.gz
glibc-1b74661a6b93a892ecb1c717dedeedba5c2a976c.tar.bz2
Explicitly remove .gnu.glibc-stub sections with objcopy when not using
linker script.
Diffstat (limited to 'Makerules')
-rw-r--r--Makerules21
1 files changed, 19 insertions, 2 deletions
diff --git a/Makerules b/Makerules
index 23d9f1c..3234fc2 100644
--- a/Makerules
+++ b/Makerules
@@ -621,10 +621,27 @@ 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
+
# 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 \
$(shlib-lds)