Toolchain setup-env LDFLAGS definition broken?

Nigel Cunningham nigel at
Wed May 14 03:20:51 CEST 2008


On Mon, 2008-05-12 at 17:58 +0200, Michael 'Mickey' Lauer wrote:
> On Monday 12 May 2008 07:41:47 Mike (mwester) wrote:
> > So the problem is that the link phase is using ld directly when the
> > LDFLAGS variable seems to be constructed in such a fashion to be used by
> > gcc when gcc is doing the linking.  One of the two is wrong; now the
> > trick is to figure out which it is.
> We usually use gcc also for linking.

In that case, the problem with building u-boot is in the toplevel
Makefile, but I'm no gcc guru, so I haven't been able to get the
invocation right. My patch at the moment is as follows.



diff --git a/Makefile b/Makefile
index 51f269c..77e14c8 100644
--- a/Makefile
+++ b/Makefile
@@ -322,9 +322,9 @@ $(obj)u-boot.dis:   $(obj)u-boot
 $(obj)u-boot:          depend $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
                UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed  -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
-               cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
+               cd $(LNDIR) && $(CC) $(OBJCFLAGS) $(LIBS) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
                        --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
-                       -Map -o u-boot
+                       -Wl, -o u-boot
 $(OBJS):       depend $(obj)include/
                $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
diff --git a/cpu/arm920t/ b/cpu/arm920t/
index 3494243..7dba43b 100644
--- a/cpu/arm920t/
+++ b/cpu/arm920t/
@@ -33,5 +33,5 @@ PLATFORM_CPPFLAGS += -march=armv4t
 #PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
 PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
 PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
-PLATFORM_LDFLAGS += --defsym raise=hang
+PLATFORM_LDFLAGS += $(call cc-option,--defsym raise=hang)

More information about the openmoko-kernel mailing list