Skip to content

Commit

Permalink
don't export symbols via regular make
Browse files Browse the repository at this point in the history
As title
  • Loading branch information
esc committed Jun 14, 2021
1 parent 5812318 commit e1f251d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ffi/Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ CXX ?= g++
CXX_FLTO_FLAGS ?= -flto
LD_FLTO_FLAGS ?= -flto -Wl,--exclude-libs=ALL

# don't export LLVM symbols

CXXFLAGS := $(CPPFLAGS) $(CXXFLAGS) $(LLVM_CXXFLAGS) $(CXX_FLTO_FLAGS)
LDFLAGS := $(LDFLAGS) $(LLVM_LDFLAGS) $(LD_FLTO_FLAGS)
LIBS = $(LLVM_LIBS)
Expand Down
10 changes: 9 additions & 1 deletion ffi/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,15 @@ def main_posix(kind, library_ext):
os.environ['LLVM_CXXFLAGS'] = ' '.join(cxxflags)

ldflags = run_llvm_config(llvm_config, ["--ldflags"])
os.environ['LLVM_LDFLAGS'] = ldflags.strip()
os.environ['LLVM_LDFLAGS'] = " ".join((ldflags.strip(),
# Grab Don't export LLVM symbols
"-Wl,-unexported_symbol,__ZTVN4llvm*",
"-Wl,-unexported_symbol,__ZNK4llvm*",
"-Wl,-unexported_symbol,__ZN4llvm*",
"-Wl,-unexported_symbol,__ZTIN4llvm*",
"-Wl,-unexported_symbol,_LLVM*",
"-Wl,-unexported_symbol,__ZTSN4llvm*"))

# static link libstdc++ for portability
if int(os.environ.get('LLVMLITE_CXX_STATIC_LINK', 0)):
os.environ['CXX_STATIC_LINK'] = "-static-libstdc++"
Expand Down

0 comments on commit e1f251d

Please sign in to comment.