]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: Check -flto flags
authorBoris Ranto <branto@redhat.com>
Thu, 5 Aug 2021 06:36:21 +0000 (08:36 +0200)
committerKefu Chai <tchaikov@gmail.com>
Wed, 31 Aug 2022 12:36:53 +0000 (20:36 +0800)
We should check if -flto-partition=none is defined when the compiler
does not support symver attribute and fail the build if it is not.

Fixes: https://tracker.ceph.com/issues/40060
Co-authored-by: Kefu Chai <tchaikov@gmail.com>
Signed-off-by: Boris Ranto <branto@redhat.com>
(cherry picked from commit 5bcfd5caeee90df18809a6f4c9a2e7e8f7734f8b)

cmake/modules/CephChecks.cmake

index e46caf88274d5a007c57914460e594e03912a7ca..419edc2dc66700769d4aac59e8b76eb659b8598d 100644 (file)
@@ -154,6 +154,12 @@ __attribute__((__symver__ (\"func@v2\"))) void func_v2() {};
 
 int main() {}"
   HAVE_ATTR_SYMVER)
+  if(NOT HAVE_ATTR_SYMVER)
+    if(CMAKE_CXX_FLAGS MATCHES "-flto" AND NOT CMAKE_CXX_FLAGS MATCHES "-flto-partition=none")
+      # https://tracker.ceph.com/issues/40060
+      message(FATAL_ERROR "please pass -flto-partition=none as part of CXXFLAGS")
+    endif()
+  endif()
 set(CMAKE_REQUIRED_FLAGS -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/version_script.txt)
 check_c_source_compiles("
 void func_v1() {}