From 5c3c307cfe81413ad4e0de2d875bc0f393923340 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sun, 13 Oct 2024 10:44:25 +0100 Subject: [PATCH] Hack around change to `clang -print-runtime-dir` `clang -print-runtime-dir` reports a non-existent directory as we build with `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF`. See https://github.com/llvm/llvm-project/pull/102834. I suspect https://github.com/llvm/llvm-project/commit/b6a1473f97d38471b08331dee7ae7f6112c495c0 caused the change by chaning the code in Driver.cpp to not check whether the printed directory existed. --- deps/sanitizers.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/deps/sanitizers.mk b/deps/sanitizers.mk index 2d0f0988a39b9b..4d1bfa548232e4 100644 --- a/deps/sanitizers.mk +++ b/deps/sanitizers.mk @@ -1,18 +1,19 @@ # Interrogate the compiler about where it is keeping its sanitizer libraries ifeq ($(USECLANG),1) -SANITIZER_LIB_PATH := $(shell LANG=C $(CC) -print-runtime-dir) +SANITIZER_LIB_PATH := $(shell LANG=C $(CC) -print-runtime-dir)\:$(subst $(eval ) ,:,$(abspath $(wildcard $(shell LANG=C $(CC) -print-resource-dir)/lib/*/))) else SANITIZER_LIB_PATH := $(dir $(shell LANG=C $(CC) -print-file-name=libasan.so)) endif # Given a colon-separated list of paths in $(2), find the location of the library given in $(1) define pathsearch_all -$(wildcard $(addsuffix /$(1),$(subst :, ,$(2)))) +$(eval _result := $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(2)))))) +$(if $(_result),$(_result),$(error No matches found for '$(1)' in $(2))) endef define copy_sanitizer_lib install-sanitizers: $$(addprefix $$(build_libdir)/, $$(notdir $$(call pathsearch_all,$(1),$$(SANITIZER_LIB_PATH)))) | $$(build_shlibdir) -$$(addprefix $$(build_shlibdir)/,$(2)): $$(addprefix $$(SANITIZER_LIB_PATH)/,$(2)) | $$(build_shlibdir) +$$(addprefix $$(build_shlibdir)/,$(2)): $$(addprefix $$(dir $$(call pathsearch_all,$(1),$$(SANITIZER_LIB_PATH))),$(2)) | $$(build_shlibdir) -cp $$< $$@ $(if $(filter $(OS), Linux), \ -$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$$$ORIGIN' $$@ , 0)