[Lldb-commits] [PATCH] D67012: [lit] Only set DYLD_LIBRARY_PATH for shared builds

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 30 10:40:05 PDT 2019


JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, mgorny.
Herald added subscribers: llvm-commits, abidh.
Herald added projects: LLDB, LLVM.
JDevlieghere updated this revision to Diff 218133.

In r370135 I committed a temporary workaround for the sanitized bot to not set (DY)LD_LIBRARY_PATH when (DY)LD_INSERT_LIBRARIES was set. Setting (DY)LD_LIBRARY_PATH is only necessary for (standalone) shared-library builds, so a better solution is to only set the environment variable when necessary.


https://reviews.llvm.org/D67012

Files:
  lldb/lit/CMakeLists.txt
  lldb/lit/Suite/lit.cfg
  lldb/lit/Suite/lit.site.cfg.in
  llvm/cmake/modules/LLVMConfig.cmake.in


Index: llvm/cmake/modules/LLVMConfig.cmake.in
===================================================================
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -84,6 +84,7 @@
 set(LLVM_TOOLS_INSTALL_DIR "@LLVM_TOOLS_INSTALL_DIR@")
 set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@)
 set(LLVM_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
+set(LLVM_SHARED_LIBS @BUILD_SHARED_LIBS@)
 
 if(NOT TARGET LLVMSupport)
   set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@")
Index: lldb/lit/Suite/lit.site.cfg.in
===================================================================
--- lldb/lit/Suite/lit.site.cfg.in
+++ lldb/lit/Suite/lit.site.cfg.in
@@ -13,6 +13,7 @@
 config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
 config.host_os = "@HOST_OS@"
 config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.shared_libs = "@LLVM_SHARED_LIBS@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
Index: lldb/lit/Suite/lit.cfg
===================================================================
--- lldb/lit/Suite/lit.cfg
+++ lldb/lit/Suite/lit.cfg
@@ -39,21 +39,18 @@
   elif platform.system() == 'Windows':
     yield 'PATH'
 
-if not 'DYLD_INSERT_LIBRARIES' in config.environment:
-  # Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
-  # This clashes with DYLD_INSERT_LIBRARIES which is needed on Darwin.
+# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
+if config.shared_libs:
   for shlibpath_var in find_shlibpath_var():
     # In stand-alone build llvm_shlib_dir specifies LLDB's lib directory while
     # llvm_libs_dir specifies LLVM's lib directory.
     shlibpath = os.path.pathsep.join(
-      (config.llvm_shlib_dir,
-      config.llvm_libs_dir,
-      config.environment.get(shlibpath_var, '')))
+        (config.llvm_shlib_dir, config.llvm_libs_dir,
+         config.environment.get(shlibpath_var, '')))
     config.environment[shlibpath_var] = shlibpath
-    break
   else:
-    lit_config.warning("unable to inject shared library path on '{}'"
-                      .format(platform.system()))
+    lit_config.warning("unable to inject shared library path on '{}'".format(
+        platform.system()))
 
 # Build dotest command.
 dotest_cmd = [config.dotest_path]
Index: lldb/lit/CMakeLists.txt
===================================================================
--- lldb/lit/CMakeLists.txt
+++ lldb/lit/CMakeLists.txt
@@ -69,6 +69,7 @@
 llvm_canonicalize_cmake_booleans(
   LLDB_DISABLE_PYTHON
   LLVM_ENABLE_ZLIB
+  LLVM_SHARED_LIBS
   LLDB_IS_64_BITS)
 
 configure_lit_site_cfg(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67012.218133.patch
Type: text/x-patch
Size: 2697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190830/845f4d9b/attachment.bin>


More information about the lldb-commits mailing list