[U-Boot] [PATCH 1/2 V2] Move libgcc inclusion from common Makefile to platform configs files

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Jun 20 11:33:26 CEST 2009


This patch moves the libgcc Makefile inclusion from the toplevel Makefile to
the arch_config.mk files. This is in preparation for the ARM architecture to
move away from including libgcc function and only using self-contained U-Boot
functions as done in Linux.

Currently in the next branch all the ARM boards that use the nand are broken due
to the adding of the 64 Bit device size support. In the past we have seen
problems with different toolchains due to EABI, FPU as example.
With this patch and the following one we move away from all these problems and
we will be able to have full control to have a functions embedded into u-boot.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
Rebased against current HEAD

Best Regards,
J.
 Makefile                 |    2 +-
 api_examples/Makefile    |    4 +---
 arm_config.mk            |    2 ++
 avr32_config.mk          |    2 ++
 blackfin_config.mk       |    2 ++
 board/netstar/Makefile   |    4 +---
 board/sl8245/config.mk   |    1 -
 board/trab/Makefile      |    2 --
 board/voiceblue/Makefile |    4 +---
 examples/Makefile        |    2 +-
 i386_config.mk           |    2 ++
 m68k_config.mk           |    2 ++
 microblaze_config.mk     |    2 ++
 mips_config.mk           |    2 ++
 nios2_config.mk          |    2 ++
 nios_config.mk           |    2 ++
 ppc_config.mk            |    2 ++
 sh_config.mk             |    2 ++
 sparc_config.mk          |    2 ++
 19 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile
index 6a2dd9f..8035831 100644
--- a/Makefile
+++ b/Makefile
@@ -288,7 +288,7 @@ 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
+PLATFORM_LIBS += $(PLATFORM_LIBGCC)
 
 ifeq ($(CONFIG_NAND_U_BOOT),y)
 NAND_SPL = nand_spl
diff --git a/api_examples/Makefile b/api_examples/Makefile
index 4c01437..4bfa7e6 100644
--- a/api_examples/Makefile
+++ b/api_examples/Makefile
@@ -56,8 +56,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,7 +68,7 @@ $(ELF):
 $(obj)%:	$(obj)%.o $(LIB)
 		$(LD) $(obj)crt0.o -Ttext $(LOAD_ADDR) \
 			-o $@ $< $(LIB) \
-			-L$(gcclibdir) -lgcc
+			$(PLATFORM_LIBGCC)
 
 $(BIN):
 $(obj)%.bin:	$(obj)%
diff --git a/arm_config.mk b/arm_config.mk
index c4cf99d..b88a3f2 100644
--- a/arm_config.mk
+++ b/arm_config.mk
@@ -24,3 +24,5 @@
 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
 
 LDSCRIPT := $(SRCTREE)/cpu/$(CPU)/u-boot.lds
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/avr32_config.mk b/avr32_config.mk
index 441caa4..8569d5f 100644
--- a/avr32_config.mk
+++ b/avr32_config.mk
@@ -23,3 +23,5 @@
 
 PLATFORM_RELFLAGS	+= -ffixed-r5 -fPIC -mno-init-got -mrelax
 PLATFORM_LDFLAGS	+= --relax
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/blackfin_config.mk b/blackfin_config.mk
index 989e976..1534c0d 100644
--- a/blackfin_config.mk
+++ b/blackfin_config.mk
@@ -60,3 +60,5 @@ LDR_FLAGS += $(LDR_FLAGS-y)
 ifeq ($(wildcard $(TOPDIR)/board/$(BOARD)/u-boot.lds*),)
 LDSCRIPT = $(obj)lib_$(ARCH)/u-boot.lds
 endif
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/board/netstar/Makefile b/board/netstar/Makefile
index 91bac38..1cc2722 100644
--- a/board/netstar/Makefile
+++ b/board/netstar/Makefile
@@ -36,8 +36,6 @@ SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) eeprom.c \
 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),.)
@@ -55,7 +53,7 @@ $(obj)eeprom.srec:	$(obj)eeprom.o $(obj)eeprom_start.o
 		-o $(<:.o=) -e eeprom eeprom.o eeprom_start.o \
 		-L$(obj)../../examples -lstubs \
 		-L$(obj)../../lib_generic -lgeneric \
-		-L$(gcclibdir) -lgcc
+		$(PLATFROM_LIBGCC)
 	$(OBJCOPY) -O srec $(<:.o=) $@
 
 $(obj)eeprom.bin:	$(obj)eeprom.srec
diff --git a/board/sl8245/config.mk b/board/sl8245/config.mk
index 022512b..299fc6c 100644
--- a/board/sl8245/config.mk
+++ b/board/sl8245/config.mk
@@ -28,4 +28,3 @@
 TEXT_BASE = 0xFFF00000
 
 PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
-PLATFORM_LIBS += $(shell $(CC) -print-libgcc-file-name)
diff --git a/board/trab/Makefile b/board/trab/Makefile
index 30e5fbb..a3661c4 100644
--- a/board/trab/Makefile
+++ b/board/trab/Makefile
@@ -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
 
 #########################################################################
diff --git a/board/voiceblue/Makefile b/board/voiceblue/Makefile
index e7c1cbb..0d1e079 100644
--- a/board/voiceblue/Makefile
+++ b/board/voiceblue/Makefile
@@ -33,8 +33,6 @@ SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) eeprom.c eeprom_start.S
 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),.)
@@ -49,7 +47,7 @@ $(obj)eeprom.srec:	$(obj)eeprom.o $(obj)eeprom_start.o
 		-o $(<:.o=) -e eeprom eeprom.o eeprom_start.o \
 		-L$(obj)../../examples -lstubs \
 		-L$(obj)../../lib_generic -lgeneric \
-		-L$(gcclibdir) -lgcc
+		$(PLATFROM_LIBGCC)
 	$(OBJCOPY) -O srec $(<:.o=) $@
 
 $(obj)eeprom.bin:	$(obj)eeprom.srec
diff --git a/examples/Makefile b/examples/Makefile
index dbcfa92..5bd13f1 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -178,7 +178,7 @@ $(ELF):
 $(obj)%:	$(obj)%.o $(LIB)
 		$(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \
 			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
-			-L$(gcclibdir) -lgcc
+			$(PLATFORM_LIBGCC)
 
 $(SREC):
 $(obj)%.srec:	$(obj)%
diff --git a/i386_config.mk b/i386_config.mk
index 9e6d37d..03b2538 100644
--- a/i386_config.mk
+++ b/i386_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/m68k_config.mk b/m68k_config.mk
index 12bd27c..f0c963b 100644
--- a/m68k_config.mk
+++ b/m68k_config.mk
@@ -23,3 +23,5 @@
 
 PLATFORM_CPPFLAGS += -DCONFIG_M68K -D__M68K__
 PLATFORM_LDFLAGS  += -n
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/microblaze_config.mk b/microblaze_config.mk
index e44c79e..5f78c5c 100644
--- a/microblaze_config.mk
+++ b/microblaze_config.mk
@@ -25,3 +25,5 @@
 #
 
 PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/mips_config.mk b/mips_config.mk
index 05eb05d..3ae6c19 100644
--- a/mips_config.mk
+++ b/mips_config.mk
@@ -23,6 +23,8 @@
 
 PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 
+PLATFORM_LIBGCC  += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
+
 #
 # From Linux arch/mips/Makefile
 #
diff --git a/nios2_config.mk b/nios2_config.mk
index 3f23b56..1bf4992 100644
--- a/nios2_config.mk
+++ b/nios2_config.mk
@@ -24,3 +24,5 @@
 
 PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__
 PLATFORM_CPPFLAGS += -ffixed-r15 -G0
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/nios_config.mk b/nios_config.mk
index 1cf0f32..d72db7d 100644
--- a/nios_config.mk
+++ b/nios_config.mk
@@ -23,3 +23,5 @@
 #
 
 PLATFORM_CPPFLAGS += -m32 -DCONFIG_NIOS -D__NIOS__ -ffixed-g7 -gstabs
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/ppc_config.mk b/ppc_config.mk
index c95b3b1..74a4f11 100644
--- a/ppc_config.mk
+++ b/ppc_config.mk
@@ -24,6 +24,8 @@
 PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__
 PLATFORM_LDFLAGS  += -n
 
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
+
 #
 # When cross-compiling on NetBSD, we have to define __PPC__ or else we
 # will pick up a va_list declaration that is incompatible with the
diff --git a/sh_config.mk b/sh_config.mk
index 49d50f7..311699a 100644
--- a/sh_config.mk
+++ b/sh_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
diff --git a/sparc_config.mk b/sparc_config.mk
index 87f745f..15d2f5b 100644
--- a/sparc_config.mk
+++ b/sparc_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_SPARC -D__sparc__
+
+PLATFORM_LIBGCC += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
-- 
1.6.3.1



More information about the U-Boot mailing list