diff mbox

[U-Boot] examples: select libgcc for non-default architecture

Message ID 1400176075-8709-1-git-send-email-abrodkin@synopsys.com
State Superseded
Delegated to: Wolfgang Denk
Headers show

Commit Message

Alexey Brodkin May 15, 2014, 5:47 p.m. UTC
In case of multilib-enabled toolchains if default architecture differ from
the one examples are being built for linker will fail to link example object
files with libgcc of another (non-compatible) architecture.

Interesting enough for years in main Makefile we used CFLAGS/c_flags for this
but not for examples.

So fixing it now.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
---
 examples/standalone/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Masahiro Yamada May 16, 2014, 2:36 a.m. UTC | #1
Hi Alexey,

On Thu, 15 May 2014 21:47:55 +0400
Alexey Brodkin <Alexey.Brodkin@synopsys.com> wrote:

> In case of multilib-enabled toolchains if default architecture differ from
> the one examples are being built for linker will fail to link example object
> files with libgcc of another (non-compatible) architecture.
> 
> Interesting enough for years in main Makefile we used CFLAGS/c_flags for this
> but not for examples.
> 
> So fixing it now.
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> 
> Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Tom Rini <trini@ti.com>
> ---
>  examples/standalone/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
> index 9ab5446..7234f30 100644
> --- a/examples/standalone/Makefile
> +++ b/examples/standalone/Makefile
> @@ -38,7 +38,8 @@ targets += $(patsubst $(obj)/%,%,$(LIB)) $(COBJS) $(LIBOBJS-y)
>  LIBOBJS	:= $(addprefix $(obj)/,$(LIBOBJS-y))
>  ELF	:= $(addprefix $(obj)/,$(ELF))
>  
> -gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
> +gcclibdir := $(shell dirname \
> +	       `$(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name`)
>  
>  # For PowerPC there's no need to compile standalone applications as a
>  # relocatable executable.  The relocation data is not needed, and
> -- 
> 1.9.0

Looks good to me.

Acked-by: Masahiro Yamada <yamada.m@jp.panasonic.com>



Best Regards
Masahiro Yamada
Wolfgang Denk May 16, 2014, 4:27 a.m. UTC | #2
Dear Alexey Brodkin,

In message <1400176075-8709-1-git-send-email-abrodkin@synopsys.com> you wrote:
> In case of multilib-enabled toolchains if default architecture differ from
> the one examples are being built for linker will fail to link example object
> files with libgcc of another (non-compatible) architecture.
> 
> Interesting enough for years in main Makefile we used CFLAGS/c_flags for this
> but not for examples.
> 
> So fixing it now.
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> 
> Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Tom Rini <trini@ti.com>
> ---
>  examples/standalone/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
> index 9ab5446..7234f30 100644
> --- a/examples/standalone/Makefile
> +++ b/examples/standalone/Makefile
> @@ -38,7 +38,8 @@ targets += $(patsubst $(obj)/%,%,$(LIB)) $(COBJS) $(LIBOBJS-y)
>  LIBOBJS	:= $(addprefix $(obj)/,$(LIBOBJS-y))
>  ELF	:= $(addprefix $(obj)/,$(ELF))
>  
> -gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
> +gcclibdir := $(shell dirname \
> +	       `$(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name`)

Should this not also take CONFIG_USE_PRIVATE_LIBGCC into account ?
I. e. use PLATFORM_LIBGCC ?

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index 9ab5446..7234f30 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -38,7 +38,8 @@  targets += $(patsubst $(obj)/%,%,$(LIB)) $(COBJS) $(LIBOBJS-y)
 LIBOBJS	:= $(addprefix $(obj)/,$(LIBOBJS-y))
 ELF	:= $(addprefix $(obj)/,$(ELF))
 
-gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
+gcclibdir := $(shell dirname \
+	       `$(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name`)
 
 # For PowerPC there's no need to compile standalone applications as a
 # relocatable executable.  The relocation data is not needed, and