Rename config.host_os to config.target_os.

config.host_os is derived from CMAKE_SYSTEM_NAME
which specifies the target. See:
https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_NAME.html

To reduce confusion, rename it to config.target_os.

The variable name config.target_os was already being used by the Orc
tests. Rename it to config.orc_test_target_os with a FIXME to remove.

Reviewers: JDevlieghere, MaskRay

Reviewed By: MaskRay

Pull Request: https://github.com/llvm/llvm-project/pull/149015
This commit is contained in:
Peter Collingbourne
2025-07-17 11:12:29 -07:00
committed by GitHub
parent f480e1b825
commit 3fa07ed5b3
39 changed files with 107 additions and 106 deletions

View File

@@ -27,7 +27,7 @@ config.substitutions.append( ("%clangxx_tysan ", build_invocation(clang_tysan_cx
config.suffixes = ['.c', '.cc', '.cpp']
# TypeSanitizer tests are currently supported on Linux only.
if config.host_os not in ['Linux']:
if config.target_os not in ['Linux']:
config.unsupported = True
if config.target_arch != 'aarch64':

View File

@@ -28,7 +28,7 @@ default_asan_opts = list(config.default_sanitizer_opts)
# tests to prevent regressions.
# Currently, detect_leaks for asan tests only work on Intel MacOS.
if (
config.host_os == "Darwin"
config.target_os == "Darwin"
and config.apple_platform == "osx"
and config.target_arch == "x86_64"
):
@@ -45,7 +45,7 @@ config.substitutions.append(
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
if config.host_os not in ["FreeBSD", "NetBSD"]:
if config.target_os not in ["FreeBSD", "NetBSD"]:
libdl_flag = "-ldl"
else:
libdl_flag = ""
@@ -125,17 +125,17 @@ config.substitutions.append(
("%clangxx_asan_lto ", build_invocation(clang_asan_cxxflags, True))
)
if config.asan_dynamic:
if config.host_os in ["Linux", "FreeBSD", "NetBSD", "SunOS"]:
if config.target_os in ["Linux", "FreeBSD", "NetBSD", "SunOS"]:
shared_libasan_path = os.path.join(
config.compiler_rt_libdir,
"libclang_rt.asan{}.so".format(config.target_suffix),
)
elif config.host_os == "Darwin":
elif config.target_os == "Darwin":
shared_libasan_path = os.path.join(
config.compiler_rt_libdir,
"libclang_rt.asan_{}_dynamic.dylib".format(config.apple_platform),
)
elif config.host_os == "Windows":
elif config.target_os == "Windows":
shared_libasan_path = os.path.join(
config.compiler_rt_libdir,
"clang_rt.asan_dynamic-{}.lib".format(config.target_suffix),
@@ -274,16 +274,16 @@ leak_detection_android = (
and (config.target_arch in ["x86_64", "i386", "i686", "aarch64"])
)
leak_detection_linux = (
(config.host_os == "Linux")
(config.target_os == "Linux")
and (not config.android)
and (config.target_arch in ["x86_64", "i386", "riscv64", "loongarch64"])
)
leak_detection_mac = (
(config.host_os == "Darwin")
(config.target_os == "Darwin")
and (config.apple_platform == "osx")
and (config.target_arch == "x86_64")
)
leak_detection_netbsd = (config.host_os == "NetBSD") and (
leak_detection_netbsd = (config.target_os == "NetBSD") and (
config.target_arch in ["x86_64", "i386"]
)
if (
@@ -296,7 +296,7 @@ if (
# Add the RT libdir to PATH directly so that we can successfully run the gtest
# binary to list its tests.
if config.host_os == "Windows":
if config.target_os == "Windows":
os.environ["PATH"] = os.path.pathsep.join(
[config.compiler_rt_libdir, os.environ.get("PATH", "")]
)
@@ -310,10 +310,10 @@ if config.compiler_id == "MSVC":
# Default test suffixes.
config.suffixes = [".c", ".cpp"]
if config.host_os == "Darwin":
if config.target_os == "Darwin":
config.suffixes.append(".mm")
if config.host_os == "Windows":
if config.target_os == "Windows":
config.substitutions.append(("%fPIC", ""))
config.substitutions.append(("%fPIE", ""))
config.substitutions.append(("%pie", ""))
@@ -323,11 +323,11 @@ else:
config.substitutions.append(("%pie", "-pie"))
# Only run the tests on supported OSs.
if config.host_os not in ["Linux", "Darwin", "FreeBSD", "SunOS", "Windows", "NetBSD"]:
if config.target_os not in ["Linux", "Darwin", "FreeBSD", "SunOS", "Windows", "NetBSD"]:
config.unsupported = True
if not config.parallelism_group:
config.parallelism_group = "shadow-memory"
if config.host_os == "NetBSD":
if config.target_os == "NetBSD":
config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix))

View File

@@ -68,7 +68,7 @@ if libasan_abi_path is not None:
config.suffixes = ['.c', '.cpp']
if config.host_os == 'Darwin':
if config.target_os == 'Darwin':
config.suffixes.append('.mm')
else:
config.unsupported = True

View File

@@ -80,10 +80,10 @@ if is_msvc:
config.compiler_rt_libdir, "clang_rt.builtins%s.lib " % config.target_suffix
)
config.substitutions.append(("%librt ", base_lib))
elif config.host_os == "Darwin":
elif config.target_os == "Darwin":
base_lib = os.path.join(config.compiler_rt_libdir, "libclang_rt.osx.a ")
config.substitutions.append(("%librt ", base_lib + " -lSystem "))
elif config.host_os == "Windows":
elif config.target_os == "Windows":
base_lib = os.path.join(
config.compiler_rt_libdir, "libclang_rt.builtins%s.a" % config.target_suffix
)
@@ -104,7 +104,7 @@ else:
if sys.platform in ["win32"] and execute_external:
# Don't pass dosish path separator to msys bash.exe.
base_lib = base_lib.replace("\\", "/")
if config.host_os == "Haiku":
if config.target_os == "Haiku":
config.substitutions.append(("%librt ", base_lib + " -lroot "))
else:
config.substitutions.append(("%librt ", base_lib + " -lc -lm "))

View File

@@ -21,7 +21,7 @@ config.substitutions.append(
("%clang ", " " + config.clang + " " + " ".join(extra_flags) + " ")
)
if config.host_os == "Darwin":
if config.target_os == "Darwin":
config.substitutions.append(
("%macos_version_major", str(config.darwin_osx_version[0]))
)

View File

@@ -7,7 +7,7 @@ import re
import lit.formats
# Only run the tests on supported OSs.
if config.host_os not in ["Linux"]:
if config.target_os not in ["Linux"]:
config.unsupported = True

View File

@@ -25,5 +25,5 @@ config.substitutions.append(("%clangxx_dfsan ", build_invocation(clang_dfsan_cxx
config.suffixes = [".c", ".cpp"]
# DataFlowSanitizer tests are currently supported on Linux only.
if not (config.host_os in ["Linux"] and config.target_arch in ["aarch64", "x86_64", "loongarch64"]):
if not (config.target_os in ["Linux"] and config.target_arch in ["aarch64", "x86_64", "loongarch64"]):
config.unsupported = True

View File

@@ -149,5 +149,5 @@ config.substitutions.append(
if not config.parallelism_group:
config.parallelism_group = "shadow-memory"
if config.host_os == "NetBSD":
if config.target_os == "NetBSD":
config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix))

View File

@@ -67,5 +67,5 @@ config.substitutions.append(
)
# GWP-ASan tests are currently supported on Linux only.
if config.host_os not in ["Linux"]:
if config.target_os not in ["Linux"]:
config.unsupported = True

View File

@@ -86,5 +86,5 @@ llvm_config.add_tool_substitutions(
# Default test suffixes.
config.suffixes = [".c", ".cpp"]
if config.host_os not in ["Linux", "Android"] or not config.has_lld:
if config.target_os not in ["Linux", "Android"] or not config.has_lld:
config.unsupported = True

View File

@@ -66,7 +66,7 @@ def find_compiler_libdir():
# Fall back for older AppleClang that doesn't support `-print-runtime-dir`
# Note `-print-file-name=<path to compiler-rt lib>` was broken for Apple
# platforms so we can't use that approach here (see https://reviews.llvm.org/D101682).
if config.host_os == "Darwin":
if config.target_os == "Darwin":
lib_dir, _ = get_path_from_clang(["-print-file-name=lib"], allow_failure=False)
runtime_dir = os.path.join(lib_dir, "darwin")
if not os.path.exists(runtime_dir):
@@ -312,7 +312,7 @@ config.environment["PATH"] = path
if platform.system() == "Windows" and target_is_msvc:
config.environment["LIB"] = os.environ["LIB"]
config.available_features.add(config.host_os.lower())
config.available_features.add(config.target_os.lower())
if config.target_triple.startswith("ppc") or config.target_triple.startswith("powerpc"):
config.available_features.add("ppc")
@@ -344,7 +344,7 @@ config.substitutions.append(
)
)
if config.host_os == "NetBSD":
if config.target_os == "NetBSD":
nb_commands_dir = os.path.join(
config.compiler_rt_src_root, "test", "sanitizer_common", "netbsd_commands"
)
@@ -395,7 +395,7 @@ if config.have_disable_symbolizer_path_search:
if sanitizer not in config.environment:
config.environment[sanitizer] = symbolizer_path
env_utility = "/opt/freeware/bin/env" if config.host_os == "AIX" else "env"
env_utility = "/opt/freeware/bin/env" if config.target_os == "AIX" else "env"
env_unset_command = " ".join(f"-u {var}" for var in tool_symbolizer_path_list)
config.substitutions.append(
("%env_unset_tool_symbolizer_path", f"{env_utility} {env_unset_command}")
@@ -410,7 +410,7 @@ if emulator:
lit_config.warning("%device_rm is not implemented")
config.substitutions.append(("%device_rm", "echo "))
config.compile_wrapper = ""
elif config.host_os == "Darwin" and config.apple_platform != "osx":
elif config.target_os == "Darwin" and config.apple_platform != "osx":
# Darwin tests can be targetting macOS, a device or a simulator. All devices
# are declared as "ios", even for iOS derivatives (tvOS, watchOS). Similarly,
# all simulators are "iossim". See the table below.
@@ -498,7 +498,7 @@ else:
config.compile_wrapper = ""
# Define CHECK-%os to check for OS-dependent output.
config.substitutions.append(("CHECK-%os", ("CHECK-" + config.host_os)))
config.substitutions.append(("CHECK-%os", ("CHECK-" + config.target_os)))
# Define %arch to check for architecture-dependent output.
config.substitutions.append(("%arch", (config.host_arch)))
@@ -519,7 +519,7 @@ if target_arch:
config.available_features.add(target_arch + "-target-arch")
if target_arch in ["x86_64", "i386"]:
config.available_features.add("x86-target-arch")
config.available_features.add(target_arch + "-" + config.host_os.lower())
config.available_features.add(target_arch + "-" + config.target_os.lower())
compiler_rt_debug = getattr(config, "compiler_rt_debug", False)
if not compiler_rt_debug:
@@ -565,7 +565,7 @@ config.substitutions.append(
("%darwin_min_target_with_tls_support", "%min_macos_deployment_target=10.12")
)
if config.host_os == "Darwin":
if config.target_os == "Darwin":
osx_version = (10, 0, 0)
try:
osx_version = subprocess.check_output(
@@ -708,7 +708,7 @@ else:
config.substitutions.append(("%push_to_device", "echo "))
config.substitutions.append(("%adb_shell", "echo "))
if config.host_os == "Linux":
if config.target_os == "Linux":
def add_glibc_versions(ver_string):
if config.android:
return
@@ -806,10 +806,10 @@ def is_windows_lto_supported():
return os.path.exists(os.path.join(config.llvm_tools_dir, "lld-link.exe"))
if config.host_os == "Darwin" and is_darwin_lto_supported():
if config.target_os == "Darwin" and is_darwin_lto_supported():
config.lto_supported = True
config.lto_flags = ["-Wl,-lto_library," + liblto_path()]
elif config.host_os in ["Linux", "FreeBSD", "NetBSD"]:
elif config.target_os in ["Linux", "FreeBSD", "NetBSD"]:
config.lto_supported = False
if config.use_lld and is_lld_lto_supported():
config.lto_supported = True
@@ -822,7 +822,7 @@ elif config.host_os in ["Linux", "FreeBSD", "NetBSD"]:
config.lto_flags = ["-fuse-ld=lld"]
else:
config.lto_flags = ["-fuse-ld=gold"]
elif config.host_os == "Windows" and is_windows_lto_supported():
elif config.target_os == "Windows" and is_windows_lto_supported():
config.lto_supported = True
config.lto_flags = ["-fuse-ld=lld"]
else:
@@ -871,7 +871,7 @@ if platform.system() == "Darwin":
# Note that substitutions with numbers have to be defined first to avoid
# being subsumed by substitutions with smaller postfix.
for postfix in ["2", "1", ""]:
if config.host_os == "Darwin":
if config.target_os == "Darwin":
config.substitutions.append(
(
"%ld_flags_rpath_exe" + postfix,
@@ -884,7 +884,7 @@ for postfix in ["2", "1", ""]:
"-install_name @rpath/`basename %dynamiclib{}`".format(postfix),
)
)
elif config.host_os in ("FreeBSD", "NetBSD", "OpenBSD"):
elif config.target_os in ("FreeBSD", "NetBSD", "OpenBSD"):
config.substitutions.append(
(
"%ld_flags_rpath_exe" + postfix,
@@ -893,7 +893,7 @@ for postfix in ["2", "1", ""]:
)
)
config.substitutions.append(("%ld_flags_rpath_so" + postfix, ""))
elif config.host_os == "Linux":
elif config.target_os == "Linux":
config.substitutions.append(
(
"%ld_flags_rpath_exe" + postfix,
@@ -901,7 +901,7 @@ for postfix in ["2", "1", ""]:
)
)
config.substitutions.append(("%ld_flags_rpath_so" + postfix, ""))
elif config.host_os == "SunOS":
elif config.target_os == "SunOS":
config.substitutions.append(
(
"%ld_flags_rpath_exe" + postfix,
@@ -923,7 +923,7 @@ for postfix in ["2", "1", ""]:
config.substitutions.append(("%xdynamiclib_namespec", "%basename_t.dynamic"))
config.default_sanitizer_opts = []
if config.host_os == "Darwin":
if config.target_os == "Darwin":
# On Darwin, we default to `abort_on_error=1`, which would make tests run
# much slower. Let's override this and run lit tests with 'abort_on_error=0'.
config.default_sanitizer_opts += ["abort_on_error=0"]
@@ -983,7 +983,7 @@ if config.use_lld and config.has_lld and not config.use_lto:
elif config.use_lld and (not config.has_lld):
config.unsupported = True
if config.host_os == "Darwin":
if config.target_os == "Darwin":
if getattr(config, "darwin_linker_version", None):
extra_cflags += ["-mlinker-version=" + config.darwin_linker_version]
@@ -998,7 +998,7 @@ config.clang = (
)
config.target_cflags = " " + " ".join(target_cflags + extra_cflags) + " "
if config.host_os == "Darwin":
if config.target_os == "Darwin":
config.substitutions.append(
(
"%get_pid_from_output",

View File

@@ -34,7 +34,7 @@ elif lsan_lit_test_mode == "AddressSanitizer":
config.name = "LeakSanitizer-AddressSanitizer"
lsan_cflags = ["-fsanitize=address"]
config.available_features.add("asan")
if config.host_os == "NetBSD":
if config.target_os == "NetBSD":
config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix))
elif lsan_lit_test_mode == "HWAddressSanitizer":
config.name = "LeakSanitizer-HWAddressSanitizer"
@@ -42,7 +42,7 @@ elif lsan_lit_test_mode == "HWAddressSanitizer":
if target_arch == "x86_64":
lsan_cflags = lsan_cflags + ["-fsanitize-hwaddress-experimental-aliasing"]
config.available_features.add("hwasan")
if config.host_os == "NetBSD":
if config.target_os == "NetBSD":
config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix))
else:
lit_config.fatal("Unknown LSan test mode: %r" % lsan_lit_test_mode)
@@ -51,7 +51,7 @@ config.name += config.name_suffix
# Platform-specific default LSAN_OPTIONS for lit tests.
default_common_opts_str = ":".join(list(config.default_sanitizer_opts))
default_lsan_opts = default_common_opts_str + ":detect_leaks=1"
if config.host_os == "Darwin":
if config.target_os == "Darwin":
# On Darwin, we default to `abort_on_error=1`, which would make tests run
# much slower. Let's override this and run lit tests with 'abort_on_error=0'.
# Also, make sure we do not overwhelm the syslog while testing.
@@ -101,7 +101,7 @@ supported_android = (
)
supported_linux = (
(not config.android)
and config.host_os == "Linux"
and config.target_os == "Linux"
and config.host_arch
in [
"aarch64",
@@ -117,8 +117,8 @@ supported_linux = (
"loongarch64",
]
)
supported_darwin = config.host_os == "Darwin" and config.target_arch in ["x86_64"]
supported_netbsd = config.host_os == "NetBSD" and config.target_arch in [
supported_darwin = config.target_os == "Darwin" and config.target_arch in ["x86_64"]
supported_netbsd = config.target_os == "NetBSD" and config.target_arch in [
"x86_64",
"i386",
]

View File

@@ -106,7 +106,7 @@ config.substitutions.append(("%fPIE", "-fPIE"))
config.substitutions.append(("%pie", "-pie"))
# Only run the tests on supported OSs.
if config.host_os not in ["Linux"]:
if config.target_os not in ["Linux"]:
config.unsupported = True
if not config.parallelism_group:

View File

@@ -5,5 +5,5 @@ config.test_source_root = os.path.dirname(__file__)
config.suffixes = [".cpp"]
# Binary metadata is currently emitted only for ELF binaries
# and sizes of stack arguments depend on the arch.
if config.host_os not in ["Linux"] or config.target_arch not in ["x86_64"]:
if config.target_os not in ["Linux"] or config.target_arch not in ["x86_64"]:
config.unsupported = True

View File

@@ -20,7 +20,7 @@ clang_msan_cflags = (
+ config.debug_info_flags
)
# Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD.
if config.host_os == "FreeBSD":
if config.target_os == "FreeBSD":
clang_msan_cflags += ["-lexecinfo", "-fPIC"]
# On SystemZ we need -mbackchain to make the fast unwinder work.
if config.target_arch == "s390x":
@@ -44,7 +44,7 @@ config.substitutions.append(("%clang_kmsan ", build_invocation(clang_kmsan_cflag
# Default test suffixes.
config.suffixes = [".c", ".cpp"]
if config.host_os not in ["Linux", "NetBSD", "FreeBSD"]:
if config.target_os not in ["Linux", "NetBSD", "FreeBSD"]:
config.unsupported = True
# For mips64, mips64el we have forced store_context_size to 1 because these
@@ -55,5 +55,5 @@ if config.host_arch in ["mips64", "mips64el"]:
else:
config.substitutions.append(("CHECK-%short-stack", "CHECK-FULL-STACK"))
if config.host_os == "NetBSD":
if config.target_os == "NetBSD":
config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix))

View File

@@ -32,5 +32,5 @@ config.substitutions.append(
)
# NSan tests are currently supported on Linux only.
if config.host_os not in ["Linux"]:
if config.target_os not in ["Linux"]:
config.unsupported = True

View File

@@ -18,11 +18,11 @@ if host_arch_compatible:
config.available_features.add("host-arch-compatible")
# If the target OS hasn't been set then assume host.
if not config.target_os:
config.target_os = config.host_os
if not config.orc_test_target_os:
config.orc_test_target_os = config.target_os
config.test_target_is_host_executable = (
config.target_os == config.host_os and host_arch_compatible
config.orc_test_target_os == config.target_os and host_arch_compatible
)
# Assume that llvm-jitlink is in the config.llvm_tools_dir.
@@ -31,7 +31,7 @@ orc_rt_executor_stem = os.path.join(
config.compiler_rt_obj_root, "lib/orc/tests/tools/orc-rt-executor"
)
lli = os.path.join(config.llvm_tools_dir, "lli")
if config.host_os == "Darwin":
if config.target_os == "Darwin":
orc_rt_path = "%s/liborc_rt_osx.a" % config.compiler_rt_libdir
else:
orc_rt_path = "%s/liborc_rt%s.a" % (config.compiler_rt_libdir, config.target_suffix)
@@ -53,7 +53,7 @@ config.substitutions.append(
config.substitutions.append(
("%clang_cl ", build_invocation(["--driver-mode=cl"] + [config.target_cflags]))
)
if config.host_os == "Windows":
if config.target_os == "Windows":
config.substitutions.append(
(
"%llvm_jitlink",
@@ -86,7 +86,7 @@ config.suffixes = [".c", ".cpp", ".m", ".S", ".ll", ".test"]
# Exclude Inputs directories.
config.excludes = ["Inputs"]
if config.host_os not in ["Darwin", "FreeBSD", "Linux", "Windows"]:
if config.target_os not in ["Darwin", "FreeBSD", "Linux", "Windows"]:
config.unsupported = True
# Ask llvm-config about assertion mode.

View File

@@ -5,7 +5,8 @@ config.name_suffix = "@ORC_TEST_CONFIG_SUFFIX@"
config.orc_lit_source_dir = "@ORC_LIT_SOURCE_DIR@"
config.target_cflags = "@ORC_TEST_TARGET_CFLAGS@"
config.target_arch = "@ORC_TEST_TARGET_ARCH@"
config.target_os = "@ORC_TEST_TARGET_OS@"
# FIXME: Remove this variable, the target OS is available in config.target_os.
config.orc_test_target_os = "@ORC_TEST_TARGET_OS@"
config.built_with_llvm = ("@COMPILER_RT_STANDALONE_BUILD@" != "TRUE")
config.libunwind_shared = "@LIBUNWIND_ENABLE_SHARED@"
config.libunwind_install_dir = "@LLVM_BINARY_DIR@/@LIBUNWIND_INSTALL_LIBRARY_DIR@"

View File

@@ -30,7 +30,7 @@ if (
target_is_msvc = bool(re.match(r".*-windows-msvc$", config.target_triple))
if config.host_os in ["Linux"]:
if config.target_os in ["Linux"]:
extra_link_flags = ["-ldl"]
elif target_is_msvc:
# InstrProf is incompatible with incremental linking. Disable it as a
@@ -154,7 +154,7 @@ config.substitutions.append(
)
)
if config.host_os not in [
if config.target_os not in [
"Windows",
"Darwin",
"FreeBSD",
@@ -167,10 +167,10 @@ if config.host_os not in [
config.unsupported = True
config.substitutions.append(
("%shared_lib_flag", "-dynamiclib" if (config.host_os == "Darwin") else "-shared")
("%shared_lib_flag", "-dynamiclib" if (config.target_os == "Darwin") else "-shared")
)
if config.host_os in ["AIX"]:
if config.target_os in ["AIX"]:
config.available_features.add("system-aix")
exclude_unsupported_files_for_aix(config.test_source_root)
exclude_unsupported_files_for_aix(config.test_source_root + "/Posix")
@@ -184,5 +184,5 @@ if config.android:
if config.have_curl:
config.available_features.add("curl")
if config.host_os in ("AIX", "Darwin", "Linux"):
if config.target_os in ("AIX", "Darwin", "Linux"):
config.available_features.add("continuous-mode")

View File

@@ -15,7 +15,7 @@ config.test_source_root = config.test_exec_root
if not config.parallelism_group:
config.parallelism_group = 'shadow-memory'
if config.host_os == 'Darwin':
if config.target_os == 'Darwin':
# On Darwin, we default to ignore_noninstrumented_modules=1, which also
# suppresses some races the tests are supposed to find. See rtsan/lit.cfg.py.
if 'RTSAN_OPTIONS' in config.environment:

View File

@@ -6,7 +6,7 @@ config.name = "RTSAN" + config.name_suffix
default_rtsan_opts = "atexit_sleep_ms=0"
if config.host_os == "Darwin":
if config.target_os == "Darwin":
# On Darwin, we default to `abort_on_error=1`, which would make tests run
# much slower. Let's override this and run lit tests with 'abort_on_error=0'.
default_rtsan_opts += ":abort_on_error=0"
@@ -36,7 +36,7 @@ def build_invocation(compile_flags):
llvm_rtsan = os.path.join(config.llvm_tools_dir, "llvm-rtsan")
# Setup substitutions.
if config.host_os == "Linux":
if config.target_os == "Linux":
libdl_flag = "-ldl"
else:
libdl_flag = ""
@@ -52,7 +52,7 @@ config.substitutions.append(("%llvm_rtsan", llvm_rtsan))
# Default test suffixes.
config.suffixes = [".c", ".cpp"]
if config.host_os not in ["Darwin", "FreeBSD", "Linux", "NetBSD", "OpenBSD"]:
if config.target_os not in ["Darwin", "FreeBSD", "Linux", "NetBSD", "OpenBSD"]:
config.unsupported = True
elif "64" not in config.host_arch:
if "arm" in config.host_arch:
@@ -61,5 +61,5 @@ elif "64" not in config.host_arch:
else:
config.unsupported = True
if config.host_os == "NetBSD":
if config.target_os == "NetBSD":
config.substitutions.insert(0, ("%run", config.netbsd_nomprotect_prefix))

View File

@@ -33,5 +33,5 @@ if config.lto_supported:
)
)
if config.host_os not in ["Linux", "FreeBSD", "NetBSD", "SunOS"]:
if config.target_os not in ["Linux", "FreeBSD", "NetBSD", "SunOS"]:
config.unsupported = True

View File

@@ -40,7 +40,7 @@ else:
config.available_features.add(config.tool_name)
if (
config.host_os == "Linux"
config.target_os == "Linux"
and config.tool_name == "lsan"
and config.target_arch == "i386"
):
@@ -49,7 +49,7 @@ if (
if config.arm_thumb:
config.available_features.add("thumb")
if config.host_os == "Darwin":
if config.target_os == "Darwin":
# On Darwin, we default to `abort_on_error=1`, which would make tests run
# much slower. Let's override this and run lit tests with 'abort_on_error=0'.
default_tool_options += ["abort_on_error=0"]
@@ -68,7 +68,7 @@ if default_tool_options_str:
extra_link_flags = []
if config.host_os in ["Linux"]:
if config.target_os in ["Linux"]:
extra_link_flags += ["-ldl"]
clang_cflags = config.debug_info_flags + tool_cflags + [config.target_cflags]
@@ -92,13 +92,13 @@ config.substitutions.append(
config.suffixes = [".c", ".cpp"]
if config.host_os not in ["Linux", "Darwin", "NetBSD", "FreeBSD", "SunOS"]:
if config.target_os not in ["Linux", "Darwin", "NetBSD", "FreeBSD", "SunOS"]:
config.unsupported = True
if not config.parallelism_group:
config.parallelism_group = "shadow-memory"
if config.host_os == "NetBSD":
if config.target_os == "NetBSD":
config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix))
if os.path.exists("/etc/services"):

View File

@@ -70,5 +70,5 @@ config.substitutions.append(
)
# Hardened Allocator tests are currently supported on Linux only.
if config.host_os not in ["Linux"]:
if config.target_os not in ["Linux"]:
config.unsupported = True

View File

@@ -32,5 +32,5 @@ config.substitutions.append(
)
)
if config.host_os not in ["Linux"] or config.target_arch not in ["aarch64", "riscv64"]:
if config.target_os not in ["Linux"] or config.target_arch not in ["aarch64", "riscv64"]:
config.unsupported = True

View File

@@ -15,7 +15,7 @@ config.test_source_root = config.test_exec_root
if not config.parallelism_group:
config.parallelism_group = 'shadow-memory'
if config.host_os == 'Darwin':
if config.target_os == 'Darwin':
# On Darwin, we default to ignore_noninstrumented_modules=1, which also
# suppresses some races the tests are supposed to find. See tsan/lit.cfg.py.
if 'TSAN_OPTIONS' in config.environment:

View File

@@ -14,5 +14,5 @@ if "libdispatch" in root.available_features:
else:
config.unsupported = True
if config.host_os == "Darwin":
if config.target_os == "Darwin":
config.environment["TSAN_OPTIONS"] += ":ignore_noninstrumented_modules=1"

View File

@@ -23,7 +23,7 @@ config.test_source_root = os.path.dirname(__file__)
# Setup environment variables for running ThreadSanitizer.
default_tsan_opts = "atexit_sleep_ms=0"
if config.host_os == "Darwin":
if config.target_os == "Darwin":
# On Darwin, we default to `abort_on_error=1`, which would make tests run
# much slower. Let's override this and run lit tests with 'abort_on_error=0'.
default_tsan_opts += ":abort_on_error=0"
@@ -61,7 +61,7 @@ clang_tsan_cxxflags = (
)
# Add additional flags if we're using instrumented libc++.
# Instrumented libcxx currently not supported on Darwin.
if config.has_libcxx and config.host_os != "Darwin":
if config.has_libcxx and config.target_os != "Darwin":
# FIXME: Dehardcode this path somehow.
libcxx_path = os.path.join(
config.compiler_rt_obj_root,
@@ -86,7 +86,7 @@ config.substitutions.append(("%clang_tsan ", build_invocation(clang_tsan_cflags)
config.substitutions.append(("%clangxx_tsan ", build_invocation(clang_tsan_cxxflags)))
# Define CHECK-%os to check for OS-dependent output.
config.substitutions.append(("CHECK-%os", ("CHECK-" + config.host_os)))
config.substitutions.append(("CHECK-%os", ("CHECK-" + config.target_os)))
config.substitutions.append(
(
@@ -101,7 +101,7 @@ config.substitutions.append(
# Default test suffixes.
config.suffixes = [".c", ".cpp", ".m", ".mm"]
if config.host_os not in ["FreeBSD", "Linux", "Darwin", "NetBSD"]:
if config.target_os not in ["FreeBSD", "Linux", "Darwin", "NetBSD"]:
config.unsupported = True
if config.android:
@@ -110,5 +110,5 @@ if config.android:
if not config.parallelism_group:
config.parallelism_group = "shadow-memory"
if config.host_os == "NetBSD":
if config.target_os == "NetBSD":
config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix))

View File

@@ -71,7 +71,7 @@ config.substitutions.append(
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
if config.host_os not in ["FreeBSD", "NetBSD"]:
if config.target_os not in ["FreeBSD", "NetBSD"]:
libdl_flag = "-ldl"
else:
libdl_flag = ""
@@ -127,10 +127,10 @@ push_dynamic_library_lookup_path(config, config.compiler_rt_libdir)
# Default test suffixes.
config.suffixes = [".c", ".cpp"]
if config.host_os == "Darwin":
if config.target_os == "Darwin":
config.suffixes.append(".mm")
if config.host_os == "Windows":
if config.target_os == "Windows":
config.substitutions.append(("%fPIC", ""))
config.substitutions.append(("%fPIE", ""))
config.substitutions.append(("%pie", ""))
@@ -140,7 +140,7 @@ else:
config.substitutions.append(("%pie", "-pie"))
# Only run the tests on supported OSs.
if config.host_os not in [
if config.target_os not in [
"Linux",
"Darwin",
]:

View File

@@ -1,4 +1,4 @@
if config.host_os not in ["Darwin", "FreeBSD", "Linux", "NetBSD"]:
if config.target_os not in ["Darwin", "FreeBSD", "Linux", "NetBSD"]:
config.unsupported = True
# Work around "Cannot represent a difference across sections"
if config.target_arch == "powerpc64":

View File

@@ -74,7 +74,7 @@ config.substitutions.append(("%gmlt ", " ".join(config.debug_info_flags) + " "))
config.suffixes = [".c", ".cpp", ".m"]
# Check that the host supports UndefinedBehaviorSanitizer tests
if config.host_os not in [
if config.target_os not in [
"Linux",
"Darwin",
"FreeBSD",
@@ -90,5 +90,5 @@ config.excludes = ["Inputs"]
if ubsan_lit_test_mode in ["AddressSanitizer", "MemorySanitizer", "ThreadSanitizer"]:
if not config.parallelism_group:
config.parallelism_group = "shadow-memory"
if config.host_os == "NetBSD":
if config.target_os == "NetBSD":
config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix))

View File

@@ -35,7 +35,7 @@ config.substitutions.append(("%clangxx ", build_invocation(clang_ubsan_cxxflags)
config.suffixes = [".c", ".cpp"]
# Check that the host supports UndefinedBehaviorSanitizerMinimal tests
if config.host_os not in [
if config.target_os not in [
"Linux",
"FreeBSD",
"NetBSD",

View File

@@ -14,7 +14,7 @@ clang_xray_cflags = ["-fxray-instrument", config.target_cflags]
# If libc++ was used to build XRAY libraries, libc++ is needed. Fix applied
# to Linux only since -rpath may not be portable. This can be extended to
# other platforms.
if config.libcxx_used == "1" and config.host_os == "Linux":
if config.libcxx_used == "1" and config.target_os == "Linux":
clang_xray_cflags = clang_xray_cflags + (
["-L%s -lc++ -Wl,-rpath=%s" % (config.llvm_shlib_dir, config.llvm_shlib_dir)]
)
@@ -30,7 +30,7 @@ def build_invocation(compile_flags):
llvm_xray = os.path.join(config.llvm_tools_dir, "llvm-xray")
# Setup substitutions.
if config.host_os == "Linux":
if config.target_os == "Linux":
libdl_flag = "-ldl"
else:
libdl_flag = ""
@@ -56,7 +56,7 @@ config.substitutions.append(
# Default test suffixes.
config.suffixes = [".c", ".cpp"]
if config.host_os not in ["FreeBSD", "Linux", "NetBSD", "OpenBSD"]:
if config.target_os not in ["FreeBSD", "Linux", "NetBSD", "OpenBSD"]:
config.unsupported = True
elif "64" not in config.host_arch:
if "arm" in config.host_arch:
@@ -65,5 +65,5 @@ elif "64" not in config.host_arch:
else:
config.unsupported = True
if config.host_os == "NetBSD":
if config.target_os == "NetBSD":
config.substitutions.insert(0, ("%run", config.netbsd_nomprotect_prefix))

View File

@@ -42,7 +42,7 @@ if "TMP" in os.environ:
if "TEMP" in os.environ:
config.environment["TEMP"] = os.environ["TEMP"]
if config.host_os == "Darwin":
if config.target_os == "Darwin":
# Only run up to 3 processes that require shadow memory simultaneously on
# 64-bit Darwin. Using more scales badly and hogs the system due to
# inefficient handling of large mmap'd regions (terabytes) by the kernel.

View File

@@ -10,7 +10,7 @@ config.compiler_rt_libdir = lit_config.substitute("@COMPILER_RT_RESOLVED_LIBRARY
config.enable_per_target_runtime_dir = @LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_PYBOOL@
config.llvm_build_mode = lit_config.substitute("@LLVM_BUILD_MODE@")
config.host_arch = "@HOST_ARCH@"
config.host_os = "@HOST_OS@"
config.target_os = "@HOST_OS@"
config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@"
config.gwp_asan = @COMPILER_RT_HAS_GWP_ASAN_PYBOOL@
config.emulator = "@COMPILER_RT_EMULATOR@"

View File

@@ -130,14 +130,14 @@ if is_configured("llvm_use_sanitizer"):
config.environment["MallocNanoZone"] = "0"
if "Address" in config.llvm_use_sanitizer:
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
if "Darwin" in config.host_os:
if "Darwin" in config.target_os:
config.environment["DYLD_INSERT_LIBRARIES"] = find_sanitizer_runtime(
"libclang_rt.asan_osx_dynamic.dylib"
)
if "Thread" in config.llvm_use_sanitizer:
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
if "Darwin" in config.host_os:
if "Darwin" in config.target_os:
config.environment["DYLD_INSERT_LIBRARIES"] = find_sanitizer_runtime(
"libclang_rt.tsan_osx_dynamic.dylib"
)

View File

@@ -13,7 +13,7 @@ config.lldb_src_root = "@LLDB_SOURCE_DIR@"
config.lldb_libs_dir = lit_config.substitute("@LLDB_LIBS_DIR@")
config.lldb_framework_dir = lit_config.substitute("@LLDB_FRAMEWORK_DIR@")
config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
config.host_os = "@HOST_OS@"
config.target_os = "@HOST_OS@"
config.host_triple = "@LLVM_HOST_TRIPLE@"
config.shared_libs = @LLVM_ENABLE_SHARED_LIBS@
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"

View File

@@ -63,7 +63,7 @@ llvm_config.with_environment("OCAMLRUNPARAM", "b")
def get_asan_rtlib():
if (
not "Address" in config.llvm_use_sanitizer
or not "Darwin" in config.host_os
or not "Darwin" in config.target_os
or not "x86" in config.host_triple
):
return ""

View File

@@ -26,7 +26,7 @@ config.enable_assertions = @ENABLE_ASSERTIONS@
config.targets_to_build = "@TARGETS_TO_BUILD@"
config.native_target = "@LLVM_NATIVE_ARCH@"
config.llvm_bindings = "@LLVM_BINDINGS@".split(' ')
config.host_os = "@HOST_OS@"
config.target_os = "@HOST_OS@"
config.host_cc = "@HOST_CC@"
config.host_cxx = "@HOST_CXX@"
# Note: ldflags can contain double-quoted paths, so must use single quotes here.