[compiler-rt][lit] initialize LIT LLVMConfig instance

to handle lit tools searching. Otherwise
compiler-rt depends on system environment variable PATH for lit tools
which diverge from the other LLVM projects. This reverts D83486 which
really should be implemented in LIT itself when the PATH is constructed.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D122837
This commit is contained in:
Yuanfang Chen
2022-08-22 16:01:09 -07:00
parent 5f886adbfd
commit e78208f082
2 changed files with 4 additions and 2 deletions

View File

@@ -172,8 +172,6 @@ if config.asan_shadow_scale != '':
if config.memprof_shadow_scale != '':
config.target_cflags += " -mllvm -memprof-mapping-scale=" + config.memprof_shadow_scale
config.environment = dict(os.environ)
# Clear some environment variables that might affect Clang.
possibly_dangerous_env_vars = ['ASAN_OPTIONS', 'DFSAN_OPTIONS', 'HWASAN_OPTIONS',
'LSAN_OPTIONS', 'MSAN_OPTIONS', 'UBSAN_OPTIONS',

View File

@@ -18,6 +18,7 @@ set_default("compiler_rt_src_root", "@COMPILER_RT_SOURCE_DIR@")
set_default("compiler_rt_obj_root", "@COMPILER_RT_BINARY_DIR@")
set_default("enable_per_target_runtime_dir", @LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_PYBOOL@)
set_default("llvm_tools_dir", "@LLVM_TOOLS_DIR@")
set_default("lit_tools_dir", "@LLVM_LIT_TOOLS_DIR@")
set_default("llvm_shlib_dir", "@LLVM_LIBRARY_OUTPUT_INTDIR@")
set_default("gnu_ld_executable", "@GNU_LD_EXECUTABLE@")
set_default("gold_executable", "@GOLD_EXECUTABLE@")
@@ -76,5 +77,8 @@ config.compiler_rt_libdir = lit_config.substitute(config.compiler_rt_libdir)
if not os.path.exists(config.clang):
lit_config.fatal("Can't find compiler on path %r" % config.clang)
import lit.llvm
lit.llvm.initialize(lit_config, config)
# Setup attributes common for all compiler-rt projects.
lit_config.load_config(config, "@COMPILER_RT_SOURCE_DIR@/test/lit.common.cfg.py")