[x265] [PATCH 06/12] AArch64: Don't pass -mstackrealign option

Hari Limaye hari.limaye at arm.com
Thu May 2 21:19:41 UTC 2024


With the compiler option `-mstackrealign`, Clang emits function prologue
and epilogue instructions to create and then restore a frame record,
even when not necessary.

Omit this option when building for AArch64 as it is unnecessary.
---
 source/CMakeLists.txt | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 413311de7..c74db2179 100755
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -338,9 +338,11 @@ if(GCC)
     if (CC_HAS_FAST_MATH)
         add_definitions(-ffast-math)
     endif()
-    check_cxx_compiler_flag(-mstackrealign CC_HAS_STACK_REALIGN)
-    if (CC_HAS_STACK_REALIGN)
-        add_definitions(-mstackrealign)
+    if (NOT (ARM64 OR CROSS_COMPILE_ARM64))
+        check_cxx_compiler_flag(-mstackrealign CC_HAS_STACK_REALIGN)
+        if (CC_HAS_STACK_REALIGN)
+            add_definitions(-mstackrealign)
+        endif()
     endif()
     # Disable exceptions. Reduce executable size, increase compability.
     check_cxx_compiler_flag(-fno-exceptions CC_HAS_FNO_EXCEPTIONS_FLAG)
--
2.42.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


More information about the x265-devel mailing list