Skip to content

Commit 20e1a12

Browse files
committed
[LLDB] Fix (more) darwin shell tests under ASAN
1 parent 540250c commit 20e1a12

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lldb/test/Shell/helper/build.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,19 @@ def _get_link_command(self):
804804
args.extend(self._obj_file_names())
805805

806806
if sys.platform == "darwin":
807+
# By default, macOS doesn't allow injecting the ASAN
808+
# runtime into system processes.
809+
system_clang = (
810+
subprocess.check_output(["xcrun", "-find", "clang"])
811+
.strip()
812+
.decode("utf-8")
813+
)
814+
system_liblto = os.path.join(
815+
os.path.dirname(os.path.dirname(system_clang)), "lib", "libLTO.dylib"
816+
)
807817
args.extend(["-isysroot", self.apple_sdk])
818+
args.extend(["-Wl,-lto_library", "-Wl," + system_liblto])
819+
808820
elif self.objc_gnustep_lib:
809821
args.extend(["-L", self.objc_gnustep_lib, "-lobjc"])
810822
if sys.platform == "linux":

0 commit comments

Comments
 (0)