[Gc] Patch: fix libatomic-ops on ARM Thumb-2

Michael Hope michael.hope at linaro.org
Mon Nov 22 16:24:08 PST 2010


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:

---
michaelh at pavo1:~/linaro/src/bdwgc/libatomic_ops$ make
Making all in src
make[1]: Entering directory `/home/michaelh/linaro/src/bdwgc/libatomic_ops/src'
make  all-recursive
make[2]: Entering directory `/home/michaelh/linaro/src/bdwgc/libatomic_ops/src'
Making all in atomic_ops
make[3]: Entering directory
`/home/michaelh/linaro/src/bdwgc/libatomic_ops/src/atomic_ops'
Making all in sysdeps
make[4]: Entering directory
`/home/michaelh/linaro/src/bdwgc/libatomic_ops/src/atomic_ops/sysdeps'
make[4]: Nothing to be done for `all'.
make[4]: Leaving directory
`/home/michaelh/linaro/src/bdwgc/libatomic_ops/src/atomic_ops/sysdeps'
make[4]: Entering directory
`/home/michaelh/linaro/src/bdwgc/libatomic_ops/src/atomic_ops'
make[4]: Nothing to be done for `all-am'.
make[4]: Leaving directory
`/home/michaelh/linaro/src/bdwgc/libatomic_ops/src/atomic_ops'
make[3]: Leaving directory
`/home/michaelh/linaro/src/bdwgc/libatomic_ops/src/atomic_ops'
make[3]: Entering directory `/home/michaelh/linaro/src/bdwgc/libatomic_ops/src'
gcc -DHAVE_CONFIG_H -I.    -fPIC -g -O2 -DNDEBUG -MT atomic_ops.o -MD
-MP -MF .deps/atomic_ops.Tpo -c -o atomic_ops.o atomic_ops.c
mv -f .deps/atomic_ops.Tpo .deps/atomic_ops.Po
rm -f libatomic_ops.a
ar cru libatomic_ops.a atomic_ops.o
ranlib libatomic_ops.a
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[3]: *** [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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arm-thumb2-explicit-it.patch
Type: text/x-diff
Size: 841 bytes
Desc: not available
Url : http://napali.hpl.hp.com/pipermail/gc/attachments/20101123/68a0923b/arm-thumb2-explicit-it.bin


More information about the Gc mailing list