From 104ba9075cc4e6361ec7810cee3f3d4390026f3f Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Thu, 16 Jul 2020 15:23:20 -0400 Subject: [PATCH] build: make libunwind linked dynamically [CI skip] Not sure why this was first linked statically, as the commit that introduced this simply had the message "restoring stuff that seems to have been clobbered by the revert of the unintended merge to master". Nearly all other libraries that we use are linked dynamically. --- Make.inc | 10 +++++----- Makefile | 5 +++++ src/Makefile | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Make.inc b/Make.inc index e91461514463c..21a0299318b51 100644 --- a/Make.inc +++ b/Make.inc @@ -940,17 +940,17 @@ LIBUNWIND:= else ifeq ($(USE_SYSTEM_LIBUNWIND), 1) ifneq ($(OS),Darwin) -LIBUNWIND:=-lunwind-generic -lunwind +LIBUNWIND:=-lunwind # Only for linux since we want to use not yet released libunwind features JCFLAGS+=-DSYSTEM_LIBUNWIND JCPPFLAGS+=-DSYSTEM_LIBUNWIND endif else ifeq ($(OS),Darwin) -LIBUNWIND:=$(build_libdir)/libosxunwind.a +LIBUNWIND:=-losxunwind JCPPFLAGS+=-DLIBOSXUNWIND else -LIBUNWIND:=$(build_libdir)/libunwind-generic.a $(build_libdir)/libunwind.a +LIBUNWIND:=-lunwind endif endif endif @@ -1206,12 +1206,12 @@ OSLIBS += -lelf -lkvm -lrt -lpthread OSLIBS += -lgcc_s OSLIBS += -Wl,--export-dynamic -Wl,--version-script=$(JULIAHOME)/src/julia.expmap \ - $(NO_WHOLE_ARCHIVE) $(LIBUNWIND) + $(NO_WHOLE_ARCHIVE) endif ifeq ($(OS), Darwin) SHLIB_EXT := dylib -OSLIBS += -framework CoreFoundation $(LIBUNWIND) +OSLIBS += -framework CoreFoundation WHOLE_ARCHIVE := -Xlinker -all_load NO_WHOLE_ARCHIVE := JLDFLAGS := diff --git a/Makefile b/Makefile index cad588c148d42..02e7b161ef197 100644 --- a/Makefile +++ b/Makefile @@ -181,6 +181,11 @@ endif ifeq ($(USE_LLVM_SHLIB),1) JL_PRIVATE_LIBS-$(USE_SYSTEM_LLVM) += libLLVM libLLVM-9jl endif +ifeq ($(OS),Darwin) +JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBUNWIND) += libosxunwind +else +JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBUNWIND) += libunwind +endif ifeq ($(USE_SYSTEM_LIBM),0) JL_PRIVATE_LIBS-$(USE_SYSTEM_OPENLIBM) += libopenlibm diff --git a/src/Makefile b/src/Makefile index 3153c0178d0a9..7d8db37402091 100644 --- a/src/Makefile +++ b/src/Makefile @@ -120,7 +120,7 @@ CLANG_LDFLAGS += -Wl,-undefined,dynamic_lookup endif -COMMON_LIBS := -L$(build_shlibdir) -L$(build_libdir) $(LIBUV) $(LIBUTF8PROC) $(NO_WHOLE_ARCHIVE) $(LLVMLINK) $(OSLIBS) $(LIBUNWIND) +COMMON_LIBS := -L$(build_shlibdir) -L$(build_libdir) $(LIBUV) $(LIBUTF8PROC) $(NO_WHOLE_ARCHIVE) $(LIBUNWIND) $(LLVMLINK) $(OSLIBS) DEBUG_LIBS := $(WHOLE_ARCHIVE) $(BUILDDIR)/flisp/libflisp-debug.a $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport-debug.a $(COMMON_LIBS) RELEASE_LIBS := $(WHOLE_ARCHIVE) $(BUILDDIR)/flisp/libflisp.a $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport.a $(COMMON_LIBS)