Lines Matching full:config
19 config.clang.strip(),
20 f"--target={config.target_triple}",
43 if config.compiler_id != "Clang":
45 f"Determining compiler's runtime directory is not supported for {config.compiler_id}"
53 shlex.split(config.target_cflags) + ["-print-runtime-dir"], allow_failure=True
69 if config.host_os == "Darwin":
80 def push_dynamic_library_lookup_path(config, new_path):
91 (new_path, config.environment.get(dynamic_library_lookup_var, ""))
93 config.environment[dynamic_library_lookup_var] = new_ld_library_path
98 (new_path, config.environment.get(dynamic_library_lookup_var, ""))
100 config.environment[dynamic_library_lookup_var] = new_ld_32_library_path
105 (new_path, config.environment.get(dynamic_library_lookup_var, ""))
107 config.environment[dynamic_library_lookup_var] = new_ld_library_path_32
111 (new_path, config.environment.get(dynamic_library_lookup_var, ""))
113 config.environment[dynamic_library_lookup_var] = new_ld_library_path_64
128 config.recursiveExpansionLimit = 10
131 config.test_format = lit.formats.ShTest(execute_external)
133 config.available_features.add("shell")
135 target_is_msvc = bool(re.match(r".*-windows-msvc$", config.target_triple))
136 target_is_windows = bool(re.match(r".*-windows.*$", config.target_triple))
138 compiler_id = getattr(config, "compiler_id", None)
141 config.cxx_mode_flags = ["--driver-mode=g++"]
143 config.cxx_mode_flags = []
146 config.debug_info_flags = ["-gline-tables-only"]
151 config.debug_info_flags.append("-gcodeview")
152 config.debug_info_flags.append("-gcolumn-info")
154 config.debug_info_flags = ["/Z7"]
155 config.cxx_mode_flags = []
157 config.cxx_mode_flags = ["-x c++"]
158 config.debug_info_flags = ["-g"]
162 config.available_features.add(compiler_id)
165 # config.compiler_rt_libdir (COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR) has the
167 # tests on 64-bit hosts and vice versa. Adjust config.compiler_rt_libdir
169 if config.enable_per_target_runtime_dir:
170 if config.target_arch == "i386":
171 config.compiler_rt_libdir = re.sub(
172 r"/x86_64(?=-[^/]+$)", "/i386", config.compiler_rt_libdir
174 elif config.target_arch == "x86_64":
175 config.compiler_rt_libdir = re.sub(
176 r"/i386(?=-[^/]+$)", "/x86_64", config.compiler_rt_libdir
178 if config.target_arch == "sparc":
179 config.compiler_rt_libdir = re.sub(
180 r"/sparcv9(?=-[^/]+$)", "/sparc", config.compiler_rt_libdir
182 elif config.target_arch == "sparcv9":
183 config.compiler_rt_libdir = re.sub(
184 r"/sparc(?=-[^/]+$)", "/sparcv9", config.compiler_rt_libdir
193 shlex.split(config.target_cflags) + ["-print-resource-dir"], allow_failure=True
199 lit_config.note(f"Resource dir for {config.clang} is {test_cc_resource_dir}")
200 local_build_resource_dir = os.path.realpath(config.compiler_rt_output_dir)
201 if test_cc_resource_dir != local_build_resource_dir and config.test_standalone_build_libs:
202 if config.compiler_id == "Clang":
206 f'libraries in "{config.compiler_rt_libdir}"'
215 config.target_cflags += f" -nobuiltininc"
216 config.target_cflags += f" -I{config.compiler_rt_src_root}/include"
217 config.target_cflags += f" -idirafter {test_cc_resource_dir}/include"
218 config.target_cflags += f" -resource-dir={config.compiler_rt_output_dir}"
221 config.target_cflags += f" -Wl,-rpath,{config.compiler_rt_libdir}"
225 f"compiler: {config.compiler_id}"
230 # doesn't match config.compiler_rt_libdir then it means we might be testing the
235 compiler_rt_libdir_real = os.path.realpath(config.compiler_rt_libdir)
242 if config.test_standalone_build_libs:
244 if not config.test_suite_supports_overriding_runtime_lib_path:
258 config.compiler_rt_libdir = compiler_libdir
259 lit_config.note(f'Testing using libraries in "{config.compiler_rt_libdir}"')
262 if config.asan_shadow_scale != "":
263 config.target_cflags += " -mllvm -asan-mapping-scale=" + config.asan_shadow_scale
264 if config.memprof_shadow_scale != "":
265 config.target_cflags += (
266 " -mllvm -memprof-mapping-scale=" + config.memprof_shadow_scale
299 if name in config.environment:
300 del config.environment[name]
303 if (not config.llvm_tools_dir) or (not os.path.exists(config.llvm_tools_dir)):
305 "Invalid llvm_tools_dir config attribute: %r" % config.llvm_tools_dir
307 path = os.path.pathsep.join((config.llvm_tools_dir, config.environment["PATH"]))
308 config.environment["PATH"] = path
313 config.environment["LIB"] = os.environ["LIB"]
315 config.available_features.add(config.host_os.lower())
317 if config.target_triple.startswith("ppc") or config.target_triple.startswith("powerpc"):
318 config.available_features.add("ppc")
320 if re.match(r"^x86_64.*-linux", config.target_triple):
321 config.available_features.add("x86_64-linux")
323 config.available_features.add("host-byteorder-" + sys.byteorder + "-endian")
325 if config.have_zlib:
326 config.available_features.add("zlib")
327 config.substitutions.append(("%zlib_include_dir", config.zlib_include_dir))
328 config.substitutions.append(("%zlib_library", config.zlib_library))
330 if config.have_internal_symbolizer:
331 config.available_features.add("internal_symbolizer")
335 config.substitutions.append(
339 instead define '%clangXXX' substitution in lit config. ***\n\n""",
343 if config.host_os == "NetBSD":
345 config.compiler_rt_src_root, "test", "sanitizer_common", "netbsd_commands"
347 config.netbsd_noaslr_prefix = "sh " + os.path.join(nb_commands_dir, "run_noaslr.sh")
348 config.netbsd_nomprotect_prefix = "sh " + os.path.join(
351 config.substitutions.append(("%run_nomprotect", config.netbsd_nomprotect_prefix))
353 config.substitutions.append(("%run_nomprotect", "%run"))
355 # Copied from libcxx's config.py
360 val = getattr(config, name, None)
371 config.compiler_rt_src_root, "test", "sanitizer_common", "ios_commands"
377 config.substitutions.append(("%run", emulator))
378 config.substitutions.append(("%env ", "env "))
382 config.substitutions.append(("%device_rm", "echo "))
383 config.compile_wrapper = ""
384 elif config.host_os == "Darwin" and config.apple_platform != "osx":
401 ios_or_iossim = "iossim" if config.apple_platform.endswith("sim") else "ios"
403 config.available_features.add("ios")
406 config.available_features.add("iossim")
413 if config.apple_platform != "ios" and config.apple_platform != "iossim":
414 config.available_features.add(config.apple_platform)
424 config.environment[device_id_env] = os.environ[device_id_env]
425 config.substitutions.append(("%run", run_wrapper))
426 config.substitutions.append(("%env ", env_wrapper + " "))
429 config.substitutions.append(("%device_rm", "{} rm ".format(run_wrapper)))
430 config.compile_wrapper = compile_wrapper
435 [prepare_script, config.apple_platform, config.clang]
448 config.environment.update(prepare_output["env"])
449 elif config.android:
450 config.available_features.add("android")
453 config.compiler_rt_src_root,
461 config.compile_wrapper = compile_wrapper
462 config.substitutions.append(("%run", ""))
463 config.substitutions.append(("%env ", "env "))
465 config.substitutions.append(("%run", ""))
466 config.substitutions.append(("%env ", "env "))
468 config.substitutions.append(("%device_rm", "echo "))
469 config.compile_wrapper = ""
472 config.substitutions.append(("CHECK-%os", ("CHECK-" + config.host_os)))
475 config.substitutions.append(("%arch", (config.host_arch)))
477 if config.host_os == "Windows":
482 config.expect_crash = "not KillTheDoctor "
484 config.expect_crash = "not --crash "
486 config.substitutions.append(("%expect_crash ", config.expect_crash))
488 target_arch = getattr(config, "target_arch", None)
490 config.available_features.add(target_arch + "-target-arch")
492 config.available_features.add("x86-target-arch")
493 config.available_features.add(target_arch + "-" + config.host_os.lower())
495 compiler_rt_debug = getattr(config, "compiler_rt_debug", False)
497 config.available_features.add("compiler-rt-optimized")
499 libdispatch = getattr(config, "compiler_rt_intercept_libdispatch", False)
501 config.available_features.add("libdispatch")
503 sanitizer_can_use_cxxabi = getattr(config, "sanitizer_can_use_cxxabi", True)
505 config.available_features.add("cxxabi")
507 if not getattr(config, "sanitizer_uses_static_cxxabi", False):
508 config.available_features.add("shared_cxxabi")
510 if not getattr(config, "sanitizer_uses_static_unwind", False):
511 config.available_features.add("shared_unwind")
513 if config.has_lld:
514 config.available_features.add("lld-available")
516 if config.aarch64_sme:
517 config.available_features.add("aarch64-sme-available")
519 if config.use_lld:
520 config.available_features.add("lld")
522 if config.can_symbolize:
523 config.available_features.add("can-symbolize")
525 if config.gwp_asan:
526 config.available_features.add("gwp_asan")
528 lit.util.usePlatformSdkOnDarwin(config, lit_config)
535 config.substitutions.append(
539 if config.host_os == "Darwin":
549 config.available_features.add("osx-autointerception")
550 config.available_features.add("osx-ld64-live_support")
552 config.available_features.add("jit-compatible-osx-swift-runtime")
556 config.darwin_osx_version = osx_version
565 config.available_features.add("x86_64h")
570 if config.apple_platform == "iossim":
571 if config.target_arch == "i386":
572 config.unsupported = True
575 platform = config.apple_platform
601 flag = config.apple_platform_min_deployment_target_flag
606 apple_device = config.apple_platform.split("sim")[0]
607 sim = "-simulator" if "sim" in config.apple_platform else ""
609 config.substitutions.append(
617 config.substitutions.append(("%%min_macos_deployment_target=%s.%s" % vers, ""))
619 if config.android:
621 if config.android_serial:
622 env["ANDROID_SERIAL"] = config.android_serial
623 config.environment["ANDROID_SERIAL"] = config.android_serial
629 config.substitutions.append(("%device_rundir/", "/data/local/tmp/Output/"))
630 config.substitutions.append(
633 config.substitutions.append(
636 config.substitutions.append(
662 android_api_level = min(android_api_level, int(config.android_api_level))
665 config.available_features.add("android-%s" % required)
670 config.available_features.add("android-thread-properties-api")
675 for file in config.android_files_to_push:
678 config.substitutions.append(("%device_rundir/", ""))
679 config.substitutions.append(("%push_to_device", "echo "))
680 config.substitutions.append(("%adb_shell", "echo "))
682 if config.host_os == "Linux":
684 if config.android:
702 config.available_features.add("glibc-" + required)
705 config.available_features.add("glibc")
709 config.clang.strip(),
710 f"--target={config.target_triple}",
717 ] + shlex.split(config.target_cflags)
732 sancovcc_path = os.path.join(config.llvm_tools_dir, "sancov")
734 config.available_features.add("has_sancovcc")
735 config.substitutions.append(("%sancovcc ", sancovcc_path))
739 return os.path.join(config.llvm_shlib_dir, "libLTO.dylib")
747 if not os.path.exists(os.path.join(config.llvm_shlib_dir, "LLVMgold.so")):
752 for exe in (config.gnu_ld_executable, config.gold_executable):
771 return os.path.exists(os.path.join(config.llvm_tools_dir, "lld"))
777 return os.path.exists(os.path.join(config.llvm_tools_dir, "lld-link.exe"))
780 if config.host_os == "Darwin" and is_darwin_lto_supported():
781 config.lto_supported = True
782 config.lto_flags = ["-Wl,-lto_library," + liblto_path()]
783 elif config.host_os in ["Linux", "FreeBSD", "NetBSD"]:
784 config.lto_supported = False
785 if config.use_lld and is_lld_lto_supported():
786 config.lto_supported = True
788 config.available_features.add("binutils_lto")
789 config.lto_supported = True
791 if config.lto_supported:
792 if config.use_lld:
793 config.lto_flags = ["-fuse-ld=lld"]
795 config.lto_flags = ["-fuse-ld=gold"]
796 elif config.host_os == "Windows" and is_windows_lto_supported():
797 config.lto_supported = True
798 config.lto_flags = ["-fuse-ld=lld"]
800 config.lto_supported = False
802 if config.lto_supported:
803 config.available_features.add("lto")
804 if config.use_thinlto:
805 config.available_features.add("thinlto")
806 config.lto_flags += ["-flto=thin"]
808 config.lto_flags += ["-flto"]
810 if config.have_rpc_xdr_h:
811 config.available_features.add("sunrpc")
816 config.test_retry_attempts = 2
822 ios_device = config.apple_platform != "osx" and not config.apple_platform.endswith(
829 config.parallelism_group = "ios-device"
845 if config.host_os == "Darwin":
846 config.substitutions.append(
852 config.substitutions.append(
858 elif config.host_os in ("FreeBSD", "NetBSD", "OpenBSD"):
859 config.substitutions.append(
866 config.substitutions.append(("%ld_flags_rpath_so" + postfix, ""))
867 elif config.host_os == "Linux":
868 config.substitutions.append(
874 config.substitutions.append(("%ld_flags_rpath_so" + postfix, ""))
875 elif config.host_os == "SunOS":
876 config.substitutions.append(
882 config.substitutions.append(("%ld_flags_rpath_so" + postfix, ""))
885 config.substitutions.append(
888 config.substitutions.append(
894 config.substitutions.append(("%xdynamiclib_namespec", "%basename_t.dynamic"))
896 config.default_sanitizer_opts = []
897 if config.host_os == "Darwin":
900 config.default_sanitizer_opts += ["abort_on_error=0"]
901 config.default_sanitizer_opts += ["log_to_syslog=0"]
914 config.available_features.add("darwin_log_cmd")
919 elif config.android:
920 config.default_sanitizer_opts += ["abort_on_error=0"]
924 if config.android or (config.target_arch not in ["arm", "armhf", "aarch64"]):
925 config.available_features.add("stable-runtime")
927 if config.asan_shadow_scale:
928 config.available_features.add("shadow-scale-%s" % config.asan_shadow_scale)
930 config.available_features.add("shadow-scale-3")
932 if config.memprof_shadow_scale:
933 config.available_features.add(
934 "memprof-shadow-scale-%s" % config.memprof_shadow_scale
937 config.available_features.add("memprof-shadow-scale-3")
939 if config.expensive_checks:
940 config.available_features.add("expensive_checks")
942 # Propagate the LLD/LTO into the clang config option, so nothing else is needed.
944 target_cflags = [getattr(config, "target_cflags", None)]
947 if config.use_lto and config.lto_supported:
948 extra_cflags += config.lto_flags
949 elif config.use_lto and (not config.lto_supported):
950 config.unsupported = True
952 if config.use_lld and config.has_lld and not config.use_lto:
954 elif config.use_lld and (not config.has_lld):
955 config.unsupported = True
957 if config.host_os == "Darwin":
958 if getattr(config, "darwin_linker_version", None):
959 extra_cflags += ["-mlinker-version=" + config.darwin_linker_version]
967 config.clang = (
968 " " + " ".join(run_wrapper + [config.compile_wrapper, config.clang]) + " "
970 config.target_cflags = " " + " ".join(target_cflags + extra_cflags) + " "
972 if config.host_os == "Darwin":
973 config.substitutions.append(
977 shlex.quote(config.python_executable),
982 config.substitutions.append(
986 shlex.quote(config.python_executable),
1000 if config.has_no_default_config_flag:
1001 config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1"
1003 if config.has_compiler_rt_libatomic:
1004 base_lib = os.path.join(config.compiler_rt_libdir, "libclang_rt.atomic%s.so"
1005 % config.target_suffix)
1009 config.substitutions.append(("%libatomic", base_lib + f" -Wl,-rpath,{config.compiler_rt_libdir}"))
1011 config.substitutions.append(("%libatomic", "-latomic"))
1014 push_dynamic_library_lookup_path(config, config.compiler_rt_libdir)
1017 if config.compiler_id == "GNU":
1018 gcc_dir = os.path.dirname(config.clang)
1019 libasan_dir = os.path.join(gcc_dir, "..", "lib" + config.bits)
1020 push_dynamic_library_lookup_path(config, libasan_dir)
1025 config.substitutions.append(("%crt_src", config.compiler_rt_src_root))
1026 config.substitutions.append(("%llvm_src", config.llvm_src_root))