[PATCH 4/5] [compiler] Added OPTIMIZE options to enable GCC optimizer

Sascha Hauer s.hauer at pengutronix.de
Fri Oct 15 06:34:58 EDT 2010


On Thu, Oct 14, 2010 at 01:06:45PM +0200, Carsten Schlote wrote:
> From: Carsten Schlote <c.schlote at konzeptpark.de>
> 
> With GCC 4.5.x the default option -Os causes problems on powerpc as it
> tries to move common code to libgcc2, which isn't correctly linked later.
> 
> With optimizer turned off, code compiles fine.
> 
> So I added some options to turn on/off optimization for all architectures
> and to choose between -Os and -O option.
> 
> In case your compiler produces broken code or refuses to link, just try
> without optimization. As it's an option no hack in the Makefile is required
> anymore.
>

Working around weird compiler behaviours is not a good argument for
selling this patch. Anyway, this can still be useful in several
situations like for example getting assembler code which is easier
to debug.

How about making this a choice?

choice
	prompt "compiler optimization"
	default CC_OPTIMIZE_FOR_SIZE

config CC_OPTIMIZE_FOR_SIZE
	bool "optimize for size"

config CC_OPTIMIZE_NONE
	bool "no optimization"

config CC_OPTIMIZE_SPEED
	bool "optimize for speed"

endchoice

This would simplify the ifdefs in the Makefiles. Also, size
optimization should be kept default.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list