We have the following patches in our tree to improve shared flat support
in uClibc for the Blackfin.
* We want to use -mleaf-id-shared-library to compile libc (but only
libc). This works best by setting PICFLAG to -mleaf-id-shared-library
and using libc_so.a instead of libc.a in the link.
* It seems like a good idea to just pull in all of libgcc.a into the
shared libc as well.
* Use $(UCLIBC_SHARED_FLAT_ID) instead of $(SHARED_FLAT_ID) - seems
like this was just an error in the initial commit.
Does anyone object to these changes? If not, I'll commit them soon.
Bernd
--
This footer brought to you by insane German lawmakers.
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif
Index: Makerules
===================================================================
--- Makerules (revision 20471)
+++ Makerules (working copy)
@@ -146,6 +146,9 @@ LINK_FLAT_CRTS := $(top_builddir)lib/Scr
# 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).
+#
+# This is so far only used for libc, for which we want to link the entire
+# libgcc into the shared object.
define link-flat.so
$(Q)$(INSTALL) -d $(dir $@)
$(Q)$(RM) $(1) $@
@@ -153,7 +156,7 @@ define link-flat.so
$(Q)$(CC) $(LDFLAGS-$(notdir $@)) -nostdlib -o $(1) \
-Wl,-elf2flt -Wl,-shared-lib-id $(2) $(top_builddir)lib/Scrt1.o
\
$(top_builddir)/lib/crti.o -Wl,--whole-archive $(firstword $^) \
- -Wl,--no-whole-archive $(LIBS-$(notdir $@)) $(LIBGCC) \
+ $(LIBGCC) -Wl,--no-whole-archive $(LIBS-$(notdir $@)) $(LIBGCC)
\
$(top_builddir)/lib/crtn.o
endef
Index: libc/Makefile.in
===================================================================
--- libc/Makefile.in (revision 20471)
+++ libc/Makefile.in (working copy)
@@ -93,8 +93,11 @@ $(top_builddir)lib/libc.a: $(libc-a-y) |
$(do_strip)
$(do_ar)
-$(top_builddir)lib/libc.gdb: $(top_builddir)lib/libc.a $(LINK_FLAT_CRTS)
- $(call link-flat.so,$(@:.gdb=),$(SHARED_FLAT_ID))
+# We use libc_so.a so that we can compile the shared library with special
+# flags - i.e. -mleaf-id-shared-library. The static libc.a needs to be
+# compiled without it.
+$(top_builddir)lib/libc.gdb: $(libc_OUT)/libc_so.a $(LINK_FLAT_CRTS)
+ $(call link-flat.so,$(@:.gdb=),$(UCLIBC_SHARED_FLAT_ID))
libc_clean:
$(RM) $(libc_OUT)/*.{o,os,oS,a}
Index: libc/misc/internals/Makefile.in
===================================================================
--- libc/misc/internals/Makefile.in (revision 20471)
+++ libc/misc/internals/Makefile.in (working copy)
@@ -16,11 +16,18 @@ MISC_INTERNALS_SRC := $(patsubst %.c,$(M
MISC_INTERNALS_OBJ := $(patsubst %.c,$(MISC_INTERNALS_OUT)/%.o,$(CSRC))
libc-y += $(MISC_INTERNALS_OBJ)
+ifneq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
libc-shared-y += $(MISC_INTERNALS_OUT)/__uClibc_main.oS
+else
+libc-shared-y += $(MISC_INTERNALS_OUT)/__uClibc_main.os
+endif
libc-static-y += $(MISC_INTERNALS_OUT)/__uClibc_main.o
libc-static-$(UCLIBC_FORMAT_SHARED_FLAT) += \
$(MISC_INTERNALS_OUT)/shared_flat_initfini.o \
$(MISC_INTERNALS_OUT)/shared_flat_add_library.o
+libc-shared-$(UCLIBC_FORMAT_SHARED_FLAT) += \
+ $(MISC_INTERNALS_OUT)/shared_flat_initfini.os \
+ $(MISC_INTERNALS_OUT)/shared_flat_add_library.os
libc-nomulti-y += $(MISC_INTERNALS_OUT)/__uClibc_main.o
objclean-y += misc_internals_objclean
_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc