thumb compiler flags

Bernhard Rosenkranzer bernhard.rosenkranzer at linaro.org
Tue Aug 2 21:09:18 UTC 2011


Hi,
I just spotted this bit in Android's Makefiles (inherited that way from AOSP):

TARGET_arm_CFLAGS := [...] -fstrict-aliasing [...]
[...]
TARGET_thumb_CFLAGS := [...] -fno-strict-aliasing [...]

This general assumption that arm code can handle strict aliasing, but
thumb code can't, seems odd.

My guess is that they started out using -fno-strict-aliasing
everywhere, then fixed aliasing violations and "fixed" the compiler
flags for arm, and didn't notice they're still turning it off for
thumb -- either that, or they've run into toolchain bugs (that might
be fixed in the Linaro toolchain), or it's a matter of "something
we're building in thumb mode has aliasing violations and we're too
lazy to figure out which part it is".

Unless someone knows of a valid reason for doing things the way they
did, simply taking it out (preferrably replacing it with
-Werror=strict-aliasing, so we're likely to notice any aliasing
violations if it comes down to "too lazy to figure out which part")
should get us some free extra speed. (Not sure just how much we're
actually building in thumb mode - may or may not be relevant.)

ttyl
bero



More information about the linaro-dev mailing list