Problem with OUTPUT_FORMAT in

Steve Bennett steveb at
Fri Jun 26 04:27:02 UTC 2009

I've recently upgraded a project to uClibc and I had a
problem with the way libc/ 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",

This ends up with claiming to only be little endian and when
I compile and link big endian (-mbig-endian), 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?


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

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

diff --git a/libc/ b/libc/
index 6896952..b769dfc 100644
--- a/libc/
+++ b/libc/
@@ -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 $(
@@ -64,6 +66,7 @@ $(libc:.$(MAJOR_VERSION)=): $(libc_OUT)/libc.oS $ 
(libc-nomulti-y:.o=.oS) | $(LIB
         $(Q)$(RM) $@
         $(Q)cp $(top_srcdir)extra/scripts/ $@
+       $(Q)echo "OUTPUT_FORMAT ( $(shell $(OUTPUT_FORMAT)) )" >> $@
  ifeq ($(COMPAT_ATEXIT),y)
(ASNEEDED) )" >> $@

WorkWare Systems Pty Ltd
W:      P: 0434 921 300
E: steveb at   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: <>

More information about the uClibc mailing list