Makefile: Introduce ARCH_PLATFORM_LIBGCC variable
Subsystems (2)
PATCH 1/1 Makefile: Introduce ARCH_PLATFORM_LIBGCC variable
In some cases, such as arm multi-lib hardfloat (hf) toolchains, we will have multiple libgcc.a's available, and the arch needs to provide additional logic to determine the right file to use (-print-libgcc-file-name contains no CFLAG parsing logic).
--- Makefile | 4 ++++ arch/arm/config.mk | 11 +++++++++++ 2 files changed, 15 insertions(+)
Makefile +4 -0
@@ -357,8 +357,12 @@ else PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc endif else +ifneq ("$(ARCH_PLATFORM_LIBGCC)","") +PLATFORM_LIBGCC := -L $(shell dirname $(ARCH_PLATFORM_LIBGCC)) -lgcc +else PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc endif +endif PLATFORM_LIBS += $(PLATFORM_LIBGCC) export PLATFORM_LIBS
arch/arm/config.mk +11 -0
@@ -19,6 +19,17 @@ LDFLAGS_FINAL += --gc-sections PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \ -fno-common -ffixed-r9 -msoft-float +# +# When we use a hardfp toolchain if there are both 'libgcc.a' (hardfp) and +# 'arm-linux-gnueabi/libgcc.a' (softfp) we need to use the latter. We +# cannot always build with a hardfp-only toolchain. +# +ARCH_PLATFORM_LIBGCC := $(shell \ + X=`$(CC) -print-file-name=arm-linux-gnueabi/libgcc.a`; \ + if [ -f $$X ]; then echo $$X ; \ + else $(CC) -print-file-name=libgcc.a ; \ + fi) + # Support generic board on ARM __HAVE_ARCH_GENERIC_BOARD := y
Signature · 1 line
1.7.9.5
PATCH 1/1 Makefile: Introduce ARCH_PLATFORM_LIBGCC variable
Quoted 7 lines · Tom Rini
In some cases, such as arm multi-lib hardfloat (hf) toolchains, we will have multiple libgcc.a's available, and the arch needs to provide additional logic to determine the right file to use (-print-libgcc-file-name contains no CFLAG parsing logic).
Cc Albert Aribaud <[email protected]>Signed-off-by Tom Rini <[email protected]>
For the record, build-tested with ELDKs for arm, powerpc and mips, and other toolchains for nds32 m68k x86 and sandbox.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131011/76e15dd8/attachment.pgp>
PATCH 1/1 Makefile: Introduce ARCH_PLATFORM_LIBGCC variable
In reply to Tom RiniHi Tom,
Quoted 34 lines · Tom Rini
In some cases, such as arm multi-lib hardfloat (hf) toolchains, we will have multiple libgcc.a's available, and the arch needs to provide additional logic to determine the right file to use (-print-libgcc-file-name contains no CFLAG parsing logic).
Cc Albert Aribaud <[email protected]>Signed-off-by Tom Rini <[email protected]>--- Makefile | 4 ++++ arch/arm/config.mk | 11 +++++++++++ 2 files changed, 15 insertions(+)Makefile +4
-0@@ -357,8 +357,12 @@ else PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc endif else +ifneq ("$(ARCH_PLATFORM_LIBGCC)","") +PLATFORM_LIBGCC := -L $(shell dirname $(ARCH_PLATFORM_LIBGCC)) -lgcc +else PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc endif +endif PLATFORM_LIBS += $(PLATFORM_LIBGCC) export PLATFORM_LIBSarch/arm/config.mk +0
-0
arch/arm/config.mk LDFLAGS_FINAL += --gc-sections · line 25
Quoted 7 lines
arch/arm/config.mk +4
-0@@ -19,6 +19,17 @@ LDFLAGS_FINAL += --gc-sections PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \ -fno-common -ffixed-r9 -msoft-float +# +# When we use a hardfp toolchain if there are both 'libgcc.a' (hardfp) and +# 'arm-linux-gnueabi/libgcc.a' (softfp) we need to use the latter. We +# cannot always build with a hardfp-only toolchain.
What does this last sentence mean exactly?
arch/arm/config.mk LDFLAGS_FINAL += --gc-sections · line 34
Quoted 8 lines
arch/arm/config.mk +6
-0+ARCH_PLATFORM_LIBGCC := $(shell \ + X=`$(CC) -print-file-name=arm-linux-gnueabi/libgcc.a`; \ + if [ -f $$X ]; then echo $$X ; \ + else $(CC) -print-file-name=libgcc.a ; \ + fi) + # Support generic board on ARM __HAVE_ARCH_GENERIC_BOARD := y
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 Makefile: Introduce ARCH_PLATFORM_LIBGCC variable
Quoted 41 lines · Albert ARIBAUD
Hi Tom,
Quoted 37 lines · Tom Rini
In some cases, such as arm multi-lib hardfloat (hf) toolchains, we will have multiple libgcc.a's available, and the arch needs to provide additional logic to determine the right file to use (-print-libgcc-file-name contains no CFLAG parsing logic).
Cc Albert Aribaud <[email protected]>Signed-off-by Tom Rini <[email protected]>--- Makefile | 4 ++++ arch/arm/config.mk | 11 +++++++++++ 2 files changed, 15 insertions(+)Makefile +4
-0@@ -357,8 +357,12 @@ else PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc endif else +ifneq ("$(ARCH_PLATFORM_LIBGCC)","") +PLATFORM_LIBGCC := -L $(shell dirname $(ARCH_PLATFORM_LIBGCC)) -lgcc +else PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc endif +endif PLATFORM_LIBS += $(PLATFORM_LIBGCC) export PLATFORM_LIBSarch/arm/config.mk +0
-0@@ -19,6 +19,17 @@ LDFLAGS_FINAL += --gc-sections PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \ -fno-common -ffixed-r9 -msoft-float
Quoted 6 lines
arch/arm/config.mk LDFLAGS_FINAL += --gc-sections · line 25
Quoted 4 lines
arch/arm/config.mk +4
-0+# +# When we use a hardfp toolchain if there are both 'libgcc.a' (hardfp) and +# 'arm-linux-gnueabi/libgcc.a' (softfp) we need to use the latter. We +# cannot always build with a hardfp-only toolchain.What does this last sentence mean exactly?
What it says. If a hardfp only toolchain is used certain targets shall not link. I had Marek confirm this as well. I don't have the exact logs handy, but today there's a few targets that will fail, and the nand flash patchset introduces another because we enforce -msoft-float on U-Boot, and rely on libgcc from the toolchain for certain functions (__udivdi3 for example).
I don't know how you weren't making this fail on ELDK 5.x armv7a-fp, but I was and the Linaro 2013.03 toolchain also will show this problem. Once I push the nand PR (shortly), building for am3517_crane for example will fail without this patch.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131014/7071935f/attachment.pgp>
PATCH 1/1 Makefile: Introduce ARCH_PLATFORM_LIBGCC variable
Hi Tom,
Quoted 49 lines · Tom Rini
Quoted 41 lines · Albert ARIBAUD
Hi Tom,
Quoted 37 lines · Tom Rini
In some cases, such as arm multi-lib hardfloat (hf) toolchains, we will have multiple libgcc.a's available, and the arch needs to provide additional logic to determine the right file to use (-print-libgcc-file-name contains no CFLAG parsing logic).
Cc Albert Aribaud <[email protected]>Signed-off-by Tom Rini <[email protected]>--- Makefile | 4 ++++ arch/arm/config.mk | 11 +++++++++++ 2 files changed, 15 insertions(+)Makefile +4
-0@@ -357,8 +357,12 @@ else PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc endif else +ifneq ("$(ARCH_PLATFORM_LIBGCC)","") +PLATFORM_LIBGCC := -L $(shell dirname $(ARCH_PLATFORM_LIBGCC)) -lgcc +else PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc endif +endif PLATFORM_LIBS += $(PLATFORM_LIBGCC) export PLATFORM_LIBSarch/arm/config.mk +0
-0@@ -19,6 +19,17 @@ LDFLAGS_FINAL += --gc-sections PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \ -fno-common -ffixed-r9 -msoft-floatQuoted 6 lines
arch/arm/config.mk LDFLAGS_FINAL += --gc-sections · line 25
Quoted 4 lines
arch/arm/config.mk +4
-0+# +# When we use a hardfp toolchain if there are both 'libgcc.a' (hardfp) and +# 'arm-linux-gnueabi/libgcc.a' (softfp) we need to use the latter. We +# cannot always build with a hardfp-only toolchain.What does this last sentence mean exactly?
Quoted 6 lines
What it says. If a hardfp only toolchain is used certain targets shall not link. I had Marek confirm this as well. I don't have the exact logs handy, but today there's a few targets that will fail, and the nand flash patchset introduces another because we enforce -msoft-float on U-Boot, and rely on libgcc from the toolchain for certain functions (
__udivdi3for example).
I was wondering if the sentence meant this, or if it meant "there is no way we can ensure that we'll always build with a hardfp-only toolchain".
Maybe the ambiguity would be lifted by saying "Building with a hardfp-only toolchain will fail [for some targets]"?
Quoted 4 lines
I don't know how you weren't making this fail on ELDK 5.x armv7a-fp, but I was and the Linaro 2013.03 toolchain also will show this problem. Once I push the nand PR (shortly), building for
am3517_cranefor example will fail without this patch.
That may be because I have several toolchains installed, one of which is in the standard path (/usr/bin, /usr/lib, etc).
Amicalement,
Signature · 1 line
Albert.