Skip to content

Commit

Permalink
FreeBSD: propose a simpler way to deal with libgcc_s
Browse files Browse the repository at this point in the history
Tweak the order of libgcc_s in DT_NEEDED.
Make FreeBSD do not require `BUILD_CUSTOM_LIBCXX`.

See also: #21788, #22352
  • Loading branch information
iblislin committed Jul 2, 2017
1 parent 4015c83 commit d0a7b1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
14 changes: 10 additions & 4 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,6 @@ LDFLAGS += -L$(build_libdir) -L$(GCCPATH) -Wl,-rpath,$(build_libdir) -Wl,-rpath,
# This ensures we get the right RPATH even if we're missing FFLAGS somewhere
FC += -Wl,-rpath=$(GCCPATH)

# Build our own libc++ and libc++abi because otherwise /usr/lib/libc++.so and /lib/libcxxrt.so will
# be linked in when building LLVM, and those link to /lib/libgcc_s.so
BUILD_CUSTOM_LIBCXX ?= 1
endif # gfortran
endif # FreeBSD

Expand Down Expand Up @@ -959,7 +956,16 @@ endif

ifeq ($(OS), FreeBSD)
JLDFLAGS := -Wl,-Bdynamic
OSLIBS += -lelf -lkvm -lrt -Wl,--export-dynamic -Wl,--version-script=$(JULIAHOME)/src/julia.expmap $(NO_WHOLE_ARCHIVE) $(LIBUNWIND)
OSLIBS += -lelf -lkvm -lrt

# Tweak order of libgcc_s in DT_NEEDED,
# make it loaded first to
# prevent from linking to outdated system libs.
# See #21788
OSLIBS += -lgcc_s

OSLIBS += -Wl,--export-dynamic -Wl,--version-script=$(JULIAHOME)/src/julia.expmap \
$(NO_WHOLE_ARCHIVE) $(LIBUNWIND)
endif

ifeq ($(OS), Darwin)
Expand Down
7 changes: 0 additions & 7 deletions deps/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,6 @@ LLVM_CMAKE += -DLLDB_DISABLE_PYTHON=ON
endif # LLDB_DISABLE_PYTHON
endif # BUILD_LLDB

# Part of the FreeBSD libgcc_s kludge
ifeq ($(OS),FreeBSD)
ifneq ($(GCCPATH),)
LLVM_LDFLAGS += -Wl,-rpath,'\$$ORIGIN',-rpath,$(GCCPATH)
endif
endif

ifneq (,$(filter $(ARCH), powerpc64le ppc64le))
LLVM_CXXFLAGS += -mminimal-toc
endif
Expand Down
6 changes: 0 additions & 6 deletions deps/tools/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ endif

ifneq (,$(findstring $(OS),Linux FreeBSD))
INSTALL_RPATH := "\$$ORIGIN"
# Part of the FreeBSD libgcc_s kludge
ifeq ($(OS),FreeBSD)
ifneq ($(GCCPATH),)
INSTALL_RPATH := "\$$ORIGIN:$(GCCPATH)"
endif
endif
CMAKE_COMMON += -DCMAKE_INSTALL_RPATH=$(INSTALL_RPATH)
endif # Linux or FreeBSD

Expand Down

0 comments on commit d0a7b1e

Please sign in to comment.