Re: [arm-gnu] Image size reduction with linker optimization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] Image size reduction with linker optimization



On Fri, Feb 06, 2009 at 08:37:14AM +1100, James wrote:
> > * Link with --gc-sections.  This will only help.
> 
> With this alone, I get infinitely small code that unfortunately doesn't
> run.  For some reason the linker thought it was cool to remove *all*
> text, bss and data sections.

Normally this means you did not tell the linker about the entry point
of your program.  Try adding a -Wl,-e,SYMBOLNAME if the entry point is
not named _start, or using KEEP in the linker script to ensure the
reset vector is not discarded.

> Optimisations caused a heap of warnings to be generated by the ST FWLib,
> as in;
> 
> ../../FWLib/library/src/stm32f10x_tim.c:368: warning: dereferencing
> type-punned pointer will break strict-aliasing rules
> 
> Adding -fno-strict-aliasing ignored the warning, but is this a good
> idea?  Or should ST be changing their FWLib source?

ST should fix it, but using the flag is generally a safe workaround.

-- 
Daniel Jacobowitz
CodeSourcery