[cmake] CPUInstructionSetFlags.cmake: Disable NEON on armhf for now. (except MSVC)

Adding "-marm -mfpu=neon" fixed compilation, but LTO linking failed:

/usr/lib/gcc/arm-linux-gnueabihf/9/include/arm_neon.h: In function ‘rp_byte_swap_32_array_neon’:
/usr/lib/gcc/armmake[3]: Entering directory '/<<PKGBUILDDIR>>/build'
-linux-gnueabihf/9/include/arm_neon.h:11401:14: fatal error: You must enable NEON instructions (e.g. ‘-mfloat-abi=softfp’ ‘-mfpu=neon’) to use these intrinsics.
11401 |   __rv.__o = __builtin_neon_vld2v4si ((const __builtin_neon_si *) __a);
      |              ^
compilation terminated.
lto-wrapper: fatal error: /usr/bin/c++ returned 1 exit status

I'll need to test this in qemu or similar first before trying it on
Launchpad again. For now, don't enable NEON on armhf.

...except when compiling with MSVC for Windows, since Windows on ARM
mandates NEON on both 32-bit and 64-bit.
This commit is contained in:
David Korth 2025-04-20 03:20:11 -04:00
parent dbbecad397
commit 5973d5af91

View File

@ -111,7 +111,9 @@ IF(CPU_i386 OR CPU_amd64)
ENDIF()
ENDIF(CPU_i386 OR CPU_amd64)
IF(CPU_arm OR CPU_arm64 OR CPU_arm64ec)
# FIXME: NEON on Ubuntu armhf is complaining when using LTO.
# Disable NEON on armhf for now, except for MSVC.
IF((CPU_arm AND MSVC) OR CPU_arm64 OR CPU_arm64ec)
# Check for arm_neon.h.
# NOTE: Should always be present for arm64, but check anyway.
INCLUDE(CheckIncludeFile)
@ -120,4 +122,4 @@ IF(CPU_arm OR CPU_arm64 OR CPU_arm64ec)
IF(CPU_arm AND NOT MSVC)
SET(NEON_FLAG "-marm -mfpu=neon")
ENDIF(CPU_arm AND NOT MSVC)
ENDIF(CPU_arm OR CPU_arm64 OR CPU_arm64ec)
ENDIF((CPU_arm AND MSVC) OR CPU_arm64 OR CPU_arm64ec)