2011/9/18 Henrik Nordström <henrik(a)henriknordstrom.net>:
The armv7 distro bootstrap have run into a number of packages failing
to
compile in Thumb mode (default enabled in rpmrc) failing on ARM assembly
parts with conditional branch instructions. In thumb mode one apparently
need to use the IT instruction to hint to the CPU about the conditions
of following instructions in addition to have the conditions on the
instructions themselves. While investing these I saw rumors about GCC
eventually adding an automatic handling of these adding IT instructions
as needed, and even projects being very reluctant about touching any of
this until GCC have made up it's mind, and finally in an upstream bug
report on pulseaudio there is a reference to the -mimplicit-it=thumb GAS
option doing exacly this.
Is there any drawbacks from enabling implicit IT instruction generation
letting GAS automatically deal with this as required by Thumb mode? If
not, should we add this to rpmrc?
-Wa, -mimplicit-it=thumb
Hi Henrik. We discussed this on gcc-patches and decided against it.
The problem is that GCC does range calculations to figure out where to
put the constant pool. If the assembler inserts instructions after
GCC has run then these calculations are wrong and you could fail with
a link error.
Ubuntu used to turn on -mimplicit-it by default. They don't now and
have fixed up many of the upstream packages. We've been fixing up any
left overs during the weekly Linaro porting jam.
The gcc-patches discussion is here:
http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01339.html
http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01351.html
http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01353.html
http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01354.html
http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01355.html
http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01356.html
http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01357.html
The review list is here:
https://wiki.ubuntu.com/ARM/Thumb2PackageReviewList
You can view the porting jam bugs here:
https://bugs.launchpad.net/ubuntu/+bugs?field.tag=arm-porting-queue&o...
from what I can understand it should be quite safe. And I am even of
the
opinion that GAS is way better suited at adding these instructions than
the average programmer as it carries redundant information which need to
match the conditions of the instructions following after.
GAS does validate the instructions and will error out if the IT
instruction doesn't match the following.
Note that while Thumb-2 has all of the same condition codes as ARM
mode, the IT block can only do a condition and its negative. This
covers 90 % of the cases I've seen though.
-- Michael