[x265] cmake: avoid different stack alignment for GCC in 32-bit Windows

Mateusz mateusz at msystem.waw.pl
Wed Jul 27 21:56:17 CEST 2016


> Since you just want to stack alignment, so -mpreferred-stack-boundary is best choice.
> The -msse2 will allow compiler automatic generate SSE2 code, since we use C++ code, it easy to catch compiler bugs, so I avoid to use these side effect option.
> --
> Min

OK, I've prepared new patch that adds -mpreferred-stack-boundary only for GCC 6 -- it doesn't slow-down working versions of GCC.

# HG changeset patch
# User Ma0 <mateuszb at poczta.onet.pl>
# Date 1469648840 -7200
#      Wed Jul 27 21:47:20 2016 +0200
# Node ID 83e4505f87c0cbc0cf8869f9277fded426524734
# Parent  5a0e139e29386ecebafc9c555aedcd3e0f61c70c
cmake: fix unaligned stack in 32-bit Windows for GCC 6

diff -r 5a0e139e2938 -r 83e4505f87c0 source/CMakeLists.txt
--- a/source/CMakeLists.txt    Fri Jul 22 13:13:42 2016 +0530
+++ b/source/CMakeLists.txt    Wed Jul 27 21:47:20 2016 +0200
@@ -184,6 +184,10 @@
         string(FIND "${CMAKE_CXX_FLAGS}" "-march" marchPos)
         if(marchPos LESS "0")
             add_definitions(-march=i686)
+            if(WIN32 AND NOT INTEL_CXX AND NOT CLANG AND
+               CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
+                add_definitions(-mpreferred-stack-boundary=2)
+            endif()
         endif()
     endif()
     if(ARM AND CROSS_COMPILE_ARM)



More information about the x265-devel mailing list