From 041a214661e67d168e00a81fa804afc78e9c51f4 Mon Sep 17 00:00:00 2001 From: rpaulo Date: Mon, 10 Aug 2015 19:04:05 +0000 Subject: llvm{37,devel}: build and enable LLVM's gold plugin. This makes it possible to use Link Time Optimisations in with -fuse-ld=gold. Reviewed by: brooks Approved by: brooks Differential Revision: https://reviews.freebsd.org/D3335 --- devel/llvm-devel/Makefile | 9 ++++++--- devel/llvm-devel/pkg-plist | 1 + devel/llvm37/Makefile | 9 ++++++--- devel/llvm37/pkg-plist | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/devel/llvm-devel/Makefile b/devel/llvm-devel/Makefile index 3bacf2253949..dc460b1c12df 100644 --- a/devel/llvm-devel/Makefile +++ b/devel/llvm-devel/Makefile @@ -34,9 +34,9 @@ LLD_COMMIT= 754e78c2a7593764867b8671fcd1018433e820f5 LLDB_COMMIT= f89c12e54d5d81c18f4d3f63826d568f6257cabc OPENMP_COMMIT= d90b41fbdaa1036f7a36651449bdcb32813f8423 -OPTIONS_DEFINE= CLANG DOCS LIT LLD LLDB +OPTIONS_DEFINE= CLANG DOCS GOLD LIT LLD LLDB OPTIONS_DEFINE_amd64= OPENMP -OPTIONS_DEFAULT= CLANG LIT LLD LLDB +OPTIONS_DEFAULT= CLANG GOLD LIT LLD LLDB OPTIONS_DEFAULT_amd64= OPENMP OPTIONS_SUB= yes @@ -64,6 +64,9 @@ OPENMP_DESC= Install libomp, the LLVM OpenMP runtime library OPENMP_CONFLICTS_INSTALL= libiomp5-devel-* OPENMP_GH_PROJECT= openmp:openmp OPENMP_GH_TAGNAME= ${OPENMP_COMMIT}:openmp +GOLD_DESC= Build the LLVM Gold plugin for LTO +GOLD_CMAKE_ON= -DLLVM_BINUTILS_INCDIR=${LOCALBASE}/include +GOLD_BUILD_DEPENDS= ld.gold:${PORTSDIR}/devel/binutils OPTIONS_SUB= yes @@ -258,7 +261,7 @@ build-plist: ${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR}/lit${LLVM_SUFFIX} -type f | \ ${SED} -e 's|${STAGEDIR}${PYTHON_SITELIBDIR}|%%LIT%%%%PYTHON_SITELIBDIR%%|' | \ ${SORT} >> ${PLIST}.tmp - awk '{if ($$0 ~ /clang/ && $$0 !~ /omp.h/) {printf "%%%%CLANG%%%%"} if ($$0 ~ /lld/ && $$0 !~ /lldb/) {printf "%%%%LLD%%%%"} if ($$0 ~ /(argdumper|lldb)/) {printf "%%%%LLDB%%%%"} if ($$0 ~ /lib.*omp/) {printf "%%%%OPENMP%%%%"} print}' ${PLIST}.tmp >> ${PLIST} + awk '{if ($$0 ~ /clang/ && $$0 !~ /omp.h/) {printf "%%%%CLANG%%%%"} if ($$0 ~ /lld/ && $$0 !~ /lldb/) {printf "%%%%LLD%%%%"} if ($$0 ~ /(argdumper|lldb)/) {printf "%%%%LLDB%%%%"} if ($$0 ~ /lib.*omp/) {printf "%%%%OPENMP%%%%"} if ($$0 ~ /LLVMgold/) {printf "%%%%GOLD%%%%"} print}' ${PLIST}.tmp >> ${PLIST} ${RM} -f ${PLIST}.tmp check-commands: diff --git a/devel/llvm-devel/pkg-plist b/devel/llvm-devel/pkg-plist index 6890a694e85e..b2803089d646 100644 --- a/devel/llvm-devel/pkg-plist +++ b/devel/llvm-devel/pkg-plist @@ -1773,6 +1773,7 @@ llvm-devel/include/llvm/Transforms/Utils/ValueMapper.h llvm-devel/include/llvm/Transforms/Vectorize.h llvm-devel/lib/BugpointPasses.so llvm-devel/lib/LLVMHello.so +%%GOLD%%llvm-devel/lib/LLVMgold.so %%CLANG%%llvm-devel/lib/clang/3.8.0/include/Intrin.h %%CLANG%%llvm-devel/lib/clang/3.8.0/include/__stddef_max_align_t.h %%CLANG%%llvm-devel/lib/clang/3.8.0/include/__wmmintrin_aes.h diff --git a/devel/llvm37/Makefile b/devel/llvm37/Makefile index ab076e02ca08..c258ab675085 100644 --- a/devel/llvm37/Makefile +++ b/devel/llvm37/Makefile @@ -30,9 +30,9 @@ SUB_LIST= LLVM_PREFIX="${LLVM_PREFIX}" LLVM_SUFFIX="${LLVM_SUFFIX}" CMAKE_INSTALL_PREFIX= ${LLVM_PREFIX} CMAKE_ARGS= -DBUILD_SHARED_LIBS=ON -OPTIONS_DEFINE= CLANG DOCS LIT LLD LLDB +OPTIONS_DEFINE= CLANG DOCS GOLD LIT LLD LLDB OPTIONS_DEFINE_amd64= OPENMP -OPTIONS_DEFAULT= CLANG LIT LLD LLDB +OPTIONS_DEFAULT= CLANG GOLD LIT LLD LLDB OPTIONS_DEFAULT_amd64= OPENMP OPTIONS_SUB= yes @@ -55,6 +55,9 @@ LLDB_BUILD_DEPENDS= swig:${PORTSDIR}/devel/swig13 LLDB_DISTFILES= lldb-${DISTVERSION}.src${EXTRACT_SUFX} OPENMP_DESC= Install libomp, the LLVM OpenMP runtime library OPENMP_DISTFILES= openmp-${DISTVERSION}.src${EXTRACT_SUFX} +GOLD_DESC= Build the LLVM Gold plugin for LTO +GOLD_CMAKE_ON= -DLLVM_BINUTILS_INCDIR=${LOCALBASE}/include +GOLD_BUILD_DEPENDS= ld.gold:${PORTSDIR}/devel/binutils # Emulate USE_GITHUB's ${WRKSRC_tag} to reduce diffs to ../llvm-devel .for option in CLANG LLD LLDB OPENMP @@ -255,7 +258,7 @@ build-plist: ${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR}/lit${LLVM_SUFFIX} -type f | \ ${SED} -e 's|${STAGEDIR}${PYTHON_SITELIBDIR}|%%LIT%%%%PYTHON_SITELIBDIR%%|' | \ ${SORT} >> ${PLIST}.tmp - awk '{if ($$0 ~ /clang/ && $$0 !~ /omp.h/) {printf "%%%%CLANG%%%%"} if ($$0 ~ /lld/ && $$0 !~ /lldb/) {printf "%%%%LLD%%%%"} if ($$0 ~ /(argdumper|lldb)/) {printf "%%%%LLDB%%%%"} if ($$0 ~ /lib.*omp/) {printf "%%%%OPENMP%%%%"} print}' ${PLIST}.tmp >> ${PLIST} + awk '{if ($$0 ~ /clang/ && $$0 !~ /omp.h/) {printf "%%%%CLANG%%%%"} if ($$0 ~ /lld/ && $$0 !~ /lldb/) {printf "%%%%LLD%%%%"} if ($$0 ~ /(argdumper|lldb)/) {printf "%%%%LLDB%%%%"} if ($$0 ~ /lib.*omp/) {printf "%%%%OPENMP%%%%"} if ($$0 ~ /LLVMgold/) {printf "%%%%GOLD%%%%"} print}' ${PLIST}.tmp >> ${PLIST} ${RM} -f ${PLIST}.tmp check-commands: diff --git a/devel/llvm37/pkg-plist b/devel/llvm37/pkg-plist index d145940626f3..d678a2dd4389 100644 --- a/devel/llvm37/pkg-plist +++ b/devel/llvm37/pkg-plist @@ -1774,6 +1774,7 @@ llvm37/include/llvm/Transforms/Utils/ValueMapper.h llvm37/include/llvm/Transforms/Vectorize.h llvm37/lib/BugpointPasses.so llvm37/lib/LLVMHello.so +%%GOLD%%llvm37/lib/LLVMgold.so %%CLANG%%llvm37/lib/clang/3.7.0/include/Intrin.h %%CLANG%%llvm37/lib/clang/3.7.0/include/__stddef_max_align_t.h %%CLANG%%llvm37/lib/clang/3.7.0/include/__wmmintrin_aes.h -- cgit