Skip to content

Commit 2fc2e1f

Browse files
committed
[LLDB] Fix darwin shell tests under ASAN
1 parent 793ab6a commit 2fc2e1f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lldb/test/Shell/helper/toolchain.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ def use_support_substitutions(config):
250250
"-L{}".format(config.libcxx_libs_dir),
251251
"-lc++",
252252
]
253+
# By default, macOS doesn't allow injecting the ASAN runtime into system processes.
254+
if platform.system() in ["Darwin"] and config.llvm_use_sanitizer:
255+
system_clang = (
256+
subprocess.check_output(["xcrun", "-find", "clang"]).strip().decode("utf-8")
257+
)
258+
system_liblto = os.path.join(
259+
os.path.dirname(os.path.dirname(system_clang)), "lib", "libLTO.dylib"
260+
)
261+
host_flags += ["-Wl,-lto_library", "-Wl," + system_liblto]
253262

254263
host_flags = " ".join(host_flags)
255264
config.substitutions.append(("%clang_host", "%clang " + host_flags))

0 commit comments

Comments
 (0)