Re: [Gc] Patch: fix libatomic-ops on ARM Thumb-2
ivmai at mail.ru
Fri Jan 7 01:31:14 PST 2011
I've changed this code - now 'it eq' is produced only for Thumb.
The reasons for the change are:
- old GCC (GAS) issues "bad instruction" error for it (eg., apple's gcc v4.1);
- no effect on ARM mode;
- according to the GCC v4.5 manual, GCC behavior (when it encounters 'it eq' in ARM mode) depends on -mimplicit-it flag (the default is to ignore now but let's not depend on it if possible);
- GCC and ARMCC both define __thumb__ macro when compiling for Thumb mode.
Tue, 23 Nov 2010 23:19:05 +0300 Ivan Maidanski <ivmai at mail.ru>:
> Hi, Michael!
> Thanks for reporting it. Fixed (also for armcc).
> Tue, 23 Nov 2010 13:24:08 +1300 Michael Hope <michael.hope at linaro.org>:
> > Hi there. The attached patch fixes building libatomic-ops for ARM in
> > Thumb-2 mode. The atomic ARMv6 operations use a 'strexeq' (store
> > exclusive if equal) instruction which needs a corresponding 'it eq'
> > just before it.
> > Note that the patch has no effect on ARM mode - the assembler will
> > validate and then drop the IT instruction.
> > The original build failure was:
> > ---
> > ...
> > gcc -DHAVE_CONFIG_H -I. -fPIC -g -O2 -DNDEBUG -MT
> > atomic_ops_stack.o -MD -MP -MF .deps/atomic_ops_stack.Tpo -c -o
> > atomic_ops_stack.o atomic_ops_stack.c
> > /tmp/cc8JTTQ3.s: Assembler messages:
> > /tmp/cc8JTTQ3.s:74: Error: thumb conditional instruction should be in
> > IT block -- `strexeq r4,r1,[r2]'
> > make: *** [atomic_ops_stack.o] Error 1
> > ---
> > which was seen on Ubuntu Maverick with binutils
> > 2.20.51-system.20100908 and Linaro GCC 4.5. Note that you won't see
> > the problem under Ubuntu with GCC 4.4 due to the -mimplicit-it flag.
> > -- Michael
More information about the Gc