From 20e1a1248013fcee994f5de13338b96777fe00cd Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 10 Nov 2025 13:25:20 -0800 Subject: [PATCH] [LLDB] Fix (more) darwin shell tests under ASAN --- lldb/test/Shell/helper/build.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lldb/test/Shell/helper/build.py b/lldb/test/Shell/helper/build.py index a5a7e997be04..1fa8aab92c12 100755 --- a/lldb/test/Shell/helper/build.py +++ b/lldb/test/Shell/helper/build.py @@ -804,7 +804,19 @@ class GccBuilder(Builder): args.extend(self._obj_file_names()) if sys.platform == "darwin": + # By default, macOS doesn't allow injecting the ASAN + # runtime into system processes. + system_clang = ( + subprocess.check_output(["xcrun", "-find", "clang"]) + .strip() + .decode("utf-8") + ) + system_liblto = os.path.join( + os.path.dirname(os.path.dirname(system_clang)), "lib", "libLTO.dylib" + ) args.extend(["-isysroot", self.apple_sdk]) + args.extend(["-Wl,-lto_library", "-Wl," + system_liblto]) + elif self.objc_gnustep_lib: args.extend(["-L", self.objc_gnustep_lib, "-lobjc"]) if sys.platform == "linux":