Skip to content

Commit 5c3c307

Browse files
committed
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 llvm/llvm-project#102834. I suspect llvm/llvm-project@b6a1473 caused the change by chaning the code in Driver.cpp to not check whether the printed directory existed.
1 parent f7571c6 commit 5c3c307

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: deps/sanitizers.mk

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
# Interrogate the compiler about where it is keeping its sanitizer libraries
22
ifeq ($(USECLANG),1)
3-
SANITIZER_LIB_PATH := $(shell LANG=C $(CC) -print-runtime-dir)
3+
SANITIZER_LIB_PATH := $(shell LANG=C $(CC) -print-runtime-dir)\:$(subst $(eval ) ,:,$(abspath $(wildcard $(shell LANG=C $(CC) -print-resource-dir)/lib/*/)))
44
else
55
SANITIZER_LIB_PATH := $(dir $(shell LANG=C $(CC) -print-file-name=libasan.so))
66
endif
77

88
# Given a colon-separated list of paths in $(2), find the location of the library given in $(1)
99
define pathsearch_all
10-
$(wildcard $(addsuffix /$(1),$(subst :, ,$(2))))
10+
$(eval _result := $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(2))))))
11+
$(if $(_result),$(_result),$(error No matches found for '$(1)' in $(2)))
1112
endef
1213

1314
define copy_sanitizer_lib
1415
install-sanitizers: $$(addprefix $$(build_libdir)/, $$(notdir $$(call pathsearch_all,$(1),$$(SANITIZER_LIB_PATH)))) | $$(build_shlibdir)
15-
$$(addprefix $$(build_shlibdir)/,$(2)): $$(addprefix $$(SANITIZER_LIB_PATH)/,$(2)) | $$(build_shlibdir)
16+
$$(addprefix $$(build_shlibdir)/,$(2)): $$(addprefix $$(dir $$(call pathsearch_all,$(1),$$(SANITIZER_LIB_PATH))),$(2)) | $$(build_shlibdir)
1617
-cp $$< $$@
1718
$(if $(filter $(OS), Linux), \
1819
-$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$$$ORIGIN' $$@ , 0)

0 commit comments

Comments
 (0)