Skip to content

Commit

Permalink
Fix libasan runpath behaviour. (#54104)
Browse files Browse the repository at this point in the history
This is necessary with LLVM 17 but was extracted to a separate patch
xref #53070
  • Loading branch information
gbaraldi committed Apr 17, 2024
1 parent f30aae5 commit 0f7674e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ STRIP_EXPORTED_FUNCS := $(shell $(CPP_STDOUT) -I$(JULIAHOME)/src $(SRCDIR)/list_
endif

$(build_shlibdir)/libjulia.$(JL_MAJOR_MINOR_SHLIB_EXT): $(LIB_OBJS) $(SRCDIR)/list_strip_symbols.h $(BUILDDIR)/julia.expmap | $(build_shlibdir) $(build_libdir)
@$(call PRINT_LINK, $(CC) $(call IMPLIB_FLAGS,$@.tmp) $(LOADER_CFLAGS) -shared $(SHIPFLAGS) $(LIB_OBJS) -o $@ \
@$(call PRINT_LINK, $(CC) $(call IMPLIB_FLAGS,$@.tmp) $(LOADER_CFLAGS) -shared $(SHIPFLAGS) $(LIB_OBJS) $(RPATH_LIB) -o $@ \
$(JLIBLDFLAGS) $(LOADER_LDFLAGS) $(VERSIONSCRIPT) $(call SONAME_FLAGS,libjulia.$(JL_MAJOR_SHLIB_EXT)))
@$(INSTALL_NAME_CMD)libjulia.$(JL_MAJOR_SHLIB_EXT) $@
@$(DSYMUTIL) $@
Expand All @@ -130,7 +130,7 @@ ifeq ($(OS), WINNT)
endif

$(build_shlibdir)/libjulia-debug.$(JL_MAJOR_MINOR_SHLIB_EXT): $(LIB_DOBJS) $(SRCDIR)/list_strip_symbols.h $(BUILDDIR)/julia.expmap | $(build_shlibdir) $(build_libdir)
@$(call PRINT_LINK, $(CC) $(call IMPLIB_FLAGS,$@.tmp) $(LOADER_CFLAGS) -shared $(DEBUGFLAGS) $(LIB_DOBJS) -o $@ \
@$(call PRINT_LINK, $(CC) $(call IMPLIB_FLAGS,$@.tmp) $(LOADER_CFLAGS) -shared $(DEBUGFLAGS) $(LIB_DOBJS) $(RPATH_LIB) -o $@ \
$(JLIBLDFLAGS) $(LOADER_LDFLAGS) $(VERSIONSCRIPT) $(call SONAME_FLAGS,libjulia-debug.$(JL_MAJOR_SHLIB_EXT)))
@$(INSTALL_NAME_CMD)libjulia-debug.$(JL_MAJOR_SHLIB_EXT) $@
@$(DSYMUTIL) $@
Expand Down
1 change: 1 addition & 0 deletions contrib/asan/Make.user.asan
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ TOOLDIR=$(TOOLCHAIN)/usr/tools
USECLANG=1
override CC=$(TOOLDIR)/clang
override CXX=$(TOOLDIR)/clang++
override PATCHELF=$(TOOLDIR)/patchelf
export ASAN_SYMBOLIZER_PATH=$(TOOLDIR)/llvm-symbolizer

USE_BINARYBUILDER_LLVM=1
Expand Down
2 changes: 1 addition & 1 deletion contrib/asan/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if [ ! -d "$TOOLCHAIN" ]; then
cp "$HERE/Make.user.tools" "$TOOLCHAIN/Make.user"
fi

make -C "$TOOLCHAIN/deps" install-clang install-llvm-tools
make -C "$TOOLCHAIN/deps" install-clang install-llvm-tools install-patchelf

echo
echo "Building Julia..."
Expand Down
2 changes: 2 additions & 0 deletions deps/sanitizers.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ 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)
-cp $$< $$@
$(if $(filter $(OS), Linux), \
-$(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$$$ORIGIN' $$@ , 0)
endef

ifeq ($(USECLANG),1)
Expand Down

0 comments on commit 0f7674e

Please sign in to comment.