How about add two new configuration options(-ffunction-sections -fdata-sections)

Schwarz, Konrad
Tue Feb 28 08:22:00 GMT 2012

> -----Original Message-----
> From: []
> On Behalf Of Howland Craig D (Craig)

> One opinion is that if it is done, it must not be the default.  Quoting
> from the GCC manual regarding -ffunction-sections and -fdata-sections:
> "Only use these options when there are significant benefits from doing
> so. When you specify these options, the assembler and linker will
> create
> larger object and executable files and will also be slower. You will
> not
> be able to use gprof on all systems if you specify this option and you
> may have problems with debugging if you specify both this option and
> -g."

> -----Original Message-----
> From: []
> On Behalf Of Bin Cheng
> Sent: Sunday, February 19, 2012 11:02 PM
> To:
> Subject: How about add two new configuration options(-ffunction-
> sections
> -fdata-sections)
> Hi,
> Now in newlib there are cases where different functions are implemented
> in
> one c source file.
> So how about adding two configuration options like
> "--enable-function-sections"/"-fdata-sections"
> which builds newlib with "-ffunction-sections" and "-fdata-sections"
> options.
> With this, we can cut binary size with link's option "--gc-sections".
> Now in gcc, libgcc/libstdc++ are built with this options defaultly for
> cross
> compiling.
> Should we enable this in Newlib?

Why not split files containing multiple functions with non-static linkage into separate
files, one per function?

More information about the Newlib mailing list