Skip to content

Commit

Permalink
Hack around change to clang -print-runtime-dir
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
Zentrik committed Oct 13, 2024
1 parent f7571c6 commit 5c3c307
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions deps/sanitizers.mk
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 5c3c307

Please sign in to comment.