[Pixman] [PATCH] SIMD: Try without any CFLAGS before forcing -mcpu=

Siarhei Siamashka siarhei.siamashka at gmail.com
Fri Mar 19 10:28:40 PDT 2010

On Friday 19 March 2010, Siarhei Siamashka wrote:
> So when generating binaries for ARMv5, the linker is permitted to
> do 'bl' -> 'blx' conversion. That's what we actually see here, except that
> we actually want this code to also run on ARMv4. In order to make the code
> ARMv4 compatible, the linker had to replace 'bl' instructions with proper
> 'bl' instructions doing a call to a small thunk function which would
> perform 'blx' emulation and do proper arm->thumb call.
> So the conclusion is: the linker currently fails to support proper
> arm-thumb interworking on armv4t processors and emits 'blx' instruction
> which is only supported on armv5. Anyone trying to mix arm and thumb on
> armv4t is in danger. Linking pixman-arm-simd.o file, which contains arm
> code, provokes the linker to do these bad things. Unless this bug is
> already known, it needs to be reported to binutils.

Replying to myself, but here are some additions/corrections. The up to date
link to EABI ELF documentation is here:

The problem seems to be known for some time already:

But binutils 2.20.1 does not have any fix yet, at least it still emits 'blx'
instruction for me.

As a solution/workaround in pixman, I think we should not cause a mix of
arm and thumb code for the processors older than armv5te. If the pixman
library itself is being compiled for thumb and the target CPU is older than
armv5te, then all the assembly optimizations must be disabled. And
additionally we need to explicitly check that thumb interworking is enabled
together with thumb (__THUMB_INTERWORK__ macro must be defined).

Also I have just spotted another nasty problem. When compiling with
CFLAGS="-O2 -g -mthumb -mthumb-interwork -mcpu=cortex-a8 -mfloat-abi=softfp -mfpu=neon",
build fails for me now with the following error message (I'm quite sure that I
checked it earlier and it was not the case :-/ ):

libtool: compile:  
gcc -DHAVE_CONFIG_H -I. -I.. -O2 -g -mthumb -mthumb-interwork -mcpu=cortex-a8 -mfloat-abi=softfp -mfpu=neon -Wall -fno-strict-aliasing -fvisibility=hidden -MT 
libpixman_arm_simd_la-pixman-arm-simd.lo -MD -MP -MF .deps/libpixman_arm_simd_la-pixman-arm-simd.Tpo -c 
pixman-arm-simd.c -o libpixman_arm_simd_la-pixman-arm-simd.o
pixman-arm-simd.c: In function ‘arm_composite_over_8888_8888’:
pixman-arm-simd.c:139: error: can't find a register in class ‘LO_REGS’ while 
reloading ‘asm’
pixman-arm-simd.c:139: error: ‘asm’ operand has impossible constraints
make[3]: *** [libpixman_arm_simd_la-pixman-arm-simd.lo] Error 1

This legacy ARM stuff breaks way too easily in various configurations.
Touching it is dangerous.

Best regards,
Siarhei Siamashka

More information about the Pixman mailing list