Skip to contentSkip to conversation

arm: Enable -ffunction-sections / -fdata-sections / --gc-sections

PATCH New Tom Rini 2 participants 4 messages Apr 25, 2013 – May 28, 2013 Arm (32-bit)

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 arm: Enable -ffunction-sections / -fdata-sections / --gc-sections

While other architectures have enabled these gcc / ld options for some time on U-Boot itself, ARM has only been doing this on SPL. Enable this on full U-Boot as well now.

Cc Albert ARIBAUD <[email protected]>
---
 arch/arm/config.mk         |    3 +++
 arch/arm/cpu/ixp/config.mk |    4 ----
 2 files changed, 3 insertions(+), 4 deletions(-)
arch/arm/config.mk +3 -0
index 461899e..dc64160 100644
@@ -31,6 +31,9 @@ CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
 endif
 endif
 
+LDFLAGS_FINAL += --gc-sections
+PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
+
 # Support generic board on ARM
 __HAVE_ARCH_GENERIC_BOARD := y
 
arch/arm/cpu/ixp/config.mk +0 -4
index b02e8af..fd3c29f 100644
@@ -31,10 +31,6 @@ PLATFORM_CPPFLAGS += -mbig-endian -march=armv5te -mtune=strongarm1100
 PLATFORM_LDFLAGS += -EB
 USE_PRIVATE_LIBGCC = yes
 
-# -fdata-sections triggers "section .bss overlaps section .rel.dyn" linker error
-PLATFORM_RELFLAGS += -ffunction-sections
-LDFLAGS_u-boot += --gc-sections
-
 # =========================================================================
 #
 # Supply options according to compiler version
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 arm: Enable -ffunction-sections / -fdata-sections / --gc-sections

Hi Tom,

Quoted 3 lines · Tom Rini

While other architectures have enabled these gcc / ld options for some time on U-Boot itself, ARM has only been doing this on SPL. Enable this on full U-Boot as well now.

I expect this was tested on various targets?

Amicalement,

Signature · 1 line
Albert.
author
#2 lore raw

PATCH 1/1 arm: Enable -ffunction-sections / -fdata-sections / --gc-sections

Quoted 9 lines · Albert ARIBAUD

Hi Tom,

Quoted 3 lines · Tom Rini

While other architectures have enabled these gcc / ld options for some time on U-Boot itself, ARM has only been doing this on SPL. Enable this on full U-Boot as well now.

I expect this was tested on various targets?

I build-tested eldk 4.2/5.2 and the Linaro 4.7 that Ubuntu has available, with no build failures. I spot checked what was being dropped on am335x and some omap3/4 platforms and it looked correct, and I did boot test am335x.

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/20130523/787b2205/attachment.pgp>
#3 lore raw

PATCH 1/1 arm: Enable -ffunction-sections / -fdata-sections / --gc-sections

In reply to Tom Rini

Hi Tom,

Quoted 30 lines · Tom Rini

While other architectures have enabled these gcc / ld options for some time on U-Boot itself, ARM has only been doing this on SPL. Enable this on full U-Boot as well now.

Cc Albert ARIBAUD <[email protected]>
---
 arch/arm/config.mk         |    3 +++
 arch/arm/cpu/ixp/config.mk |    4 ----
 2 files changed, 3 insertions(+), 4 deletions(-)
arch/arm/config.mk +3 -0
index 461899e..dc64160 100644
@@ -31,6 +31,9 @@ CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
 endif
 endif
 
+LDFLAGS_FINAL += --gc-sections
+PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
+
 # Support generic board on ARM
 __HAVE_ARCH_GENERIC_BOARD := y
 
arch/arm/cpu/ixp/config.mk +0 -0
index b02e8af..fd3c29f 100644

arch/arm/cpu/ixp/config.mk PLATFORM_CPPFLAGS += -mbig-endian -march=armv5te -mtune=strongarm1100 · line 36

Quoted 10 lines
arch/arm/cpu/ixp/config.mk +0 -4
@@ -31,10 +31,6 @@ PLATFORM_CPPFLAGS += -mbig-endian -march=armv5te -mtune=strongarm1100
 PLATFORM_LDFLAGS += -EB
 USE_PRIVATE_LIBGCC = yes
 
-# -fdata-sections triggers "section .bss overlaps section .rel.dyn" linker error
-PLATFORM_RELFLAGS += -ffunction-sections
-LDFLAGS_u-boot += --gc-sections
-
 # =========================================================================
 #
 # Supply options according to compiler version

Applied to u-boot-arm/master, thanks!

Amicalement,

Signature · 1 line
Albert.