Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Apr 2016 17:44:55 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r413953 - in head/devel/llvm38: . files
Message-ID:  <201604241744.u3OHitm3099499@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Sun Apr 24 17:44:54 2016
New Revision: 413953
URL: https://svnweb.freebsd.org/changeset/ports/413953

Log:
  Build compiler-rt on i386 and amd64.
  
  It should be possible to enable on other other architectures, but I have no
  way to build the PLIST_FILES variables.
  
  PR:		208900, 208923

Added:
  head/devel/llvm38/files/compiler-rt-patch-svn-261229   (contents, props changed)
Modified:
  head/devel/llvm38/Makefile
  head/devel/llvm38/distinfo
  head/devel/llvm38/pkg-plist

Modified: head/devel/llvm38/Makefile
==============================================================================
--- head/devel/llvm38/Makefile	Sun Apr 24 17:44:33 2016	(r413952)
+++ head/devel/llvm38/Makefile	Sun Apr 24 17:44:54 2016	(r413953)
@@ -2,7 +2,7 @@
 
 PORTNAME=	llvm
 DISTVERSION=	3.8.0
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel lang
 MASTER_SITES=	http://llvm.org/${PRE_}releases/${LLVM_RELEASE}/${RCDIR}
 DISTNAME=	${PORTNAME}-${DISTVERSION}.src
@@ -33,12 +33,15 @@ CMAKE_INSTALL_PREFIX=	${LLVM_PREFIX}
 CMAKE_ARGS=
 
 OPTIONS_DEFINE=	CLANG DOCS EXTRAS GOLD LIT LLD LLDB
-OPTIONS_DEFINE_amd64=	OPENMP
+OPTIONS_DEFINE_amd64=	COMPILER_RT OPENMP
+OPTIONS_DEFINE_i386=	COMPILER_RT
 OPTIONS_DEFAULT=	CLANG EXTRAS GOLD LIT LLD LLDB
-OPTIONS_DEFAULT_amd64=	OPENMP
-OPTIONS_DEFAULT_i386=	
+OPTIONS_DEFAULT_amd64=	COMPILER_RT OPENMP
+OPTIONS_DEFAULT_i386=	COMPILER_RT
 OPTIONS_SUB=	yes
 
+PLIST_FILES=
+
 CLANG_DESC=	Build clang
 CLANG_EXTRA_PATCHES= \
 	${PATCHDIR}/clang-patch-fformat_extensions.diff \
@@ -49,6 +52,9 @@ CLANG_CONFLICTS_INSTALL=	clang-devel-3.[
 CLANG_DISTFILES=	cfe-${DISTVERSION}.src${EXTRACT_SUFX}
 CLANG_CMAKE_ON=		-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp
 CLANG_PORTDOCS=		clang
+COMPILER_RT_DESC=	Sanitizer libraries
+COMPILER_RT_DISTFILES=	compiler-rt-${DISTVERSION}.src${EXTRACT_SUFX}
+COMPILER_RT_PLIST_FILES=${_COMPILER_RT_LIBS:S|^|${_CRTLIBDIR}/|}
 DOCS_PORTDOCS=		llvm
 DOCS_CMAKE_ON=		-DLLVM_ENABLE_SPHINX=ON \
 			-DSPHINX_WARNINGS_AS_ERRORS=OFF \
@@ -70,7 +76,7 @@ GOLD_CMAKE_ON=		-DLLVM_BINUTILS_INCDIR=$
 GOLD_BUILD_DEPENDS=	ld.gold:devel/binutils
 
 # Emulate USE_GITHUB's ${WRKSRC_tag} to reduce diffs to ../llvm-devel
-.for option in CLANG EXTRAS LLD LLDB OPENMP
+.for option in CLANG COMPILER_RT EXTRAS LLD LLDB OPENMP
 WRKSRC_${option:tl}=		${WRKDIR}/${${option}_DISTFILES:S/${EXTRACT_SUFX}//}
 .endfor
 
@@ -187,6 +193,43 @@ NOT_FOR_ARCH=	ia64
 
 .include <bsd.port.pre.mk>
 
+_CRTLIBDIR=    ${LLVM_PREFIX:S|${PREFIX}/||}/lib/freebsd
+.if ${ARCH} == "amd64"
+_COMPILER_RT_LIBS= \
+	libclang_rt.asan-preinit-x86_64.a \
+	libclang_rt.asan-x86_64.a \
+	libclang_rt.asan-x86_64.a.syms \
+	libclang_rt.asan-x86_64.so \
+	libclang_rt.asan_cxx-x86_64.a \
+	libclang_rt.asan_cxx-x86_64.a.syms \
+	libclang_rt.builtins-x86_64.a \
+	libclang_rt.dd-x86_64.a \
+	libclang_rt.dyndd-x86_64.so \
+	libclang_rt.lsan-x86_64.a \
+	libclang_rt.profile-x86_64.a \
+	libclang_rt.safestack-x86_64.a \
+	libclang_rt.tsan-x86_64.a \
+	libclang_rt.tsan-x86_64.a.syms \
+	libclang_rt.tsan_cxx-x86_64.a \
+	libclang_rt.tsan_cxx-x86_64.a.syms \
+	libclang_rt.ubsan_standalone-x86_64.a \
+	libclang_rt.ubsan_standalone-x86_64.a.syms \
+	libclang_rt.ubsan_standalone_cxx-x86_64.a \
+	libclang_rt.ubsan_standalone_cxx-x86_64.a.syms
+.endif
+.if ${ARCH} == "i386" || ${ARCH} == "amd64"
+_COMPILER_RT_LIBS+= \
+	libclang_rt.asan-i386.a \
+	libclang_rt.asan-i386.so \
+	libclang_rt.asan-preinit-i386.a \
+	libclang_rt.asan_cxx-i386.a \
+	libclang_rt.builtins-i386.a \
+	libclang_rt.profile-i386.a \
+	libclang_rt.safestack-i386.a \
+	libclang_rt.ubsan_standalone-i386.a \
+	libclang_rt.ubsan_standalone_cxx-i386.a
+.endif
+
 .if ${OPSYS} != "FreeBSD" || ${COMPILER_TYPE} == clang
 .if ${PORT_OPTIONS:MEXTRAS}
 COMMANDS+=	${EXTRAS_COMMANDS}
@@ -243,6 +286,17 @@ post-patch:
 	    -e 's|lit\.|lit${LLVM_SUFFIX}.|' \
 	    ${WRKSRC}/utils/lit/lit.py ${WRKSRC}/utils/lit/lit/*.py
 
+post-patch-COMPILER_RT-on:
+	cd ${WRKSRC_compiler_rt} && patch < ${PATCHDIR}/compiler-rt-patch-svn-261229
+
+post-build-COMPILER_RT-on:
+	${MKDIR} ${WRKDIR}/compiler-rt-build
+	cd ${WRKDIR}/compiler-rt-build && \
+	${CMAKE_BIN} ${CMAKE_ARGS} \
+	    -DLLVM_CONFIG_PATH=${CONFIGURE_WRKSRC}/bin/llvm-config \
+	    ${WRKSRC_compiler_rt} && \
+	${MAKE_ENV} ${MAKE_CMD}
+
 post-install:
 	${RMDIR} ${STAGEDIR}${LLVM_PREFIX}/include/llvm/MC/MCAnalysis
 	${INSTALL_SCRIPT} ${WRKDIR}/llvm-wrapper.sh \
@@ -284,6 +338,10 @@ post-install-CLANG-on:
 	${INSTALL_PROGRAM} ${WRKDIR}/.build/bin/clang-tblgen \
 	    ${STAGEDIR}${LLVM_PREFIX}/bin/
 
+post-install-COMPILER_RT-on:
+	cd ${WRKDIR}/compiler-rt-build && \
+	${MAKE_ENV} ${MAKE_CMD} ${INSTALL_TARGET}
+
 post-install-LIT-on:
 	${INSTALL_SCRIPT} ${PATCH_WRKSRC}/utils/lit/lit.py \
 	    ${STAGEDIR}${LLVM_PREFIX}/bin/lit
@@ -330,7 +388,9 @@ build-plist:
 	    ${SED} -e 's|${STAGEDIR}${PYTHON_SITELIBDIR}|%%LIT%%%%PYTHON_SITELIBDIR%%|' | \
 	    ${SORT} >> ${PLIST}.tmp
 	awk '{ \
-	    if ($$0 ~ /${CLANG_PATTERN}/ && $$0 !~ /(omp.h|libclang_rt|sanitizer|blacklist.txt|${EXTRAS_PATTERN})/) {printf "%%%%CLANG%%%%"} \
+	    if ($$0 ~ /${CLANG_PATTERN}/ && $$0 !~ /(omp.h|${EXTRAS_PATTERN}|libclang_rt)/) {printf "%%%%CLANG%%%%"} \
+	    if ($$0 ~ /asan_blacklist.txt|sanitizer/) \
+		{printf "%%%%COMPILER_RT%%%%"} \
 	    if ($$0 ~ /(${EXTRAS_PATTERN})/) {printf "%%%%EXTRAS%%%%"} \
 	    if ($$0 ~ /lld/ && $$0 !~ /lldb/) {printf "%%%%LLD%%%%"} \
 	    if ($$0 ~ /(argdumper|lldb|six.py)/) {printf "%%%%LLDB%%%%"} \
@@ -339,6 +399,7 @@ build-plist:
 	    if ($$0 !~ /libclang_rt/) {print}}' ${PLIST}.tmp >> ${PLIST}
 	${RM} -f ${PLIST}.tmp
 
+
 check-commands:
 .for command in ${COMMANDS}
 	test -e ${STAGEDIR}${LLVM_PREFIX}/bin/${command}
@@ -374,8 +435,7 @@ _PATCH_FILE=${FILESDIR}/lldb-patch-svn-$
 _LLVM_BASE=http://llvm.org/svn/llvm-project/lldb/trunk
 svn-patch-lldb:
 	svn log -c ${PATCH_REV} ${_LLVM_BASE} >> ${_PATCH_FILE}
-	svn diff -c ${PATCH_REV} ${_LLVM_BASE} | \
-	    sed -E -e 's;^(---|\+\+\+) ;\1 tools/lldb/;' >> ${_PATCH_FILE}
+	svn diff -c ${PATCH_REV} ${_LLVM_BASE} | >> ${_PATCH_FILE}
 .endif
 
 .include <bsd.port.post.mk>

Modified: head/devel/llvm38/distinfo
==============================================================================
--- head/devel/llvm38/distinfo	Sun Apr 24 17:44:33 2016	(r413952)
+++ head/devel/llvm38/distinfo	Sun Apr 24 17:44:54 2016	(r413953)
@@ -2,6 +2,8 @@ SHA256 (llvm-3.8.0.src.tar.xz) = 555b028
 SIZE (llvm-3.8.0.src.tar.xz) = 16580932
 SHA256 (cfe-3.8.0.src.tar.xz) = 04149236de03cf05232d68eb7cb9c50f03062e339b68f4f8a03b650a11536cf9
 SIZE (cfe-3.8.0.src.tar.xz) = 9627228
+SHA256 (compiler-rt-3.8.0.src.tar.xz) = c8d3387e55f229543dac1941769120f24dc50183150bf19d1b070d53d29d56b0
+SIZE (compiler-rt-3.8.0.src.tar.xz) = 1270128
 SHA256 (clang-tools-extra-3.8.0.src.tar.xz) = afbda810106a6e64444bc164b921be928af46829117c95b996f2678ce4cb1ec4
 SIZE (clang-tools-extra-3.8.0.src.tar.xz) = 334072
 SHA256 (lld-3.8.0.src.tar.xz) = 94704dda228c9f75f4403051085001440b458501ec97192eee06e8e67f7f9f0c

Added: head/devel/llvm38/files/compiler-rt-patch-svn-261229
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/llvm38/files/compiler-rt-patch-svn-261229	Sun Apr 24 17:44:54 2016	(r413953)
@@ -0,0 +1,31 @@
+------------------------------------------------------------------------
+r261229 | emaste | 2016-02-18 17:35:30 +0000 (Thu, 18 Feb 2016) | 10 lines
+
+[tsan] Disable sysroot flag on FreeBSD
+
+FreeBSD does not install a number of Clang-provided headers for the
+compiler in the base system due to incompatibilities between FreeBSD's     
+and Clang's versions. As a workaround do not use --sysroot=. on FreeBSD    
+until this is addressed.
+
+llvm.org/pr26651
+Differential Revision:	http://reviews.llvm.org/D17383
+
+------------------------------------------------------------------------
+Index: lib/tsan/CMakeLists.txt
+===================================================================
+--- lib/tsan/CMakeLists.txt	(revision 261228)
++++ lib/tsan/CMakeLists.txt	(revision 261229)
+@@ -192,7 +192,11 @@
+ add_dependencies(compiler-rt tsan)
+ 
+ # Make sure that non-platform-specific files don't include any system headers.
+-if(COMPILER_RT_HAS_SYSROOT_FLAG)
++# FreeBSD does not install a number of Clang-provided headers for the compiler
++# in the base system due to incompatibilities between FreeBSD's and Clang's
++# versions. As a workaround do not use --sysroot=. on FreeBSD until this is
++# addressed.                                                        
++if(COMPILER_RT_HAS_SYSROOT_FLAG AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+   file(GLOB _tsan_generic_sources rtl/tsan*)
+   file(GLOB _tsan_platform_sources rtl/tsan*posix* rtl/tsan*mac*
+                                    rtl/tsan*linux*)

Modified: head/devel/llvm38/pkg-plist
==============================================================================
--- head/devel/llvm38/pkg-plist	Sun Apr 24 17:44:33 2016	(r413952)
+++ head/devel/llvm38/pkg-plist	Sun Apr 24 17:44:54 2016	(r413953)
@@ -51,6 +51,7 @@ bin/opt38
 %%LIT%%llvm38/bin/llvm-lit
 %%LIT%%bin/FileCheck38
 %%LIT%%llvm38/bin/FileCheck
+%%COMPILER_RT%%llvm38/asan_blacklist.txt
 llvm38/bin/bugpoint
 %%CLANG%%llvm38/bin/c-index-test
 %%CLANG%%llvm38/bin/clang
@@ -1873,6 +1874,15 @@ llvm38/include/llvm/Transforms/Utils/Uni
 llvm38/include/llvm/Transforms/Utils/UnrollLoop.h
 llvm38/include/llvm/Transforms/Utils/ValueMapper.h
 llvm38/include/llvm/Transforms/Vectorize.h
+%%COMPILER_RT%%llvm38/include/sanitizer/allocator_interface.h
+%%COMPILER_RT%%llvm38/include/sanitizer/asan_interface.h
+%%COMPILER_RT%%llvm38/include/sanitizer/common_interface_defs.h
+%%COMPILER_RT%%llvm38/include/sanitizer/coverage_interface.h
+%%COMPILER_RT%%llvm38/include/sanitizer/dfsan_interface.h
+%%COMPILER_RT%%llvm38/include/sanitizer/linux_syscall_hooks.h
+%%COMPILER_RT%%llvm38/include/sanitizer/lsan_interface.h
+%%COMPILER_RT%%llvm38/include/sanitizer/msan_interface.h
+%%COMPILER_RT%%llvm38/include/sanitizer/tsan_interface_atomic.h
 llvm38/lib/BugpointPasses.so
 llvm38/lib/LLVMHello.so
 %%GOLD%%llvm38/lib/LLVMgold.so



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