[x265] [PATCH] AArch64: Fix SVE(2) compilation tests when libnuma is enabled
Hari Limaye
hari.limaye at arm.com
Fri Jan 31 14:10:13 UTC 2025
The SVE(2) compilation tests change CMAKE_TRY_COMPILE_TARGET_TYPE to
STATIC_LIBRARY, which results in the C compiler linker options in
CMAKE_REQUIRED_LINK_OPTIONS being passed to the archiver. This causes
these tests to always fail when libnuma is enabled, as invalid linker
options are passed to the archiver. Fix this by saving, clearing, and
restoring CMAKE_REQUIRED_LINK_OPTIONS for the compilation tests.
See CMake issue:
https://gitlab.kitware.com/cmake/cmake/-/issues/23454
---
source/CMakeLists.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index f39bcc5c4..37dbe1a87 100755
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -311,6 +311,11 @@ if(GCC)
string(APPEND CMAKE_REQUIRED_FLAGS " ${AARCH64_SVE_FLAG}")
set(OLD_CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+ # When compilation target is a STATIC_LIBRARY, the LINK_OPTIONS are
+ # passed to the archiver, so we must backup, clear and restore these.
+ # https://gitlab.kitware.com/cmake/cmake/-/issues/23454
+ set(OLD_CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ set(CMAKE_REQUIRED_LINK_OPTIONS "")
# Check whether the compiler can compile SVE functions that require
# backup/restore of SVE registers according to AAPCS.
@@ -340,6 +345,7 @@ int main() { return 0; }")
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
set(CMAKE_TRY_COMPILE_TARGET_TYPE ${OLD_CMAKE_TRY_COMPILE_TARGET_TYPE})
+ set(CMAKE_REQUIRED_LINK_OPTIONS ${OLD_CMAKE_REQUIRED_LINK_OPTIONS})
if (SVE_COMPILATION_C_TEST_COMPILED AND SVE_COMPILATION_CXX_TEST_COMPILED)
if (SVE_HEADER_C_TEST_COMPILED AND SVE_HEADER_CXX_TEST_COMPILED)
add_definitions(-DHAVE_SVE_BRIDGE=1)
--
2.42.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-AArch64-Fix-SVE-2-compilation-tests-when-libnuma-is-.patch
Type: text/x-patch
Size: 2216 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250131/842359b5/attachment.bin>
More information about the x265-devel
mailing list