summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makerules13
-rw-r--r--Rules.mak1
-rw-r--r--ldso/ldso/Makefile.in13
3 files changed, 7 insertions, 20 deletions
diff --git a/Makerules b/Makerules
index 10dc5298f..dd19cea79 100644
--- a/Makerules
+++ b/Makerules
@@ -326,22 +326,13 @@ endef
cmd_hcompile.u = $(HOSTCC) $(filter-out $(PHONY),$^) $(DEPS-$(notdir $@)) -o $@ $(BUILD_LDFLAGS) $(BUILD_LDFLAGS-$(notdir $(^D))) $(BUILD_LDFLAGS-$(notdir $@)) $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@))
cmd_hcompile.o = $(HOSTCC) $(filter-out $(PHONY),$<) $(DEPS-$(notdir $@)) -c -o $@ $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@))
-define create-lds
- $(Q)$(RM) $@.lds
- $(Q)$(CC) $(LDFLAG-fuse-ld) $(CPU_LDFLAGS-y) \
- -nostdlib -nostartfiles -shared -Wl,-z,combreloc \
- -Wl,-z,relro $(CFLAG_-Wl--hash-style=gnu) -Wl,-z,defs \
- -x c /dev/null -Wl,--verbose 2>&1 | LC_ALL=C \
- $(SED) -e '/^=========/,/^=========/!d;/^=========/d' \
- -e 's/^\([ ]*\)\. = .* + SIZEOF_HEADERS;/&\n\1$(SYMBOL_PREFIX)_begin = . - SIZEOF_HEADERS;/' > $@.lds
-endef
-
define link.so
$(Q)$(RM) $@ $@.$(2) $(dir $@)$(1)
@$(disp_ld)
$(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(LDFLAGS-y-$(@F)) \
-Wl,-soname=$(notdir $@).$(2) \
- $(CFLAG_-nostdlib) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
+ $(CFLAG_-nostdlib) $(CFLAG_-nostartfiles) \
+ -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
-Wl,--whole-archive $(firstword $^) -Wl,--no-whole-archive \
$(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@))
$(Q)$(LN) -sf $(1) $@.$(2)
diff --git a/Rules.mak b/Rules.mak
index 83d78ff28..71ceb9022 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -255,6 +255,7 @@ ARFLAGS:=cr
# Note: The check for -nostdlib has to be before all calls to check_ld
$(eval $(call check-gcc-var,-nostdlib))
+$(eval $(call check-gcc-var,-nostartfiles))
# deliberately not named CFLAG-fuse-ld since unchecked and from user
LDFLAG-fuse-ld := $(filter -fuse-ld=%,$(call qstrip,$(UCLIBC_EXTRA_CFLAGS)))
# failed to merge target specific data of file /dev/null
diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in
index 815264291..9b04d619f 100644
--- a/ldso/ldso/Makefile.in
+++ b/ldso/ldso/Makefile.in
@@ -33,10 +33,13 @@ LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS)
else
LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
endif
-LDFLAGS-$(UCLIBC_LDSO_NAME).so += -Wl,-e,$(SYMBOL_PREFIX)_start -Wl,-z,now -Wl,-Bsymbolic \
+LDFLAGS-$(UCLIBC_LDSO_NAME).so += -Wl,-e,$(SYMBOL_PREFIX)_start \
+ -Wl,-z,now -Wl,-Bsymbolic \
-Wl,--export-dynamic $(CFLAG_-Wl--sort-common) -Wl,--discard-locals \
$(CFLAG_-Wl--discard-all) -Wl,--no-undefined
+LDFLAGS-$(LDSO_PRELINK_SUPPORT)-$(UCLIBC_LDSO_NAME).so += -Wl,-defsym=$(SYMBOL_PREFIX)_begin=0
+
ldso_FULL_NAME := $(UCLIBC_LDSO_NAME)-$(VERSION).so
$(UCLIBC_LDSO_NAME)_DIR := $(top_srcdir)ldso/ldso
@@ -62,17 +65,9 @@ ldso-y := $($(UCLIBC_LDSO_NAME)_OBJS:.o=.oS)
lib-so-y += $(ldso)
objclean-y += CLEAN_ldso/ldso
-ifeq ($(LDSO_PRELINK_SUPPORT),y)
-# Use a specific linker script for ld.so
-LDFLAGS-$(UCLIBC_LDSO_NAME).so += -T $(ldso:.$(ABI_VERSION)=).lds
-endif
-
$(ldso): $(ldso:.$(ABI_VERSION)=)
$(ldso:.$(ABI_VERSION)=): | $(top_builddir)lib
$(ldso:.$(ABI_VERSION)=): $($(UCLIBC_LDSO_NAME)_OUT)/$(UCLIBC_LDSO_NAME)_so.a
-ifeq ($(LDSO_PRELINK_SUPPORT),y)
- $(call create-lds)
-endif
$(call link.so,$(ldso_FULL_NAME),$(ABI_VERSION))
$($(UCLIBC_LDSO_NAME)_OUT)/$(UCLIBC_LDSO_NAME)_so.a: $(ldso-y)