]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: add -fstack-protector-strong on win32 48259/head
authorKen Dreyer <kdreyer@redhat.com>
Tue, 13 Sep 2022 20:18:36 +0000 (16:18 -0400)
committerKen Dreyer <kdreyer@redhat.com>
Tue, 27 Sep 2022 15:21:18 +0000 (11:21 -0400)
mingw on RHEL 9 needs -fstack-protector (which adds -lssp), or it fails
with these errors:

  undefined reference to `__stack_chk_fail'
  undefined reference to `__stack_chk_guard'
  undefined reference to `__strcpy_chk'

Commit 8d35b2eceabafbe13458101f8701e3fc49f15d63 mentions that the build
fails with -fstack-protector-strong. Perhaps that only applied to
earlier Ubuntu versions, because Ubuntu Focal can build with
-fstack-protector-strong now.

Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
src/CMakeLists.txt
win32_build.sh

index 8d6add4666b1e07101f2eca3531316faef72a20b..5827968d8c8b139d3921896c5b51daa0740b207d 100644 (file)
@@ -184,12 +184,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
         -D_FORTIFY_SOURCE=2)
     endif()
   endif()
-  if(NOT WIN32)
     CHECK_C_COMPILER_FLAG(-fstack-protector-strong HAS_STACK_PROTECT)
     if (HAS_STACK_PROTECT)
       add_compile_options(-fstack-protector-strong)
+      if(WIN32)
+        add_link_options(-fstack-protector-strong)
+      endif(WIN32)
     endif()
-  endif(NOT WIN32)
 endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
 
 CHECK_C_COMPILER_FLAG("-D_GLIBCXX_ASSERTIONS" HAS_GLIBCXX_ASSERTIONS)
index d6fc366e4a90fbe6c9452aa01b26e8fcf611599d..2b84851ce8f6ac9dea5b91fa2a15a0bf98ab47dc 100755 (executable)
@@ -212,6 +212,7 @@ if [[ -z $SKIP_DLL_COPY ]]; then
         $sslDir/bin/libssl-1_1-x64.dll
         $mingwTargetLibDir/libstdc++-6.dll
         $mingwTargetLibDir/libgcc_s_seh-1.dll
+        $mingwTargetLibDir/libssp*.dll
         $mingwLibpthreadDir/libwinpthread-1.dll
         $boostDir/lib/*.dll)
     echo "Copying required dlls to $binDir."