large G++ locale overhead in g++ 4.9.2

Joel Sherrill joel.sherrill at
Mon Jun 29 14:38:06 UTC 2015

On June 29, 2015 9:05:30 AM CDT, Gedare Bloom <gedare at> wrote:
>On Mon, Jun 29, 2015 at 10:02 AM, Peter Dufault <dufault at>
>>> On Jun 29, 2015, at 09:28 , Sebastian Huber
><sebastian.huber at> wrote:
>>>> By only including the RTEMS shell commands I use I reduced the size
>to 1839664 (latest RTEMS) vs 1624684 (September RTEMS), about a 13%
>increase, but at least it fits in FLASH.
>>>> The overhead appears to be mostly all the locale “stuff” in g++
>4.9.2 vs g++ 4.8.2.  I did some googling but don’t see how to reduce
>this, does anyone know of a way?  I really don’t need currency
>>> What pulls in this locale stuff? Maybe
>>> CFLAGS += -ffunction-sections -fdata-sections
>>> LDFLAGS = -Wl,--gc-sections
>>> helps?
>> I don’t know what pulls in the locale stuff or how to disable it.

The -Map option to ld will show the dependency that pulled in each function or data element.. File level without those options.

It would be good to know what causes this all to get pulled in.

>> Your suggested flags makes a huge difference, it’s now 1424272 bytes
>in size, at 12% decrease from September and a 22% decrease from
>building the application with gcc 4.9.2 without the flags. I don’t see
>as much locale stuff in there.  I only recompiled the user application
>code and not RTEMS itself.

Awesome! I thought it would help.

>> Even better the application still runs.
>> How can these options change what gets linked in?
>These options let the compiler put every function in its own section
>and use extra data sections, and the linker to remove any that are
>unused. So it can provide a fine-tune way to remove unused code at
>link time, but you need to be careful to mark any special sections
>that must not be garbage-collected. I think Joel did this for the
>SPARC. As you noticed, the options can make a big difference!
>> Peter
>> -----------------
>> Peter Dufault
>> HD Associates, Inc.      Software and System Engineering
>> _______________________________________________
>> devel mailing list
>> devel at
>devel mailing list
>devel at


More information about the devel mailing list