diff mbox

[U-Boot] standalone-examples: support custom GCC lib

Message ID 1373982263-32012-2-git-send-email-ml@communistcode.co.uk
State Changes Requested
Delegated to: Tom Rini
Headers show

Commit Message

Jack Mitchell July 16, 2013, 1:44 p.m. UTC
From: Jack Mitchell <jack.mitchell@dbbroadcast.co.uk>

Add support for defining the gcc lib in standalone examples as is
done in the main u-boot Makefile

Signed-off-by: Jack Mitchell <jack.mitchell@dbbroadcast.co.uk>
---
 examples/standalone/Makefile | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

Comments

Tom Rini Sept. 6, 2013, 9:24 p.m. UTC | #1
On Tue, Jul 16, 2013 at 02:44:23PM +0100, Jack Mitchell wrote:

> From: Jack Mitchell <jack.mitchell@dbbroadcast.co.uk>
> 
> Add support for defining the gcc lib in standalone examples as is
> done in the main u-boot Makefile
> 
> Signed-off-by: Jack Mitchell <jack.mitchell@dbbroadcast.co.uk>

Applied to u-boot/master, thanks!
Tom Rini Sept. 10, 2013, 1:55 p.m. UTC | #2
On Tue, Jul 16, 2013 at 02:44:23PM +0100, Jack Mitchell wrote:

> From: Jack Mitchell <jack.mitchell@dbbroadcast.co.uk>
> 
> Add support for defining the gcc lib in standalone examples as is
> done in the main u-boot Makefile
> 
> Signed-off-by: Jack Mitchell <jack.mitchell@dbbroadcast.co.uk>
> 
> ---
> examples/standalone/Makefile | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
> index baaa2fb..b1be527 100644
> --- a/examples/standalone/Makefile
> +++ b/examples/standalone/Makefile
> @@ -68,7 +68,18 @@ ELF	:= $(addprefix $(obj),$(ELF))
>  BIN	:= $(addprefix $(obj),$(BIN))
>  SREC	:= $(addprefix $(obj),$(SREC))
>  
> -gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
> +# Add GCC lib
> +ifdef USE_PRIVATE_LIBGCC
> +ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
> +PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
> +else
> +PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
> +endif
> +else
> +PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
> +endif
> +PLATFORM_LIBS += $(PLATFORM_LIBGCC)
> +export PLATFORM_LIBS

We already inherit this logic from the top level Makefile, so this leads
to duplicating $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o in PLATFORM_LIBS.
Second, currently for ARM, libgcc.o ends up requring 'hang' to be
provided.
diff mbox

Patch

diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index baaa2fb..b1be527 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -68,7 +68,18 @@  ELF	:= $(addprefix $(obj),$(ELF))
 BIN	:= $(addprefix $(obj),$(BIN))
 SREC	:= $(addprefix $(obj),$(SREC))
 
-gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
+# Add GCC lib
+ifdef USE_PRIVATE_LIBGCC
+ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
+PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
+else
+PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
+endif
+else
+PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
+endif
+PLATFORM_LIBS += $(PLATFORM_LIBGCC)
+export PLATFORM_LIBS
 
 CPPFLAGS += -I..
 
@@ -98,7 +109,7 @@  $(ELF):
 $(obj)%:	$(obj)%.o $(LIB)
 		$(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
 			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
-			-L$(gcclibdir) -lgcc
+			$(PLATFORM_LIBS)
 
 $(SREC):
 $(obj)%.srec:	$(obj)%