[compiler-rt] r277406 - [winasan] Try to fix LNK4099 warnings seen by users

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 18:02:47 PDT 2016


Author: rnk
Date: Mon Aug  1 20:02:46 2016
New Revision: 277406

URL: http://llvm.org/viewvc/llvm-project?rev=277406&view=rev
Log:
[winasan] Try to fix LNK4099 warnings seen by users

/Zi creates a separate PDB that we're supposed to pass along with our
sanitizer libraries, but the object library compilation rules aren't set
up to handle that. Rather than set that up, put the debug info in the
object files the way every other platform does it with /Z7.

Modified:
    compiler-rt/trunk/CMakeLists.txt

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=277406&r1=277405&r2=277406&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Mon Aug  1 20:02:46 2016
@@ -228,8 +228,14 @@ if(COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLA
   list(APPEND SANITIZER_COMMON_CFLAGS -gline-tables-only)
 elseif(COMPILER_RT_HAS_G_FLAG)
   list(APPEND SANITIZER_COMMON_CFLAGS -g)
-elseif(COMPILER_RT_HAS_Zi_FLAG)
-  list(APPEND SANITIZER_COMMON_CFLAGS /Zi)
+elseif(MSVC)
+  # Use /Z7 instead of /Zi for the asan runtime. This avoids the LNK4099
+  # warning from the MS linker complaining that it can't find the 'vc140.pdb'
+  # file used by our object library compilations.
+  list(APPEND SANITIZER_COMMON_CFLAGS /Z7)
+  llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/Z[i7I]" "/Z7")
+  llvm_replace_compiler_option(CMAKE_CXX_FLAGS_DEBUG "/Z[i7I]" "/Z7")
+  llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Z[i7I]" "/Z7")
 endif()
 
 # Turn off several warnings.




More information about the llvm-commits mailing list