[Lldb-commits] [lldb] [LLDB] Fix ASAN tests on newer versions of macOS (PR #165883)

via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 31 09:49:21 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Adrian Prantl (adrian-prantl)

<details>
<summary>Changes</summary>

macOS forbids injecting the ASAN runtime into system processes when SIP is enabled. That includes the just-built libLTO that the just-built clang injects into the system linker.  Since we don't test the compiler here, just use the system (non-asanified) LTO library to make ASAN tests work for most users, including the bots.

---
Full diff: https://github.com/llvm/llvm-project/pull/165883.diff


1 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/make/Makefile.rules (+11) 


``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 09939e29e5b75..28cae54776ac8 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -322,6 +322,17 @@ ifeq (,$(filter $(OS), Windows_NT Android Darwin))
 		LDFLAGS += -pthread
 	endif
 endif
+
+# macOS forbids injecting the ASAN runtime into system processes when
+# SIP is enabled. That includes the just-built libLTO that the
+# just-built clang injects into the system linker.  Since we don't
+# test the compiler here, just use the system (non-asanified) LTO
+# library to make ASAN tests work for most users, including the bots.
+ifeq "$(OS)" "Darwin"
+ifneq "$(ASAN_OPTIONS)" ""
+LD_FLAGS += -Wl,-lto_library -Wl,$(shell dirname $(shell xcrun -find clang))/../lib/libLTO.dylib
+endif
+endif
 OBJECTS =
 EXE ?= a.out
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/165883


More information about the lldb-commits mailing list