diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-12-08 22:53:40 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-12-08 22:53:40 +0000 |
commit | 808694e8a330e32741b7781467610d8cec99ae6e (patch) | |
tree | a2114e7c67f1f88f5df4687d6ab7122892e68283 /Makerules | |
parent | cba2c53724a6ed35f32775ec38906268c1bbd340 (diff) |
Richard Sandiford writes: add support for init/fini arrays in shared flat libraries
Diffstat (limited to 'Makerules')
-rw-r--r-- | Makerules | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -11,6 +11,9 @@ libs: $(lib-so-y) $(lib-a-y) $(lib-so-y): $(interp) else .LIBPATTERNS: "lib%.a" +ifeq ($(HAVE_SHARED_FLAT),y) +libs: $(lib-gdb-y) +endif libs: $(lib-a-y) endif objs: all_objs @@ -131,6 +134,29 @@ define link.so $(Q)$(LN) -sf $(1) $@ endef +# CRT files needed by link-flat.so +LINK_FLAT_CRTS := $(top_builddir)lib/Scrt1.o $(top_builddir)lib/crti.o \ + $(top_builddir)lib/crtn.o + +# Create a shared flat library from the archive named by the first dependency. +# $@ names the shared library's .gdb file, not the flat file itself. +# (This is because the .gdb suffix makes the ELF file more distinctive +# than the suffixless flat file.) +# +# Argument 1 is the shared library file -- i.e. $(@:.gdb=) -- and argument 2 +# is the shared library identifier. If it wasn't for $(disp_ld), we could +# avoid passing $(@:.gdb=) as an argument and use $(@:.gdb=) instead of $(1). +define link-flat.so + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $(1) $@ + @$(disp_ld) + $(Q)$(LD) $(LDFLAGS-$(notdir $@)) -o $(1) \ + -elf2flt -shared-lib-id $(2) $(top_builddir)lib/Scrt1.o \ + $(top_builddir)/lib/crti.o --whole-archive $(firstword $^) \ + --no-whole-archive $(LIBS-$(notdir $@)) $(LIBGCC) \ + $(top_builddir)/lib/crtn.o +endef + define linkm.so $(Q)$(INSTALL) -d $(dir $@) $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1) @@ -181,7 +207,7 @@ $(headers_dep): CRT := crt1 -ifeq ($(HAVE_SHARED),y) +ifeq ($(HAVE_SHARED)$(HAVE_SHARED_FLAT),y) CRTS=$(top_builddir)lib/$(CRT).o $(top_builddir)lib/S$(CRT).o else CRTS=$(top_builddir)lib/$(CRT).o |