OSDN Git Service

Merge remote-tracking branch 'origin/master' into prelink
[uclinux-h8/uClibc.git] / Makerules
index cb1c554..8d60a62 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -32,12 +32,12 @@ shared_objs = $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y) \
        $(libpthread-so-y) $(libpthread-nonshared-y) $(libthread_db-so-y) \
        $(libresolv-so-y) $(librt-so-y) \
        $(ldso-y) \
-       $(libutil-so-y)
+       $(libutil-so-y) $(libubacktrace-so-y)
 
 ar_objs =  $(libc-y) $(libc-static-y) $(libcrypt-a-y) \
        $(libdl-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y) \
        $(libpthread-a-y) $(libthread_db-a-y) \
-       $(libresolv-a-y) $(librt-a-y) $(libutil-a-y)
+       $(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y)
 ifeq ($(DOPIC),y)
 ar_objs := $(ar_objs:.o=.os)
 endif
@@ -294,10 +294,20 @@ 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) -nostdlib -nostartfiles -shared -Wl,-z,combreloc \
+       -Wl,-z,relro -Wl,--hash-style=gnu -Wl,-z,defs \
+       -Wl,--verbose 2>&1 | LC_ALL=C \
+       sed -e '/^=========/,/^=========/!d;/^=========/d' \
+       -e 's/\. = .* + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' > $@.lds
+endef
+
 define link.so
        $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1)
        @$(disp_ld)
-       $(Q)$(CC) $(LDFLAGS-$(notdir $@)) -Wl,-soname=$(notdir $@).$(2) \
+       $(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(LDFLAGS-y-$(@F)) \
+               -Wl,-soname=$(notdir $@).$(2) \
                $(NOSTDLIB_CFLAGS) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \
                -Wl,--whole-archive $(firstword $^) -Wl,--no-whole-archive \
                $(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@))
@@ -363,8 +373,14 @@ $(top_builddir)%.dep:
 $(top_builddir)lib/interp.c: | $(top_builddir)lib
        $(Q)echo "/* Force shared libraries to know about the correct library loader */" > $@.tmp
        $(Q)echo "#include <features.h>" >> $@.tmp
+ifeq ($(HARDWIRED_ABSPATH),y)
        $(Q)echo "const char __dl_ldso__[] attribute_hidden __attribute__ ((weak)) __attribute__ ((section " \
                "(\".interp\"))) =\""$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(UCLIBC_LDSO)"\";" >> $@.tmp
+       $(Q)$(SED) -i -e 's://:/:g' $@.tmp
+else
+       $(Q)echo "const char __dl_ldso__[] attribute_hidden __attribute__ ((weak)) __attribute__ ((section " \
+               "(\".interp\"))) =\""$(UCLIBC_LDSO)"\";" >> $@.tmp
+endif
        $(Q)mv $@.tmp $@
 
 $(interp): $(top_builddir)lib/interp.c | $(sub_headers)
@@ -437,7 +453,8 @@ endif
 CRTS_COMPAT :=
 #endif
 
-$(crt-y): $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC)
+startfiles = $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC)
+$(crt-y): $(startfiles)
 $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC): | headers
 $(CRTS) $(CTOR_TARGETS) $(CRTS_COMPAT) $(CRTRELOC) $(LINK_FLAT_CRTS) $(SHARED_START_FILES) $(SHARED_END_FILES) : | $(top_builddir)lib
 
@@ -455,7 +472,8 @@ files.dep := $(libc-a-y) $(libc-so-y) $(libc-nonshared-y) \
        $(libthread_db-a-y) $(libthread_db-so-y) $(libpthread-generated-y) \
        $(librt-a-y) $(librt-so-y)  $(libresolv-a-y) $(libresolv-so-y) \
        $(libcrypt-a-y) $(libcrypt-so-y) $(libutil-a-y) $(libutil-so-y) \
-       $(libnsl-a-y) $(libnsl-so-y) $(ldso-y) $(libdl-a-y) $(libdl-so-y)
+       $(libnsl-a-y) $(libnsl-so-y) $(ldso-y) $(libdl-a-y) $(libdl-so-y) \
+       $(libubacktrace-a-y) $(libubacktrace-so-y)
 .depends.dep := \
        $(patsubst %.s,%.s.dep,$(filter %.s,$(files.dep))) \
        $(patsubst %.o,%.o.dep,$(filter %.o,$(files.dep))) \