Currently U-boot is linking against libgcc. This should not be needed because the compiler toolchain is usually compiled with a certain OS interface in mind, and can even be configured for GNU-EABI interfaces. This can cause linking conflicts in U-boot when linking to libgcc. It usually becomes really visible that these conflicts are there when some piece of code requires an external routine that is not available in U-boot itself. Such an unresolved external are finally searched in the libgcc library, because U-boot is told to link against. If the compiler happened to be a EABI compiler, linking will definately fail. These are not a compiler problems, but U-boot problems, because U-boot needs to keep its own pants up (It is not linking to any OS, it is standalone) If the compiler is _not_ a EABI compiler toolchain, linking might succeed, but its behaviour will be undefined, because it is unknown what the external dependencies of such libraries will be. (syscalls required?) While looking at compiler includes, the only header used from GCC (I have seen) seems to be the stdarg.h header, which is even doubtful to include in U-boot, because of the same reasons not to link against libgcc. This patch only removes the linking part to libgcc. I tested it on several ARM boards, and linking still works fine... Several older mailthreads that show similar issues (just a simple grep): http://www.mail-archive.com/u-boot-users@lists.sourceforge.net/msg03176.html http://lists.denx.de/pipermail/u-boot/2008-August/039526.html http://lists.denx.de/pipermail/u-boot/2007-July/022881.html Signed-off-by: Remy Bohmer --- Makefile | 3 --- api_examples/Makefile | 5 +---- board/netstar/Makefile | 5 +---- board/trab/Makefile | 5 +---- board/voiceblue/Makefile | 5 +---- examples/Makefile | 10 ++++------ 6 files changed, 8 insertions(+), 25 deletions(-) Index: u-boot/Makefile =================================================================== --- u-boot.orig/Makefile 2008-10-31 23:01:06.000000000 +0100 +++ u-boot/Makefile 2008-10-31 23:02:09.000000000 +0100 @@ -264,9 +264,6 @@ LIBS := $(addprefix $(obj),$(LIBS)) LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a LIBBOARD := $(addprefix $(obj),$(LIBBOARD)) -# Add GCC lib -PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc - # The "tools" are needed early, so put this first # Don't include stuff already done in $(LIBS) SUBDIRS = tools \ Index: u-boot/api_examples/Makefile =================================================================== --- u-boot.orig/api_examples/Makefile 2008-10-31 23:01:07.000000000 +0100 +++ u-boot/api_examples/Makefile 2008-10-31 23:03:22.000000000 +0100 @@ -57,8 +57,6 @@ OBJS := $(addprefix $(obj),$(COBJS)) ELF := $(addprefix $(obj),$(ELF)) BIN := $(addprefix $(obj),$(BIN)) -gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) - CPPFLAGS += -I.. all: $(obj).depend $(OBJS) $(LIB) $(ELF) $(BIN) @@ -70,8 +68,7 @@ $(LIB): $(obj).depend $(LIBOBJS) $(ELF): $(obj)%: $(obj)%.o $(LIB) $(LD) $(obj)crt0.o -Ttext $(LOAD_ADDR) \ - -o $@ $< $(LIB) \ - -L$(gcclibdir) -lgcc + -o $@ $< $(LIB) $(BIN): $(obj)%.bin: $(obj)% Index: u-boot/board/netstar/Makefile =================================================================== --- u-boot.orig/board/netstar/Makefile 2008-10-31 23:01:11.000000000 +0100 +++ u-boot/board/netstar/Makefile 2008-10-31 23:04:17.000000000 +0100 @@ -36,8 +36,6 @@ SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) ee OBJS := $(addprefix $(obj),$(COBJS)) SOBJS := $(addprefix $(obj),$(SOBJS)) -gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) - LOAD_ADDR = 0x10400000 LDSCRIPT = $(TOPDIR)/board/$(BOARDDIR)/eeprom.lds lnk = $(if $(obj),$(obj),.) @@ -54,8 +52,7 @@ $(obj)eeprom.srec: $(obj)eeprom.o $(obj) cd $(lnk) && $(LD) -T $(LDSCRIPT) -g -Ttext $(LOAD_ADDR) \ -o $(<:.o=) -e eeprom eeprom.o eeprom_start.o \ -L$(obj)../../examples -lstubs \ - -L$(obj)../../lib_generic -lgeneric \ - -L$(gcclibdir) -lgcc + -L$(obj)../../lib_generic -lgeneric $(OBJCOPY) -O srec $(<:.o=) $@ $(obj)eeprom.bin: $(obj)eeprom.srec Index: u-boot/board/trab/Makefile =================================================================== --- u-boot.orig/board/trab/Makefile 2008-10-31 23:01:11.000000000 +0100 +++ u-boot/board/trab/Makefile 2008-10-31 23:04:03.000000000 +0100 @@ -36,8 +36,6 @@ SOBJS := $(addprefix $(obj),$(SOBJS)) OBJS_FKT := $(addprefix $(obj),$(COBJS_FKT)) -gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) - LOAD_ADDR = 0xc100000 ######################################################################### @@ -50,8 +48,7 @@ $(LIB): $(obj).depend $(OBJS) $(SOBJS) $(obj)trab_fkt.srec: $(OBJS_FKT) $(LIB) $(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e trab_fkt $^ $(LIB) \ -L$(obj)../../examples -lstubs \ - -L$(obj)../../lib_generic -lgeneric \ - -L$(gcclibdir) -lgcc + -L$(obj)../../lib_generic -lgeneric $(OBJCOPY) -O srec $(<:.o=) $@ $(obj)trab_fkt.bin: $(obj)trab_fkt.srec Index: u-boot/board/voiceblue/Makefile =================================================================== --- u-boot.orig/board/voiceblue/Makefile 2008-10-31 23:01:12.000000000 +0100 +++ u-boot/board/voiceblue/Makefile 2008-10-31 23:03:45.000000000 +0100 @@ -33,8 +33,6 @@ SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) ee OBJS := $(addprefix $(obj),$(COBJS)) SOBJS := $(addprefix $(obj),$(SOBJS)) -gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) - LOAD_ADDR = 0x10400000 LDSCRIPT = $(TOPDIR)/board/$(BOARDDIR)/eeprom.lds lnk = $(if $(obj),$(obj),.) @@ -48,8 +46,7 @@ $(obj)eeprom.srec: $(obj)eeprom.o $(obj) cd $(lnk) && $(LD) -T $(LDSCRIPT) -g -Ttext $(LOAD_ADDR) \ -o $(<:.o=) -e eeprom eeprom.o eeprom_start.o \ -L$(obj)../../examples -lstubs \ - -L$(obj)../../lib_generic -lgeneric \ - -L$(gcclibdir) -lgcc + -L$(obj)../../lib_generic -lgeneric $(OBJCOPY) -O srec $(<:.o=) $@ $(obj)eeprom.bin: $(obj)eeprom.srec Index: u-boot/examples/Makefile =================================================================== --- u-boot.orig/examples/Makefile 2008-10-31 23:01:14.000000000 +0100 +++ u-boot/examples/Makefile 2008-10-31 23:05:12.000000000 +0100 @@ -42,11 +42,11 @@ LOAD_ADDR = 0x80200000 -T mips.lds endif ifeq ($(ARCH),nios) -LOAD_ADDR = 0x00800000 -L $(gcclibdir)/m32 -T nios.lds +LOAD_ADDR = 0x00800000 -T nios.lds endif ifeq ($(ARCH),nios2) -LOAD_ADDR = 0x02000000 -L $(gcclibdir) -T nios2.lds +LOAD_ADDR = 0x02000000 -T nios2.lds endif ifeq ($(ARCH),m68k) @@ -73,7 +73,7 @@ endif endif ifeq ($(ARCH),sparc) -LOAD_ADDR = 0x00000000 -L $(gcclibdir) -T sparc.lds +LOAD_ADDR = 0x00000000 -T sparc.lds endif include $(TOPDIR)/config.mk @@ -158,7 +158,6 @@ ELF := $(addprefix $(obj),$(ELF)) BIN := $(addprefix $(obj),$(BIN)) SREC := $(addprefix $(obj),$(SREC)) -gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) clibdir := $(shell dirname `$(CC) $(CFLAGS) -print-file-name=libc.a`) CPPFLAGS += -I.. @@ -172,8 +171,7 @@ $(LIB): $(obj).depend $(LIBOBJS) $(ELF): $(obj)%: $(obj)%.o $(LIB) $(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \ - -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \ - -L$(gcclibdir) -lgcc + -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) $(SREC): $(obj)%.srec: $(obj)%