[PATCH] D43881: Add CMake option for using /DEBUG:GHASH

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 10:24:29 PST 2018


zturner created this revision.
zturner added reviewers: rnk, aganea.
Herald added a subscriber: mgorny.

This way when self-hosting we can just say `-DLLVM_ENABLE_DEBUG_GHASH=ON` without having to mess around manually with cxxflags and ldflags.


https://reviews.llvm.org/D43881

Files:
  llvm/cmake/modules/HandleLLVMOptions.cmake


Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -366,6 +366,21 @@
           CMAKE_SHARED_LINKER_FLAGS)
   endif()
 
+  OPTION(LLVM_ENABLE_DEBUG_GHASH OFF)
+  if (LLVM_ENABLE_DEBUG_GHASH)
+    if (CLANG_CL AND LINKER_IS_LLD_LINK)
+      append("-mllvm -emit-codeview-ghash-section" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+      append("/DEBUG:GHASH" CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
+    else()
+      if (NOT CLANG_CL)
+        message(WARNING "Option LLVM_ENABLE_DEBUG_GHASH is incompatible with cl.exe, clang-cl is required.")
+      endif()
+      if (NOT LINKER_IS_LLD_LINK)
+        message(WARNING "Option LLVM_ENABLE_DEBUG_GHASH is incompatible with link.exe, lld-link is required.")
+      endif()
+    endif()
+  endif()
+
   # /Zc:strictStrings is incompatible with VS12's (Visual Studio 2013's)
   # debug mode headers. Instead of only enabling them in VS2013's debug mode,
   # we'll just enable them for Visual Studio 2015 (VS 14, MSVC_VERSION 1900)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43881.136329.patch
Type: text/x-patch
Size: 1166 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180228/fd645719/attachment.bin>


More information about the llvm-commits mailing list