[PATCH] D85497: [CMake] zlib FORCE_ON overrides MSan

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 21:00:19 PDT 2020


phosek created this revision.
phosek added a reviewer: hans.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.
phosek requested review of this revision.

This restores the behavior removed in 1adc494 <https://reviews.llvm.org/rG1adc494bce44f6004994deed61b30d4b71fe1d05> where setting
LLVM_ENABLE_ZLIB to FORCE_ON overrides MSan.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85497

Files:
  llvm/cmake/config-ix.cmake


Index: llvm/cmake/config-ix.cmake
===================================================================
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -114,18 +114,20 @@
   set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
 endif()
 
+if(LLVM_ENABLE_ZLIB)
+  if(LLVM_ENABLE_ZLIB STREQUAL FORCE_ON)
+    find_package(ZLIB REQUIRED)
+  elseif(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
+    find_package(ZLIB)
+  else()
+    set(ZLIB_FOUND FALSE)
+  endif()
+  set(LLVM_ENABLE_ZLIB "${ZLIB_FOUND}")
+endif()
+
 # Don't look for these libraries if we're using MSan, since uninstrumented third
 # party code may call MSan interceptors like strlen, leading to false positives.
 if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
-  if(LLVM_ENABLE_ZLIB)
-    if(LLVM_ENABLE_ZLIB STREQUAL FORCE_ON)
-      find_package(ZLIB REQUIRED)
-    else()
-      find_package(ZLIB)
-    endif()
-    set(LLVM_ENABLE_ZLIB "${ZLIB_FOUND}")
-  endif()
-
   # Don't look for these libraries on Windows.
   if (NOT PURE_WINDOWS)
     # Skip libedit if using ASan as it contains memory leaks.
@@ -164,8 +166,6 @@
       endif()
     endif()
   endif()
-else()
-  set(LLVM_ENABLE_ZLIB FALSE)
 endif()
 
 if (LLVM_ENABLE_LIBXML2 STREQUAL "FORCE_ON" AND NOT LLVM_LIBXML2_ENABLED)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85497.283805.patch
Type: text/x-patch
Size: 1263 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200807/b3e3a6e7/attachment.bin>


More information about the llvm-commits mailing list