Problem with OUTPUT_FORMAT in formats.lds

Steve Bennett steveb at workware.net.au
Fri Jun 26 04:27:02 UTC 2009


I've recently upgraded a project to uClibc 0.9.30.1 and I had a
problem with the way libc/libc.so is created.

In the following commit I see that OUTPUT_FORMAT is determined
based on the first "word" of OUTPUT_FORMAT in the linker script.

However my toolchain (arm-linux-gcc) gives:

   OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
                 "elf32-littlearm")

This ends up with libc.so claiming to only be little endian and when
I compile and link big endian (-mbig-endian), libc.so is ignore and
all my apps link statically.

Is there any reason that the entire OUTPUT_FORMAT is not taken?
It works for me when I do this (per the attached patch).

Any comments? Mike?

Cheers,
Steve

commit 86fffacc269de9e2e8bfc126fc78627fb690e91a
Author: Mike Frysinger <vapier at gentoo.org>
Date:   Sat Sep 15 07:40:58 2007 +0000

     setup OUTPUT_FORMAT() in linker script (helps with multilib)

diff --git a/libc/Makefile.in b/libc/Makefile.in
index 6896952..b769dfc 100644
--- a/libc/Makefile.in
+++ b/libc/Makefile.in
@@ -54,6 +54,8 @@ lib-gdb-y += $(top_builddir)lib/libc.gdb
  lib-so-y += $(libc)
  objclean-y += libc_clean

+OUTPUT_FORMAT = $(CC) $(CFLAGS) $(LDFLAGS) -Wl,--verbose 2>&1 | sed - 
n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p'
+
  ifeq ($(DOMULTI),n)
  $(libc:.$(MAJOR_VERSION)=): $(libc_OUT)/libc_so.a $(LIBS-libc.so)
         $(call link.so,$(libc_FULL_NAME),$(MAJOR_VERSION))
@@ -64,6 +66,7 @@ $(libc:.$(MAJOR_VERSION)=): $(libc_OUT)/libc.oS $ 
(libc-nomulti-y:.o=.oS) | $(LIB
  endif
         $(Q)$(RM) $@
         $(Q)cp $(top_srcdir)extra/scripts/format.lds $@
+       $(Q)echo "OUTPUT_FORMAT ( $(shell $(OUTPUT_FORMAT)) )" >> $@
  ifeq ($(COMPAT_ATEXIT),y)
         $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_MAJORNAME) $ 
(ASNEEDED) )" >> $@
  else

--
WorkWare Systems Pty Ltd
W: www.workware.net.au      P: 0434 921 300
E: steveb at workware.net.au   F: 07 3102 9221


-------------- next part --------------
A non-text attachment was scrubbed...
Name: output-format-endian.patch
Type: application/octet-stream
Size: 994 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20090626/9cff0ab7/attachment.obj>


More information about the uClibc mailing list