diff mbox

[U-Boot] kbuild: fix SPL link bug when USE_PRIVATE_LIBGCC is "yes"

Message ID 1393242254-19189-1-git-send-email-yamada.m@jp.panasonic.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Masahiro Yamada Feb. 24, 2014, 11:44 a.m. UTC
Commit 6825a95 (kbuild: use Linux Kernel build scripts)
changed the behavior of linkage when USE_PRIAVATE_LIBGCC
is defined as "yes".
(It dropped arch/arm/lib/eabi_compat.o from the
target library.)

Affected boards are all Tegra boards.

This commit gets back the same behavior as before Kbuild series.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Warren <twarren@nvidia.com>
Cc: Tom Rini <trini@ti.com>
---

Hello Tom(Rini),

I made a serious mistake in the Kbuild series. (Commit 6825a95)
Sorry.

This patch fixes the problem and gets back the originial
link behavior.

Please pick this.


 spl/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stephen Warren Feb. 24, 2014, 6:02 p.m. UTC | #1
On 02/24/2014 04:44 AM, Masahiro Yamada wrote:
> Commit 6825a95 (kbuild: use Linux Kernel build scripts)
> changed the behavior of linkage when USE_PRIAVATE_LIBGCC
> is defined as "yes".
> (It dropped arch/arm/lib/eabi_compat.o from the
> target library.)
> 
> Affected boards are all Tegra boards.
> 
> This commit gets back the same behavior as before Kbuild series.

Tested-by: Stephen Warren <swarren@nvidia.com>

... although interestingly, at least with the Ubuntu 12.10 ARM
cross-compiler, the resultant U-Boot works fine with or without this
patch. I'd have expected it to fail without this patch since it sounds
like USE_PRIVATE_LIBGCC might not be honored correctly, but perhaps the
linker cmdline order works out such that the custom libgcc happens to be
picked up anyway, just not in the way intended.
Masahiro Yamada Feb. 25, 2014, 12:24 a.m. UTC | #2
Hello Stephen,

On Mon, 24 Feb 2014 11:02:25 -0700
Stephen Warren <swarren@wwwdotorg.org> wrote:

> On 02/24/2014 04:44 AM, Masahiro Yamada wrote:
> > Commit 6825a95 (kbuild: use Linux Kernel build scripts)
> > changed the behavior of linkage when USE_PRIAVATE_LIBGCC
> > is defined as "yes".
> > (It dropped arch/arm/lib/eabi_compat.o from the
> > target library.)
> > 
> > Affected boards are all Tegra boards.
> > 
> > This commit gets back the same behavior as before Kbuild series.
> 
> Tested-by: Stephen Warren <swarren@nvidia.com>
> 
> ... although interestingly, at least with the Ubuntu 12.10 ARM
> cross-compiler, the resultant U-Boot works fine with or without this
> patch. I'd have expected it to fail without this patch since it sounds
> like USE_PRIVATE_LIBGCC might not be honored correctly, but perhaps the
> linker cmdline order works out such that the custom libgcc happens to be
> picked up anyway, just not in the way intended.

Thanks for your test.
It's good to know your boards are already working.
(But I am not sure the build will pass with all sorts of cross tools.)

So it turned out it works with or without arch/arm/lib/eabi_compat.c.

I am not a compiler expert. Nor do I know what eabi_compat.o
is needed for.

Anyway, just in case, we'd better to keep the same link behavior
as before Kbuild.


Best Regards
Masahiro Yamada
Tom Rini Feb. 25, 2014, 1:58 p.m. UTC | #3
On Mon, Feb 24, 2014 at 08:44:14PM +0900, Masahiro Yamada wrote:

> Commit 6825a95 (kbuild: use Linux Kernel build scripts)
> changed the behavior of linkage when USE_PRIAVATE_LIBGCC
> is defined as "yes".
> (It dropped arch/arm/lib/eabi_compat.o from the
> target library.)
> 
> Affected boards are all Tegra boards.
> 
> This commit gets back the same behavior as before Kbuild series.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Tom Warren <twarren@nvidia.com>
> Cc: Tom Rini <trini@ti.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/spl/Makefile b/spl/Makefile
index da1c3c0..346d0aa 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -133,7 +133,8 @@  libs-y := $(patsubst %/, %/built-in.o, $(libs-y))
 
 # Add GCC lib
 ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
-PLATFORM_LIBS := $(SPLTREE)/arch/$(ARCH)/lib/lib.a
+PLATFORM_LIBGCC = $(SPLTREE)/arch/$(ARCH)/lib/lib.a
+PLATFORM_LIBS := $(filter-out %/lib.a, $(filter-out -lgcc, $(PLATFORM_LIBS))) $(PLATFORM_LIBGCC)
 endif
 
 u-boot-spl-init := $(head-y)