aboutsummaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules21
1 files changed, 20 insertions, 1 deletions
diff --git a/Makefile.rules b/Makefile.rules
index c737965d09..e9461c84c9 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -663,6 +663,23 @@ else
endif
endif
+ifeq ($(NACL_SANDBOX),1)
+ # NOTE: we specify --noirt to tell the driver that we should link
+ # against private (non-stable, non-IRT) libraries for the
+ # sandboxed translator. This could have been specified directly,
+ # except that LLVM slips in -lpthread elsewhere in the build system,
+ # and we need it to use -lpthread_private instead.
+ LIBS += -Wl,--noirt -lsrpc -limc_syscalls -lplatform -lgio -lpthread \
+ -lm -lnacl -lnacl_dyncode -lnosys
+ ifeq ($(USE_TCMALLOC),1)
+ # Note: -ltcmalloc_minimal needs to stay last on the link line
+ LIBS += -ltcmalloc_minimal
+ CXX.Flags += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
+ C.Flags += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
+ endif
+else
+ LIBS +=
+endif
#----------------------------------------------------------
# Options To Invoke Tools
@@ -1249,8 +1266,10 @@ endif
$(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
$(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
$(notdir $@)
+ # @LOCALMOD: the EXTRA_LIBS hack is necessary for LLVMgold.so
+ # c.f. llvm/tools/gold/Makefile
$(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
- $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
+ $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS) $(EXTRA_LIBS)
else
$(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
$(Echo) Linking $(BuildMode) Shared Library $(notdir $@)