Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Apr 2017 21:00:09 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317215 - head/lib/clang
Message-ID:  <201704202100.v3KL0938093345@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704202100.v3KL0938093345>