Lines Matching full:config
11 def get_required_attr(config, attr_name):
12 attr_value = getattr(config, attr_name, None)
21 # Setup config name.
22 config.name = "AddressSanitizer" + config.name_suffix
25 default_asan_opts = list(config.default_sanitizer_opts)
29 if config.host_os == "Darwin" and config.apple_platform == "osx":
34 config.environment["ASAN_OPTIONS"] = default_asan_opts_str
36 config.substitutions.append(
41 config.test_source_root = os.path.dirname(__file__)
43 if config.host_os not in ["FreeBSD", "NetBSD"]:
50 if config.compiler_id == "GNU":
57 target_cflags = [get_required_attr(config, "target_cflags")] + extra_link_flags
58 target_cxxflags = config.cxx_mode_flags + target_cflags
66 + config.debug_info_flags
69 if config.target_arch == "s390x":
71 clang_asan_static_cxxflags = config.cxx_mode_flags + clang_asan_static_cflags
73 target_is_msvc = bool(re.match(r".*-windows-msvc$", config.target_triple))
76 if config.asan_dynamic:
88 config.available_features.add("asan-dynamic-runtime")
90 config.available_features.add("asan-static-runtime")
97 if config.asan_dynamic:
101 config.available_features.add(win_runtime_feature)
106 if with_lto and config.lto_supported:
107 lto_flags += config.lto_flags
109 return " " + " ".join([config.clang] + lto_flags + compile_flags) + " "
112 config.substitutions.append(("%clang ", build_invocation(target_cflags)))
113 config.substitutions.append(("%clangxx ", build_invocation(target_cxxflags)))
114 config.substitutions.append(("%clang_asan ", build_invocation(clang_asan_cflags)))
115 config.substitutions.append(("%clangxx_asan ", build_invocation(clang_asan_cxxflags)))
116 config.substitutions.append(
119 config.substitutions.append(
122 if config.asan_dynamic:
123 if config.host_os in ["Linux", "FreeBSD", "NetBSD", "SunOS"]:
125 config.compiler_rt_libdir,
126 "libclang_rt.asan{}.so".format(config.target_suffix),
128 elif config.host_os == "Darwin":
130 config.compiler_rt_libdir,
131 "libclang_rt.asan_{}_dynamic.dylib".format(config.apple_platform),
133 elif config.host_os == "Windows":
135 config.compiler_rt_libdir,
136 "clang_rt.asan_dynamic-{}.lib".format(config.target_suffix),
145 config.substitutions.append(("%shared_libasan", shared_libasan_path))
146 config.substitutions.append(
149 config.substitutions.append(
161 + config.debug_info_flags
164 if config.compiler_id != "MSVC":
167 if config.asan_dynamic:
172 config.substitutions.append(("%clang_cl ", clang_cl_invocation))
178 config.substitutions.append(("%clang_cl_asan ", clang_cl_asan_invocation))
179 config.substitutions.append(("%clang_cl_nocxx_asan ", clang_cl_asan_invocation))
180 config.substitutions.append(("%Od", "-Od"))
181 config.substitutions.append(("%Fe", "-Fe"))
182 config.substitutions.append(("%LD", "-LD"))
183 config.substitutions.append(("%MD", "-MD"))
184 config.substitutions.append(("%MT", "-MT"))
185 config.substitutions.append(("%Gw", "-Gw"))
188 config.compiler_rt_libdir, "clang_rt.asan%%s%s.lib" % config.target_suffix
190 config.substitutions.append(("%asan_lib", base_lib % "_dynamic"))
191 if config.asan_dynamic:
192 config.substitutions.append(
196 config.substitutions.append(
199 config.substitutions.append(("%asan_cxx_lib", base_lib % "_cxx"))
200 config.substitutions.append(
203 config.substitutions.append(
206 config.substitutions.append(("%asan_dll_thunk", base_lib % "_dll_thunk"))
210 config.substitutions.append(("%clang_cl ", build_invocation(target_cxxflags)))
211 config.substitutions.append(
214 config.substitutions.append(
217 config.substitutions.append(("%Od", "-O0"))
218 config.substitutions.append(("%Fe", "-o"))
219 config.substitutions.append(("%LD", "-shared"))
220 config.substitutions.append(("%MD", ""))
221 config.substitutions.append(("%MT", ""))
222 config.substitutions.append(("%Gw", "-fdata-sections"))
226 get_required_attr(config, "compiler_rt_src_root"), "lib", "asan"
228 python_exec = shlex.quote(get_required_attr(config, "python_executable"))
233 config.substitutions.append(
238 get_required_attr(config, "compiler_rt_src_root"), "lib", "sanitizer_common"
243 config.substitutions.append(("%sancov ", python_exec + " " + sancov + " "))
246 if config.host_arch.find("64") != -1 and not config.android:
251 config.substitutions.append(
255 config.substitutions.append(("%libdl", libdl_flag))
257 config.available_features.add("asan-" + config.bits + "-bits")
260 if not config.arm_thumb:
261 config.available_features.add("fast-unwinder-works")
265 config.android
266 and "android-thread-properties-api" in config.available_features
267 and (config.target_arch in ["x86_64", "i386", "i686", "aarch64"])
270 (config.host_os == "Linux")
271 and (not config.android)
272 and (config.target_arch in ["x86_64", "i386", "riscv64", "loongarch64"])
274 leak_detection_mac = (config.host_os == "Darwin") and (config.apple_platform == "osx")
275 leak_detection_netbsd = (config.host_os == "NetBSD") and (
276 config.target_arch in ["x86_64", "i386"]
284 config.available_features.add("leak-detection")
288 if config.host_os == "Windows":
290 [config.compiler_rt_libdir, os.environ.get("PATH", "")]
294 if config.compiler_id == "MSVC":
295 config.environment["LIB"] = os.path.pathsep.join(
296 [config.compiler_rt_libdir, config.environment.get("LIB", "")]
300 config.suffixes = [".c", ".cpp"]
302 if config.host_os == "Darwin":
303 config.suffixes.append(".mm")
305 if config.host_os == "Windows":
306 config.substitutions.append(("%fPIC", ""))
307 config.substitutions.append(("%fPIE", ""))
308 config.substitutions.append(("%pie", ""))
310 config.substitutions.append(("%fPIC", "-fPIC"))
311 config.substitutions.append(("%fPIE", "-fPIE"))
312 config.substitutions.append(("%pie", "-pie"))
315 if config.host_os not in ["Linux", "Darwin", "FreeBSD", "SunOS", "Windows", "NetBSD"]:
316 config.unsupported = True
318 if not config.parallelism_group:
319 config.parallelism_group = "shadow-memory"
321 if config.host_os == "NetBSD":
322 config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix))