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

Siarhei Siamashka siarhei.siamashka at gmail.com
Sat Mar 20 02:13:49 PDT 2010


On Friday 19 March 2010, Siarhei Siamashka wrote:
> 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:
> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044d/index.html

Sorry for the continuous ARM related spam.

One more update after experimenting with a purely armv4t rootfs. When
compiling pixman for armv4t thumb without arm simd support:

# readelf -A pixman/.libs/libpixman-1.so
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "4T"
  Tag_CPU_arch: v4T
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-1
  Tag_ABI_PCS_wchar_t: 4
  Tag_ABI_FP_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align8_needed: Yes
  Tag_ABI_align8_preserved: Yes, except leaf SP
  Tag_ABI_enum_size: int
  Tag_ABI_optimization_goals: Aggressive Speed

Now compiling with arm simd support:

# readelf -A pixman/.libs/libpixman-1.so
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "ARM1136J-S"
  Tag_CPU_arch: v6
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-1
  Tag_ABI_PCS_wchar_t: 4
  Tag_ABI_FP_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align8_needed: Yes
  Tag_ABI_align8_preserved: Yes, except leaf SP
  Tag_ABI_enum_size: int
  Tag_ABI_optimization_goals: Aggressive Speed

So linking one extra object file compiled for armv6 wit the rest "infects"
the whole binary. This attributes merging is also described in EABI ELF
documentation.

Linker probably starts to think that it may use 'blx' instructions because it
thinks that the target arch is armv6. And maybe at some time in the future,
such binaries may even refuse to run on older hardware.

This is all quite ugly, but for now in order to run pixman properly on armv4t, 
the final binary should be never tagged for more recent arch. This forbids
any tricks with -mcpu= overriding even for a single C source file. Assembly
source files should be verified with the regards to what attributes they emit
and whether this can be controlled.

I'll try to provide some solution for this problem.

> The problem seems to be known for some time already:
> http://sourceware.org/ml/binutils/2009-02/msg00222.html
>
> But binutils 2.20.1 does not have any fix yet, at least it still emits
> 'blx' instruction for me.

And this might have been an unrelated problem which just sounded similar.

-- 
Best regards,
Siarhei Siamashka


More information about the Pixman mailing list