Skip to contentSkip to conversation

Add gc-section support for ARM

PATCH New Charles Manning 6 participants 10 messages May 3, 2012 – May 29, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add gc-section support for ARM

Seems odd that this hasn't been done yet.
Shaves 5k off an omap overo build.

---
 arch/arm/config.mk |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/config.mk +4 -0
index 45f9dca..73e0cce 100644
@@ -55,6 +55,10 @@ PF_CPPFLAGS_ABI := $(call cc-option,\
 		)
 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
 
+PLATFORM_RELFLAGS += -ffunction-sections
+
+LDFLAGS_FINAL += --gc-sections
+
 # For EABI, make sure to provide raise()
 ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
 # This file is parsed many times, so the string may get added multiple
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 Add gc-section support for ARM

Quoted 2 lines · On Wednesday 02 May 2012 21:37:51 Charles Manning wrote:

Seems odd that this hasn't been done yet.
Shaves 5k off an omap overo build.

my understanding is that it doesn't work for some

Quoted 1 line

+PLATFORM_RELFLAGS += -ffunction-sections

where's the -fdata-sections ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120514/98198026/attachment.pgp>

#2 lore raw

PATCH 1/1 Add gc-section support for ARM

Quoted 5 lines · On Monday 14 May 2012 17:15:50 Mike Frysinger wrote:
Quoted 2 lines · On Wednesday 02 May 2012 21:37:51 Charles Manning wrote:

Seems odd that this hasn't been done yet.
Shaves 5k off an omap overo build.

my understanding is that it doesn't work for some

It won't work for people that don't set up their lds properly.

Quoted 4 lines
Quoted 2 lines

+PLATFORM_RELFLAGS += -ffunction-sections

where's the -fdata-sections ?

I tried that once before and could not get that to work with u-boot. I figure doing just the function sections is better than nothing.

#3 lore raw

PATCH 1/1 Add gc-section support for ARM

Quoted 8 lines · On Monday 14 May 2012 17:01:30 Charles Manning wrote:
Quoted 5 lines · On Monday 14 May 2012 17:15:50 Mike Frysinger wrote:
Quoted 2 lines · On Wednesday 02 May 2012 21:37:51 Charles Manning wrote:

Seems odd that this hasn't been done yet.
Shaves 5k off an omap overo build.

my understanding is that it doesn't work for some

It won't work for people that don't set up their lds properly.

current u-boot policy is to not introduce changes that knowingly break other platforms. so if you want to update the common arm config.mk, you need to at least compile test all arm boards.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

+PLATFORM_RELFLAGS += -ffunction-sections

where's the -fdata-sections ?

I tried that once before and could not get that to work with u-boot. I figure doing just the function sections is better than nothing.

so even your lds isn't setup properly ? :P

other arches are using both fine, so it isn't a problem of common code. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120515/486101de/attachment.pgp>

#4 lore raw

PATCH 1/1 Add gc-section support for ARM

Le 15/05/2012 07:12, Mike Frysinger a ?crit :

Quoted 6 lines · On Monday 14 May 2012 17:01:30 Charles Manning wrote:
Quoted 5 lines · On Monday 14 May 2012 17:15:50 Mike Frysinger wrote:
Quoted 4 lines · On Wednesday 02 May 2012 21:37:51 Charles Manning wrote:
Quoted 2 lines

Seems odd that this hasn't been done yet.
Shaves 5k off an omap overo build.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

my understanding is that it doesn't work for some

It won't work for people that don't set up their lds properly.

current u-boot policy is to not introduce changes that knowingly break other platforms. so if you want to update the common arm config.mk, you need to at least compile test all arm boards.

... and considering this is dependent on toolchain setups, this should also be performed for the most common toolchains versions around (ELDK 4.2 and 5.x; CS 2011, 2010, maybe even 2009; Linaro; LLVM even).

Quoted 11 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

+PLATFORM_RELFLAGS += -ffunction-sections

where's the -fdata-sections ?

I tried that once before and could not get that to work with u-boot. I figure doing just the function sections is better than nothing.

so even your lds isn't setup properly ? :P

other arches are using both fine, so it isn't a problem of common code. -mike

Amicalement,

Signature · 1 line
Albert.
#5 lore raw

PATCH 1/1 Add gc-section support for ARM

In reply to Mike Frysinger
Quoted 6 lines · On Tuesday 15 May 2012 17:12:05 Mike Frysinger wrote:
Quoted 5 lines · On Monday 14 May 2012 17:01:30 Charles Manning wrote:
Quoted 4 lines · On Monday 14 May 2012 17:15:50 Mike Frysinger wrote:
Quoted 2 lines · On Wednesday 02 May 2012 21:37:51 Charles Manning wrote:

Seems odd that this hasn't been done yet.
Shaves 5k off an omap overo build.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

my understanding is that it doesn't work for some

It won't work for people that don't set up their lds properly.

current u-boot policy is to not introduce changes that knowingly break other platforms. so if you want to update the common arm config.mk, you need to at least compile test all arm boards.

Doesn't that makes it an impossible task? Not having all the boards makes it pretty hard to test them all.

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

+PLATFORM_RELFLAGS += -ffunction-sections

where's the -fdata-sections ?

I tried that once before and could not get that to work with u-boot. I figure doing just the function sections is better than nothing.

so even your lds isn't setup properly ? :P

Correct. I was aiming to achieve a certain size. Once I achieved that I stopped fiddling. The problem was probably in the relocation stuff.

Quoted 2 lines

other arches are using both fine, so it isn't a problem of common code.

I might be incorrect, but I have noticed what appears to be some differences between different versions of binutils.

-- CHarles

#6 lore raw

PATCH 1/1 Add gc-section support for ARM

Dear Charles,

Quoted 1 line · In message <[email protected]> you wrote:

On Tuesday 15 May 2012 17:12:05 Mike Frysinger wrote:

...

Quoted 3 lines
Quoted 3 lines

current u-boot policy is to not introduce changes that knowingly break other platforms. so if you want to update the common arm config.mk, you need to at least compile test all arm boards.

---------------------^^^^^^^^^^^^

Quoted 2 lines

Doesn't that makes it an impossible task? Not having all the boards makes it pretty hard to test them all.

A compile test does not require any actual hardware.

Quoted 4 lines
Quoted 1 line

other arches are using both fine, so it isn't a problem of common code.

I might be incorrect, but I have noticed what appears to be some differences between different versions of binutils.

Please be more specific. The same "different versions of binutils" appear to work fine on other architectures ?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Even if you aren't in doubt, consider the mental welfare of the  per-
son who has to maintain the code after you, and who will probably put
parens in the wrong place.          - Larry Wall in the perl man page
#7 lore raw

PATCH 1/1 Add gc-section support for ARM

Quoted 11 lines · On Wednesday 16 May 2012 10:25:26 Wolfgang Denk wrote:

Dear Charles,

Quoted 1 line · In message <[email protected]> you wrote:

On Tuesday 15 May 2012 17:12:05 Mike Frysinger wrote:

...

Quoted 3 lines
Quoted 3 lines

current u-boot policy is to not introduce changes that knowingly break other platforms. so if you want to update the common arm config.mk, you need to at least compile test all arm boards.

Quoted 6 lines

---------------------^^^^^^^^^^^^

Quoted 2 lines

Doesn't that makes it an impossible task? Not having all the boards makes it pretty hard to test them all.

A compile test does not require any actual hardware.

Does the patch fail I submitted fail any compile tests?

AFAIK, it compiles but the resulting binary might just be rubbish on some boards.

It worked fine on my overo board without any changes to the overo lds.

I have just verified that it builds on
overo
mx51evk
davinci_sonata

If there is an expectation to build every possible config is there a script that will do that?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

other arches are using both fine, so it isn't a problem of common code.

I might be incorrect, but I have noticed what appears to be some differences between different versions of binutils.

Please be more specific. The same "different versions of binutils" appear to work fine on other architectures ?

That was based on some observations a year or two ago. I don't know if the problem has now gone away and have no way of reproducing it.

-- Charles

#8 lore raw

PATCH 1/1 Add gc-section support for ARM

Quoted 26 lines · Charles Manning
Quoted 11 lines · On Wednesday 16 May 2012 10:25:26 Wolfgang Denk wrote:

Dear Charles,

Quoted 1 line · In message <[email protected]> you wrote:

On Tuesday 15 May 2012 17:12:05 Mike Frysinger wrote:

...

Quoted 3 lines
Quoted 3 lines

current u-boot policy is to not introduce changes that knowingly break other platforms. so if you want to update the common arm config.mk, you need to at least compile test all arm boards.

Quoted 6 lines

---------------------^^^^^^^^^^^^

Quoted 2 lines

Doesn't that makes it an impossible task? Not having all the boards makes it pretty hard to test them all.

A compile test does not require any actual hardware.

Does the patch fail I submitted fail any compile tests?

AFAIK, it compiles but the resulting binary might just be rubbish on some boards.

It worked fine on my overo board without any changes to the overo lds.

Quoted 7 lines

I have just verified that it builds on
overo
mx51evk
davinci_sonata

If there is an expectation to build every possible config is there a script that will do that?

Yes, MAKEALL in the top level. Assuming you've installed ELDK5.1 or 4.2 to their default locations:

$ source /opt/eldk-5.1/armv7a/environment-setup-armv7a-vfp-neon-linux-gnueabi
$ CROSS_COMPILE=arm-linux-gnueabi- BUILD_DIR=eldk51 ./MAKEALL -a arm
$ CROSS_COMPILE=/opt/eldk-4.2/arm/usr/bin/arm-linux-gnueabi- BUILD_DIR=eldk42 ./MAKEALL -a arm

(I've got the above in a script with a few tweaks to build all TI stuff, for example).

Signature · 1 line
Tom
#9 lore raw

PATCH 1/1 Add gc-section support for ARM

In reply to Charles Manning

Dear Charles Manning,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines
Quoted 2 lines

+PLATFORM_RELFLAGS += -ffunction-sections

where's the -fdata-sections ?

I tried that once before and could not get that to work with u-boot. I figure doing just the function sections is better than nothing.

What exactly do you mean by "could not get that to work"? What exactly was the problem? And which exact tool chain did you use then?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Why waste negative entropy on comments, when you could use the  same
entropy to create bugs instead?"                        - Steve Elias