------- Comment #1 from ramana at gcc dot gnu dot org 2009-05-27 09:50 ------- (In reply to comment #0) > Hello, > > during cross compilation of gcc, the libffi build for the target breaks with > this error message: > > libtool: compile: /home/frogger/pengutronix/toolchain/libffi/build/./gcc/xgcc > -B/home/frogger/pengutronix/toolchain/libffi/build/./gcc/ > -B/usr/local/arm-1136jfs-linux-gnueabi/bin/ > -B/usr/local/arm-1136jfs-linux-gnueabi/lib/ -isystem > /usr/local/arm-1136jfs-linux-gnueabi/include -isystem > /usr/local/arm-1136jfs-linux-gnueabi/sys-include -I. > -I../../../gcc-4.4.0/libffi/include -Iinclude -I../../../gcc-4.4.0/libffi/src > -g -O2 -c ../../../gcc-4.4.0/libffi/src/arm/sysv.S -fPIC -DPIC -o > src/arm/.libs/sysv.o > ../../../gcc-4.4.0/libffi/src/arm/sysv.S: Assembler messages: > ../../../gcc-4.4.0/libffi/src/arm/sysv.S:202: Error: selected processor does > not support `stfeqs f0,[r2]' > ../../../gcc-4.4.0/libffi/src/arm/sysv.S:207: Error: selected processor does > not support `stfeqd f0,[r2]' > ../../../gcc-4.4.0/libffi/src/arm/sysv.S:282: Error: selected processor does > not support `ldfs f0,[sp]' > ../../../gcc-4.4.0/libffi/src/arm/sysv.S:285: Error: selected processor does > not support `ldfd f0,[sp]' > ../../../gcc-4.4.0/libffi/src/arm/sysv.S:288: Error: selected processor does > not support `ldfd f0,[sp]' > > the offending code is: > > #ifndef __SOFTFP__ > beq LSYM(Lepilogue) > > @ return FLOAT > cmp r3, #FFI_TYPE_FLOAT > stfeqs f0, [r2] > beq LSYM(Lepilogue) > > @ return DOUBLE or LONGDOUBLE > cmp r3, #FFI_TYPE_DOUBLE > stfeqd f0, [r2] > #endif > > > gcc is configured this way: > > ../gcc-4.4.0/configure --enable-languages=c,c++,java > --target=arm-1136jfs-linux-gnueabi > --with-mpfr=/home/frogger/pengutronix/toolchain/OSELAS.Toolchain-trunk/platform-arm-v4t-linux-gnueabi-gcc-4.4.0-glibc-2.9-binutils-2.19.1-kernel-2.6.29-sanitized/sysroot-host > --with-gmp=/home/frogger/pengutronix/toolchain/OSELAS.Toolchain-trunk/platform-arm-v4t-linux-gnueabi-gcc-4.4.0-glibc-2.9-binutils-2.19.1-kernel-2.6.29-sanitized/sysroot-host > --with-float=softfp --with-fpu=vfp --with-cpu=arm1136jf-s > --with-sysroot=/opt/OSELAS.Toolchain-1.99.3/arm-1136jfs-linux-gnueabi/gcc-4.3.2-glibc-2.8-binutils-2.19-kernel-2.6.27-sanitized/sysroot-arm-1136jfs-linux-gnueabi > > I.e. as an arm-eabi target, --with-fpu=vfp and --with-float=softfp. Which > means > floats are passed in integer registers, but in function the compiler generates > floating point instructions, the preprocessor doesn't define a "__SOFTFP__" > symbol. > > If configuring the compiler with "--with-float=soft" it will pass floats in > integer registers and it will generate softfloat emulation code. In this case > the preprocessor defines "__SOFTFP__". > > In both variants the function calling convention is the same, but in one case > we have the __SOFTFP__ symbol in the other not. > > libffi changes it's behaviour depending on this symbol, which is IMHO not > correct. > > I've tested some combinations, this is the summary of > (echo | arm-v4t-linux-gnueabi-cpp -dM -mfloat-abi=XXX -mfpu=YYY| egrep -i > 'vfp|fp|soft|hard|float'): > > -mfloat-abi=soft -mfpu=vfp __SOFTFP__ __VFP_FP__ > -mfloat-abi=softfp -mfpu=vfp __VFP_FP__ > -mfloat-abi=hard -mfpu=vfp __VFP_FP__ (sorry, unimplemented) > > -mfloat-abi=soft -mfpu=fpa __SOFTFP__ > -mfloat-abi=softfp -mfpu=fpa > -mfloat-abi=hard -mfpu=fpa > > I'm not sure which of these combinations makes sense, or are actually used, > the > 3rd one seems not to be implemented, though. We at pengutronix use usually 1. > and 2. In some weird projects 4. and 6. but not with the current gcc.
Using mfpu=fpa in eabi configurations is wrong. Trunk is now patched to no longer allow this. > > This table shows that it's not possible to distinguish between the "hard" and > "softfp" case, a diff off the preprocessor's output shows no difference in the > symbols tough. On the upside the vfp-hard case seems not to be implemented. The difference between vfp-hard and softfp is whether we use the VFP registers for passing parameters or not. Currently softfp is the only one implemented in trunk and all release branches though an implementation is under way in an architecture specific branch viz. ARM/hardvfp_4_4_branch. > > So the question is which is the correct symbol for libffi? If there is code in here that tries to return values in floating point registers if SOFTFP is not defined then it is clearly wrong and we need another macro to distinguish the case. I am not sure if there exists a symbol for this and I am not sure about the code in this. CC'ing Andrew Haley about this one. > > cheers, Marc > -- ramana at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aph at redhat dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40242