Wookey wrote:
That seems an oversimplification. There is usually an FPU (almost always) and a neon unit (usually). The point is that their presence is not guaranteed
Debian armhf requires a FPU as part of the baseline. More than that it requires a FPU as part of the ABI! Andreas Tille wrote:
It fails to build with lib/arm/crc32_impl.h:77:1: error: ‘-mfloat-abi=hard’: selected architecture lacks an FPU
This issue is caused by the way current versions of debian/ubuntu package/configure gcc The gcc packaging used to specify cpu and fpu architectures separately, but now it specifies the fpu as an extension of the cpu architecture using the "armv7-a+fp" syntax. The result of this is if you override the CPU architecture on debian armhf you must also specify a fpu (either using a seperate "mfpu" setting or using the syntax for CPU architecture extensions). If you don't then gcc will assume you have no FPU and therefore that it is unable to implement the hard float ABI. The particular code in question seems to be an implementation of crc32 using the crc32 extension added as an optional feature in armv8. From a quick look it appears to already be behind runtime cpu detection. At least gcc seems to think that on armv8 floating point and simd always go together, "+fp" is not recognised as an extension to armv8, only "+simd". So I think Ubuntu's current patch which changes the CPU settings for the code that uses the crc extension from an architecture setting of "armv8+crc32" to and architecture setting of "armv8+simd+crc32" is correct for Debian armhf. You could however argue that it is not correct for Debian armel, I suspect it is possible in theory to have an armv8 CPU that doesn't have any floating point or simd support, but does have the crc32 extension and to run debian armel on such a CPU. In practice I suspect such CPUs are likely to be like hens teeth and I suspect the compiler is unlikely to actually use any floating point or simd instructions when compiling that function anyway. Still if you want to be safer, you could do something like --- a/lib/arm/crc32_impl.h +++ b/lib/arm/crc32_impl.h @@ -41,7 +41,11 @@ # ifdef __clang__ # define ATTRIBUTES __attribute__((target("armv8-a,crc"))) # else -# define ATTRIBUTES __attribute__((target("arch=armv8-a+crc"))) +# ifdef __ARM_PCS_VFP +# define ATTRIBUTES __attribute__((target("arch=armv8-a+simd+crc"))) +# else +# define ATTRIBUTES __attribute__((target("arch=armv8-a+crc"))) +# endif # endif # else # ifdef __clang__