ARM: How does __attribute__((pcs(“aapcs”))) should be used in HardFP ABI programs?

Juan Gómez atilag@gmail.com
Wed Apr 8 21:12:00 GMT 2015


Hi! I ended up here  because of the subject message, but it started
some time ago here:
http://stackoverflow.com/questions/28932005/how-does-attribute-pcsaapcs-should-be-used-in-hardfp-abi-programs
. I'd like to run hardfp with softfp programs/libraries by makeing
some kind of wrapper/adapter. So one approach to do it could be
exploiting aapcs / aapcs-vfp attributes, but I'm not really sure if
this attributes work like I think they would. All the details are in
the stackoverflow question, but I'll paste them here as well:

I have a HardFP ABI (very) simple test program. It links with other
HardFP binaries without any problems. Now I wanted to use a function
from a Softfp ABI library in my code, so I changed the header file
(.h) from this library to add the attibute: __
attribute__((pcs("aapcs"))) on every function which uses double args
(like: void doSomething(double arg, double arg2)), so I'm telling the
toolchain that this library uses softfp ABI. The problem is that the
toolchain (arm-linux-androideabi-4.9) is yelling me that:

/media/data_disk/b2g/work/hardfp/arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9.x-google/../../../../arm-linux-androideabi/bin/ld:
error: /tmp/cc6SmP3D.o uses VFP register arguments, output does not
/media/data_disk/b2g/work/hardfp/arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9.x-google/../../../../arm-linux-androideabi/bin/ld:
error: /home/jgomez/b2g/build.flatfish.hardfp/out/target/product/flatfish/obj/lib/libc.so
uses VFP register arguments, output does not
/media/data_disk/b2g/work/hardfp/arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9.x-google/../../../../arm-linux-androideabi/bin/ld:
error: /home/jgomez/b2g/build.flatfish.hardfp/out/target/product/flatfish/obj/lib/libstdc++.so
uses VFP register arguments, output does not
/media/data_disk/b2g/work/hardfp/arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9.x-google/../../../../arm-linux-androideabi/bin/ld:
error: /home/jgomez/b2g/build.flatfish.hardfp/out/target/product/flatfish/obj/lib/libm.so
uses VFP register arguments, output does not

(Of course, libc, libstdc++, and libm are hardfp too).

It doesn't compile.

So my question is, How does __attribute__((pcs("aapcs"))) should be
used to let HardFP ABI programs link with Softfp ABI binaries?

I thought that this was the purpose of such a flag. Am I wrong?

Thanks!!



More information about the Gcc-help mailing list