svn commit: r317215 - head/lib/clang

Dimitry Andric dim at FreeBSD.org
Thu Apr 20 21:00:11 UTC 2017


Author: dim
Date: Thu Apr 20 21:00:09 2017
New Revision: 317215
URL: https://svnweb.freebsd.org/changeset/base/317215

Log:
  Add function and data sections when building llvm, clang, lld and lldb,
  and allow the linker to garbage collect them.  This shaves off up to a
  few MB from the final executables.
  
  MFC after:	3 days

Modified:
  head/lib/clang/llvm.build.mk

Modified: head/lib/clang/llvm.build.mk
==============================================================================
--- head/lib/clang/llvm.build.mk	Thu Apr 20 21:00:04 2017	(r317214)
+++ head/lib/clang/llvm.build.mk	Thu Apr 20 21:00:09 2017	(r317215)
@@ -40,6 +40,10 @@ CFLAGS+=	-DLLVM_DEFAULT_TARGET_TRIPLE=\"
 CFLAGS+=	-DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\"
 CFLAGS+=	-DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\"
 
+CFLAGS+=	-ffunction-sections
+CFLAGS+=	-fdata-sections
+LDFLAGS+=	-Wl,--gc-sections
+
 CXXFLAGS+=	-std=c++11
 CXXFLAGS+=	-fno-exceptions
 CXXFLAGS+=	-fno-rtti


More information about the svn-src-head mailing list