Skip to content

Commit 527e0ec

Browse files
[LLDB] Fix ASAN tests on newer versions of macOS (llvm#165883)
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.
1 parent 7a957bd commit 527e0ec

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,17 @@ ifeq (,$(filter $(OS), Windows_NT Android Darwin))
322322
LDFLAGS += -pthread
323323
endif
324324
endif
325+
326+
# macOS forbids injecting the ASAN runtime into system processes when
327+
# SIP is enabled. That includes the just-built libLTO that the
328+
# just-built clang injects into the system linker. Since we don't
329+
# test the compiler here, just use the system (non-asanified) LTO
330+
# library to make ASAN tests work for most users, including the bots.
331+
ifeq "$(OS)" "Darwin"
332+
ifneq "$(ASAN_OPTIONS)" ""
333+
LD_FLAGS += -Wl,-lto_library -Wl,$(shell dirname $(shell xcrun -find clang))/../lib/libLTO.dylib
334+
endif
335+
endif
325336
OBJECTS =
326337
EXE ?= a.out
327338

0 commit comments

Comments
 (0)