aboutsummaryrefslogtreecommitdiff
path: root/lib/clang/llvm.build.mk
diff options
context:
space:
mode:
Diffstat (limited to 'lib/clang/llvm.build.mk')
-rw-r--r--lib/clang/llvm.build.mk12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk
index b248fb816364..70b39fdc44ca 100644
--- a/lib/clang/llvm.build.mk
+++ b/lib/clang/llvm.build.mk
@@ -100,12 +100,24 @@ CFLAGS+= -DLLVM_NATIVE_TARGETMC=LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC
CFLAGS+= -ffunction-sections
CFLAGS+= -fdata-sections
+.if ${LINKER_TYPE} == "mac"
+LDFLAGS+= -Wl,-dead_strip
+.else
LDFLAGS+= -Wl,--gc-sections
+.endif
CXXSTD?= c++14
CXXFLAGS+= -fno-exceptions
CXXFLAGS+= -fno-rtti
+.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING)
+# Building on macOS/Linux needs the real sysctl() not the bootstrap tools stub.
+CFLAGS+= -DBOOTSTRAPPING_WANT_NATIVE_SYSCTL
+.else
CXXFLAGS.clang+= -stdlib=libc++
+.endif
+.if defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Linux"
+LIBADD+= dl
+.endif
.if ${MACHINE_ARCH:Mmips64}
STATIC_CFLAGS+= -mxgot