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

Bin Cheng
Tue Feb 21 22:41:00 GMT 2012

> 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."
Yes, it should be disabled by default.

> By the way, have you estimated the potential savings?
Here is size information for an typical mcu program:
$ arm-none-eabi-size app.axf.gc_section
   text	   data	    bss	    dec	    hex	filename
  35032	   2492	   2260	  39784	   9b68	app.axf.gc_section
$ arm-none-eabi-size 
   text	   data	    bss	    dec	    hex	filename
  41144	   2560	   2300	  46004	   b3b4

Thanks very much.

More information about the Newlib mailing list