RFC: Using per function sections

Joel Sherrill joel.sherrill at OARcorp.com
Fri Apr 12 14:29:36 UTC 2013

On 4/12/2013 3:55 AM, Sebastian Huber wrote:
> On 04/12/2013 09:07 AM, Sebastian Huber wrote:
>> Hello Joel,
>> what is this for an option?
> Ok, this seems to be -ffunction-sections and -fdata-sections in combination
> with -Wl,-gc-sections.
> For -Wl,-gc-sections to work the linker command files must be written properly.
Yes. The additions to the .cfg files was:

CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections

LDFLAGS = -Wl,--gc-sections

On the powerpc/icecube, I saw some very large improvements
with average between 10-20%.  I know the spfatal* tests are
oddities but one dropped to 4K.

The til800 is already a low memory board so some tests are
disabled and it is compiled at -Os. But it was solidly 6-9%.

sparc/sis linked 80 byte .text sections so clearly has an issue

I am pretty sure most of the linker scripts already support
the "*" on the sections.

I could do some more analysis but IMO this looks to be an
effective option. I would like to sweep it through everything
an architecture at a time. Verifying (1) exe's still link,
(2) the changes in size are reasonable (unlike the sparc),
and (3) ticker still runs (where possible).

This is an old feature in the tools we don't take advantage of
and it appears to be very effective. Code and data size is important
to the Community.

It is also something that could easily be spread across multiple
people to get done quicker.

Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

More information about the users mailing list