Disable size optimization (-0s) for package

Hi,

what is an simple way to disable size optimizations for a package and to use e.g. -O3 instead?

Add this in the makefile:

TARGET_CFLAGS += -O3

Beware that O3 is known to cause bad code (compilation may still finish just fine however) and the benefit isn't great between Os and O3 in most cases. In some cases O3 might even be slower....

I was going to comment on that but decided to answer the question asked and not presume ignorance on the part of the OP.

I compile a few packages with -O2 -- there's only bloat with -O3 with no noticeable improvement on the packages I've chosen and as you mentioned, chances of breakage.

Are there any news findings regarding optimization ? I just read @jeff post:


And He mentioned about https://github.com/diizzyy/openwrt/commit/648711831477cf624c4d58e91a064de302e4813d
but In this post (above) it was mention that between -Os and O2 "with no noticeable improvement" .
What about GCC 7 vs GCC 9 ?

I just quickly check for kirkwood architecture. And there no difference in speed for "cifsd" module/package

# CONFIG_BINUTILS_USE_VERSION_2_31_1 is not set
CONFIG_BINUTILS_USE_VERSION_2_32=y
CONFIG_BINUTILS_VERSION="2.32"
CONFIG_BINUTILS_VERSION_2_32=y

# CONFIG_GCC_USE_VERSION_7 is not set
CONFIG_GCC_USE_VERSION_9=y
CONFIG_GCC_VERSION="9.2.0"
CONFIG_GCC_VERSION_9=y

CONFIG_TARGET_OPTIMIZATION="-O2 -pipe"
CONFIG_TARGET_OPTIONS=y
CONFIG_ZSTD_OPTIMIZE_O3=y

If someone have any advice please share.

To be fair, ARMv5 isn't probably the best platform as it's more or less dying/dead :wink: