public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] gcc, ARM, -fdata-sections -fmerge-constants and strings
@ 2012-08-20 16:55 Tom Rini
  0 siblings, 0 replies; only message in thread
From: Tom Rini @ 2012-08-20 16:55 UTC (permalink / raw)
  To: u-boot

Hey all,

As I just mentioned in another thread, gcc bug #54303 [1] causes us
problems.  -fmerge-constants is an optimization enabled in most levels.
On some platforms such as x86_64, when used with -fdata-sections it
means that each set of "strings" in a function will result in a
per-function .rodata.strN.N section.  Later when a function isn't used
these sections can also be garbage collected.  However, on ARM this
isn't what happens.  All strings for an object file are collected into a
single .rodata.strN.N section.  Further, these sections are combined
again when we link our library.  This means that we can only garbage
collect strings for a given library when none of them are used.  This is
OK in some cases as we luck out and don't need any of the functions with
printf/puts.  In other cases, such as if we move the SPL framework to
common/ all of the strings we need will be retained.  This pushes us
over the size limit in some cases, along with being a flat-out bug.

As this is a bug, and something that is handled correctly on other
platforms my hope is that fixing the problem won't be hard for someone
that knows the toolchain and eventually we can set a minimum requirement
on a gcc without this bug.  A work-around for this would be to disable
-fmerge-constants but this results in a larger SPL binary, but not so
large as when we collected nothing.  It is larger than being careful
about where we place source files, so I would only suggest this as a
work-around once we have a fixed gcc available.

[1]
 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54303

-- 
Tom

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-20 16:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20 16:55 [U-Boot] gcc, ARM, -fdata-sections -fmerge-constants and strings Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox