Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Oct 2018 18:49:04 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r483602 - in branches/2018Q4/devel: llvm-devel llvm-devel/files llvm60 llvm60/files llvm60/files/clang llvm60/files/lld llvm60/files/lldb
Message-ID:  <201810311849.w9VIn4Ze070363@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim (src committer)
Date: Wed Oct 31 18:49:04 2018
New Revision: 483602
URL: https://svnweb.freebsd.org/changeset/ports/483602

Log:
  MFH: r481120
  
  Update to a new snapshot.
  
  Update LICENSE data per mailing list feedback and move to a seperate
  Makefile.LICENSE for use by other llvm ports.
  
  MFH: r483054
  
  Add all patches from base llvm/clang/lld/lldb 6.0 to devel/llvm60
  
  This adds all the patches that were applied in the past to head, under
  contrib/llvm.  After these, there only minimal diffs left between the
  port sources and the base sources.
  
  Most of these remaining diffs are due to #ifdef shortcuts in the base
  sources, because we don't compile certain features in.  Other diffs are
  because the port has applied a few changes that we don't have in base.
  
  While here, use Makefile.LICENSE from the devel/llvm-devel port.
  
  Approved by:	portmgr (miwi)
  Reviewed by:	brooks
  PR:		212343, 225128, 225471, 226388, 226658, 226872, 229050, 230444, 230604, 231355
  Differential Revision: https://reviews.freebsd.org/D17702

Added:
  branches/2018Q4/devel/llvm-devel/Makefile.LICENSE
     - copied unchanged from r481120, head/devel/llvm-devel/Makefile.LICENSE
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r331066.diff
     - copied unchanged from r483054, head/devel/llvm60/files/clang/patch-head-r331066.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r336227.diff
     - copied unchanged from r483054, head/devel/llvm60/files/clang/patch-head-r336227.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r338697.diff
     - copied unchanged from r483054, head/devel/llvm60/files/clang/patch-head-r338697.diff
  branches/2018Q4/devel/llvm60/files/clang/patch-head-r339019.diff
     - copied unchanged from r483054, head/devel/llvm60/files/clang/patch-head-r339019.diff
  branches/2018Q4/devel/llvm60/files/lld/
     - copied from r483054, head/devel/llvm60/files/lld/
  branches/2018Q4/devel/llvm60/files/lldb/
     - copied from r483054, head/devel/llvm60/files/lldb/
  branches/2018Q4/devel/llvm60/files/patch-head-r308867.diff
     - copied unchanged from r483054, head/devel/llvm60/files/patch-head-r308867.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r330686.diff
     - copied unchanged from r483054, head/devel/llvm60/files/patch-head-r330686.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r331065.diff
     - copied unchanged from r483054, head/devel/llvm60/files/patch-head-r331065.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r331366.diff
     - copied unchanged from r483054, head/devel/llvm60/files/patch-head-r331366.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r336969.diff
     - copied unchanged from r483054, head/devel/llvm60/files/patch-head-r336969.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r336970.diff
     - copied unchanged from r483054, head/devel/llvm60/files/patch-head-r336970.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r337615.diff
     - copied unchanged from r483054, head/devel/llvm60/files/patch-head-r337615.diff
  branches/2018Q4/devel/llvm60/files/patch-head-r338689.diff
     - copied unchanged from r483054, head/devel/llvm60/files/patch-head-r338689.diff
Deleted:
  branches/2018Q4/devel/llvm-devel/files/lldb-patch-tools_lldb_source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp
Modified:
  branches/2018Q4/devel/llvm-devel/Makefile
  branches/2018Q4/devel/llvm-devel/Makefile.snapshot
  branches/2018Q4/devel/llvm-devel/distinfo
  branches/2018Q4/devel/llvm-devel/pkg-plist
  branches/2018Q4/devel/llvm60/Makefile
Directory Properties:
  branches/2018Q4/   (props changed)

Modified: branches/2018Q4/devel/llvm-devel/Makefile
==============================================================================
--- branches/2018Q4/devel/llvm-devel/Makefile	Wed Oct 31 17:50:27 2018	(r483601)
+++ branches/2018Q4/devel/llvm-devel/Makefile	Wed Oct 31 18:49:04 2018	(r483602)
@@ -10,23 +10,7 @@ PKGNAMESUFFIX=	-devel
 MAINTAINER=	brooks@FreeBSD.org
 COMMENT=	LLVM and Clang
 
-# License are listed in the order they appear in LICENSE.TXT
-LICENSE=	LLVM GTEST REGEX MIT ARM PD
-LICENSE_COMB=	multi
-LICENSE_NAME_LLVM=	LLVM Release License
-LICENSE_PERMS_LLVM=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
-LICENSE_FILE_LLVM=	${WRKSRC}/LICENSE.TXT
-LICENSE_NAME_GTEST=	Google test license
-LICENSE_PERMS_GTEST=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
-LICENSE_FILE_GTEST=	${WRKSRC}/utils/unittest/googletest/LICENSE.TXT
-LICENSE_NAME_REGEX=	OpenBSD Regex License
-LICENSE_PERMS_REGEX=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
-LICENSE_FILE_REGEX=	${WRKSRC}/lib/Support/COPYRIGHT.regex
-# pyyaml tests are under the MIT license
-LICENSE_NAME_ARM=	ARM Limited license
-LICENSE_PERMS_ARM=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
-LICENSE_FILE_ARM=	${WRKSRC}/lib/Target/ARM/LICENSE.TXT
-# md5 is in the public domain
+.include "Makefile.LICENSE"
 
 LLVM_SUFFIX=	-devel
 LLVM_PREFIX=	${PREFIX}/llvm${LLVM_SUFFIX}
@@ -118,7 +102,6 @@ LLD_GH_SUBDIR=		tools/lld:lld
 LLD_GH_TAGNAME=		${LLD_COMMIT}:lld
 LLDB_BUILD_DEPENDS=	swig3.0:devel/swig30
 LLDB_DESC=		Install lldb, the LLVM debugger
-LLDB_EXTRA_PATCHES=	${PATCHDIR}/lldb-patch-tools_lldb_source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp
 LLDB_GH_PROJECT=	lldb:lldb
 LLDB_GH_SUBDIR=		tools/lldb:lldb
 LLDB_GH_TAGNAME=	${LLDB_COMMIT}:lldb
@@ -285,6 +268,7 @@ MAN1SRCS+=	clang.1 \
 		diagtool.1 \
 		scan-build.1
 CLANG_PATTERN=	(c-index-test|clang|scan-|Reporter.py|ScanView.py|scanview.css|sorttable.js|startfile.py|-analyzer)
+USES+=	gnome
 .endif
 
 .if ${PORT_OPTIONS:MCOMPILER_RT}
@@ -350,6 +334,8 @@ _COMPILER_RT_LIBS= \
 	libclang_rt.asan_cxx-x86_64.a \
 	libclang_rt.asan_cxx-x86_64.a.syms \
 	libclang_rt.builtins-x86_64.a \
+	libclang_rt.cfi-x86_64.a \
+	libclang_rt.cfi_diag-x86_64.a \
 	libclang_rt.dd-x86_64.a \
 	libclang_rt.dyndd-x86_64.so \
 	libclang_rt.fuzzer-x86_64.a \

Copied: branches/2018Q4/devel/llvm-devel/Makefile.LICENSE (from r481120, head/devel/llvm-devel/Makefile.LICENSE)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q4/devel/llvm-devel/Makefile.LICENSE	Wed Oct 31 18:49:04 2018	(r483602, copy of r481120, head/devel/llvm-devel/Makefile.LICENSE)
@@ -0,0 +1,29 @@
+# $FreeBSD$
+#
+# The "LLVM Release License" is largely a copy of the NCSA license, but
+# it contains extra verbiage about its interaction with third party
+# licenses so it is handled as a seperate license.
+#
+# Third party software licenses in the LLVM tree include:
+# Program             License
+# -------             -------
+# Google Test         BSD3CLAUSE
+# OpenBSD regex       REGEX
+# pyyaml tests        MIT
+# ARM contributions   ARM
+# md5 contributions   PD
+
+LICENSE=	ARM BSD3CLAUSE LLVM MIT PD REGEX
+LICENSE_COMB=	multi
+
+LICENSE_FILE_ARM=	${WRKSRC}/lib/Target/ARM/LICENSE.TXT
+LICENSE_FILE_BSD3CLAUSE=	${WRKSRC}/utils/unittest/googletest/LICENSE.TXT
+LICENSE_FILE_LLVM=	${WRKSRC}/LICENSE.TXT
+LICENSE_FILE_MIT=	${WRKSRC}/test/YAMLParser/LICENSE.txt
+LICENSE_FILE_REGEX=	${WRKSRC}/lib/Support/COPYRIGHT.regex
+LICENSE_NAME_ARM=	ARM Limited license
+LICENSE_NAME_LLVM=	LLVM Release License
+LICENSE_NAME_REGEX=	OpenBSD Regex License
+LICENSE_PERMS_ARM=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
+LICENSE_PERMS_LLVM=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
+LICENSE_PERMS_REGEX=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

Modified: branches/2018Q4/devel/llvm-devel/Makefile.snapshot
==============================================================================
--- branches/2018Q4/devel/llvm-devel/Makefile.snapshot	Wed Oct 31 17:50:27 2018	(r483601)
+++ branches/2018Q4/devel/llvm-devel/Makefile.snapshot	Wed Oct 31 18:49:04 2018	(r483602)
@@ -6,12 +6,12 @@
 #
 LLVM_MAJOR=	8
 LLVM_RELEASE=	${LLVM_MAJOR}.0.0
-SNAPDATE=	20180925
+SNAPDATE=	20181001
 
-LLVM_COMMIT=		b418c2351b1fdf6faf6a2d010d804e895ef49932
-CLANG_COMMIT=		d6cae43ad5a45c099fa3917def61170a9fdf6c97
-COMPILER_RT_COMMIT=	c5cf78381530dda36a14ef2eef0d94f8c87ae674
-EXTRAS_COMMIT=		0eddbe908913429e4f69b4a877f9c0ca28e08382
-LLD_COMMIT=		bc9e188d140ff03d5851a6bebe76e486d389d856
-LLDB_COMMIT=		12046a6124750689bba1c3eb881e366be4030a77
-OPENMP_COMMIT=		e1688b470b8ef3441983d333a6642e7b19d29b90
+LLVM_COMMIT=		5877e4ed63ba21fb57f2c7fb4ed4950288e2a28c
+CLANG_COMMIT=		a866fe7bf7c577b698229106f0ddc2d31b285de8
+COMPILER_RT_COMMIT=	87620816074a8059648940d59dd0a37d30089a0a
+EXTRAS_COMMIT=		35eb918a95a05e7d91bc7cf026f19db869354eaa
+LLD_COMMIT=		df3e3050ef26292a8c7d2d16b073588eba28db6c
+LLDB_COMMIT=		b062a1225880b697f79ca92afb986e2b59be65c8
+OPENMP_COMMIT=		be73d23db2027fdb14e4cfa3b35fc17fd50558a3

Modified: branches/2018Q4/devel/llvm-devel/distinfo
==============================================================================
--- branches/2018Q4/devel/llvm-devel/distinfo	Wed Oct 31 17:50:27 2018	(r483601)
+++ branches/2018Q4/devel/llvm-devel/distinfo	Wed Oct 31 18:49:04 2018	(r483602)
@@ -1,15 +1,15 @@
-TIMESTAMP = 1537891825
-SHA256 (llvm-mirror-llvm-8.0.d20180925-b418c2351b1fdf6faf6a2d010d804e895ef49932_GH0.tar.gz) = f70fea382b3058b06416925f3a796f72e0b1bdc72f5a68283daadbb68b851c50
-SIZE (llvm-mirror-llvm-8.0.d20180925-b418c2351b1fdf6faf6a2d010d804e895ef49932_GH0.tar.gz) = 43610028
-SHA256 (llvm-mirror-clang-d6cae43ad5a45c099fa3917def61170a9fdf6c97_GH0.tar.gz) = 9f4bec9fe0f739a19f88ae2ae2414d6f8bde13c6ee9ce495db77475ed5d41de8
-SIZE (llvm-mirror-clang-d6cae43ad5a45c099fa3917def61170a9fdf6c97_GH0.tar.gz) = 17743175
-SHA256 (llvm-mirror-compiler-rt-c5cf78381530dda36a14ef2eef0d94f8c87ae674_GH0.tar.gz) = b5537492aa4fef086c8782db33d17fbfcca110900626c2f40a3baa0643fd698d
-SIZE (llvm-mirror-compiler-rt-c5cf78381530dda36a14ef2eef0d94f8c87ae674_GH0.tar.gz) = 3169979
-SHA256 (llvm-mirror-clang-tools-extra-0eddbe908913429e4f69b4a877f9c0ca28e08382_GH0.tar.gz) = ba1fd5634240facd766958a83642aa4563a210cb83ed8b470cad50a21c66d4ed
-SIZE (llvm-mirror-clang-tools-extra-0eddbe908913429e4f69b4a877f9c0ca28e08382_GH0.tar.gz) = 1284915
-SHA256 (llvm-mirror-lld-bc9e188d140ff03d5851a6bebe76e486d389d856_GH0.tar.gz) = dc0bec0ee38e45fff568d1a096c791a435ce5aaaad5049cd108fd8073d5cb326
-SIZE (llvm-mirror-lld-bc9e188d140ff03d5851a6bebe76e486d389d856_GH0.tar.gz) = 1311086
-SHA256 (llvm-mirror-lldb-12046a6124750689bba1c3eb881e366be4030a77_GH0.tar.gz) = 809923ab8aef405c1529b40a7f37eb8506a328cca305f56e858474156a912173
-SIZE (llvm-mirror-lldb-12046a6124750689bba1c3eb881e366be4030a77_GH0.tar.gz) = 24534585
-SHA256 (llvm-mirror-openmp-e1688b470b8ef3441983d333a6642e7b19d29b90_GH0.tar.gz) = 434e57ba3cf4c6aef50905f66529595c2f45742155b8403631cfd59084454efa
-SIZE (llvm-mirror-openmp-e1688b470b8ef3441983d333a6642e7b19d29b90_GH0.tar.gz) = 1446924
+TIMESTAMP = 1538434534
+SHA256 (llvm-mirror-llvm-8.0.d20181001-5877e4ed63ba21fb57f2c7fb4ed4950288e2a28c_GH0.tar.gz) = d0c117be40576264eb8efd34640b5dbb607bec8781155c0e97a9b5aec9d943fb
+SIZE (llvm-mirror-llvm-8.0.d20181001-5877e4ed63ba21fb57f2c7fb4ed4950288e2a28c_GH0.tar.gz) = 43693701
+SHA256 (llvm-mirror-clang-a866fe7bf7c577b698229106f0ddc2d31b285de8_GH0.tar.gz) = 07493d309ce4cd8410d8d14da97c7f911e23bb7b1de85f65d23584d59a615e0d
+SIZE (llvm-mirror-clang-a866fe7bf7c577b698229106f0ddc2d31b285de8_GH0.tar.gz) = 17763531
+SHA256 (llvm-mirror-compiler-rt-87620816074a8059648940d59dd0a37d30089a0a_GH0.tar.gz) = 445f052008b38252ef856a5ea343fddc21eb919b6cfc927c9253662ef7071a24
+SIZE (llvm-mirror-compiler-rt-87620816074a8059648940d59dd0a37d30089a0a_GH0.tar.gz) = 3178030
+SHA256 (llvm-mirror-clang-tools-extra-35eb918a95a05e7d91bc7cf026f19db869354eaa_GH0.tar.gz) = 15d2ac8d0e8e1c7d3f71364a4a61be01cc36c9956fe98878f5fb5365899d6686
+SIZE (llvm-mirror-clang-tools-extra-35eb918a95a05e7d91bc7cf026f19db869354eaa_GH0.tar.gz) = 1290314
+SHA256 (llvm-mirror-lld-df3e3050ef26292a8c7d2d16b073588eba28db6c_GH0.tar.gz) = b7431fd2ce11a88b06f4b456cffac1cb747bea075a47480c706edcd6b59d189d
+SIZE (llvm-mirror-lld-df3e3050ef26292a8c7d2d16b073588eba28db6c_GH0.tar.gz) = 1314749
+SHA256 (llvm-mirror-lldb-b062a1225880b697f79ca92afb986e2b59be65c8_GH0.tar.gz) = 27dfab3fe813b169295f5d9b6207750ae378bade4db152abd30487e71942b96d
+SIZE (llvm-mirror-lldb-b062a1225880b697f79ca92afb986e2b59be65c8_GH0.tar.gz) = 24541049
+SHA256 (llvm-mirror-openmp-be73d23db2027fdb14e4cfa3b35fc17fd50558a3_GH0.tar.gz) = 63c4c05f9aad0178b91e1617ef5d7619d1dae7c19a5432a974248496aab49d51
+SIZE (llvm-mirror-openmp-be73d23db2027fdb14e4cfa3b35fc17fd50558a3_GH0.tar.gz) = 1453322

Modified: branches/2018Q4/devel/llvm-devel/pkg-plist
==============================================================================
--- branches/2018Q4/devel/llvm-devel/pkg-plist	Wed Oct 31 17:50:27 2018	(r483601)
+++ branches/2018Q4/devel/llvm-devel/pkg-plist	Wed Oct 31 18:49:04 2018	(r483602)
@@ -1812,17 +1812,21 @@ llvm-devel/include/llvm/DebugInfo/PDB/Native/InfoStrea
 llvm-devel/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NamedStreamMap.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h
+llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeEnumModules.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeEnumTypes.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeSession.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h
+llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeTypeArray.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h
+llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeTypeUDT.h
+llvm-devel/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/PDBFile.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h
 llvm-devel/include/llvm/DebugInfo/PDB/Native/PDBStringTable.h
@@ -1898,10 +1902,12 @@ llvm-devel/include/llvm/ExecutionEngine/Orc/GlobalMapp
 llvm-devel/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h
 llvm-devel/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h
 llvm-devel/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
+llvm-devel/include/llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h
 llvm-devel/include/llvm/ExecutionEngine/Orc/LLJIT.h
 llvm-devel/include/llvm/ExecutionEngine/Orc/LambdaResolver.h
 llvm-devel/include/llvm/ExecutionEngine/Orc/Layer.h
 llvm-devel/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
+llvm-devel/include/llvm/ExecutionEngine/Orc/LazyReexports.h
 llvm-devel/include/llvm/ExecutionEngine/Orc/Legacy.h
 llvm-devel/include/llvm/ExecutionEngine/Orc/NullResolver.h
 llvm-devel/include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h
@@ -1916,6 +1922,7 @@ llvm-devel/include/llvm/ExecutionEngine/Orc/RTDyldObje
 llvm-devel/include/llvm/ExecutionEngine/Orc/RawByteChannel.h
 llvm-devel/include/llvm/ExecutionEngine/Orc/RemoteObjectLayer.h
 llvm-devel/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h
+llvm-devel/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h
 llvm-devel/include/llvm/ExecutionEngine/OrcMCJITReplacement.h
 llvm-devel/include/llvm/ExecutionEngine/RTDyldMemoryManager.h
 llvm-devel/include/llvm/ExecutionEngine/RuntimeDyld.h
@@ -2266,6 +2273,7 @@ llvm-devel/include/llvm/Support/Locale.h
 llvm-devel/include/llvm/Support/LockFileManager.h
 llvm-devel/include/llvm/Support/LowLevelTypeImpl.h
 llvm-devel/include/llvm/Support/MD5.h
+llvm-devel/include/llvm/Support/MSVCErrorWorkarounds.h
 llvm-devel/include/llvm/Support/MachineValueType.h
 llvm-devel/include/llvm/Support/ManagedStatic.h
 llvm-devel/include/llvm/Support/MathExtras.h

Modified: branches/2018Q4/devel/llvm60/Makefile
==============================================================================
--- branches/2018Q4/devel/llvm60/Makefile	Wed Oct 31 17:50:27 2018	(r483601)
+++ branches/2018Q4/devel/llvm60/Makefile	Wed Oct 31 18:49:04 2018	(r483602)
@@ -2,7 +2,7 @@
 
 PORTNAME=	llvm
 DISTVERSION=	6.0.1
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	devel lang
 MASTER_SITES=	http://${PRE_}releases.llvm.org/${LLVM_RELEASE}/${RCDIR}
 PKGNAMESUFFIX=	${LLVM_SUFFIX}
@@ -12,10 +12,7 @@ DISTFILES=	${PORTNAME}-${DISTVERSION}.src${EXTRACT_SUF
 MAINTAINER=	brooks@FreeBSD.org
 COMMENT=	LLVM and Clang
 
-LICENSE=	LLVM
-LICENSE_NAME=	LLVM Release License
-LICENSE_FILE=	${WRKSRC}/LICENSE.TXT
-LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
+.include "${.CURDIR}/../llvm-devel/Makefile.LICENSE"
 
 LLVM_RELEASE=	${DISTVERSION:C/rc.*//}
 LLVM_MAJOR=	${LLVM_RELEASE:C/\.[0-9]$//}
@@ -84,10 +81,12 @@ LIT_DESC=		Install lit and FileCheck test tools
 LIT_VARS=		_USES_PYTHON=python:2.7
 LLD_DESC=		Install lld, the LLVM linker
 LLD_DISTFILES=		lld-${DISTVERSION}.src${EXTRACT_SUFX}
+LLD_EXTRA_PATCHES=	${PATCHDIR}/lld
 LLDB_BUILD_DEPENDS=	swig3.0:devel/swig30 \
 			${PY_ENUM34}
 LLDB_DESC=		Install lldb, the LLVM debugger
 LLDB_DISTFILES=		lldb-${DISTVERSION}.src${EXTRACT_SUFX}
+LLDB_EXTRA_PATCHES=	${PATCHDIR}/lldb
 LLDB_IMPLIES=		CLANG
 LLDB_VARS=		_USES_PYTHON=python:2.7
 OPENMP_DESC=		Install libomp, the LLVM OpenMP runtime library
@@ -228,6 +227,7 @@ CLANG_PATTERN=	(c-index-test|clang|scan-|Reporter.py|S
 SHEBANG_FILES+=	tools/clang/tools/scan-view/bin/scan-view \
 		tools/clang/tools/clang-format/git-clang-format \
 		tools/clang/tools/clang-format/clang-format-diff.py
+USES+=         gnome
 .endif
 
 .if ${PORT_OPTIONS:MCOMPILER_RT}

Copied: branches/2018Q4/devel/llvm60/files/clang/patch-head-r331066.diff (from r483054, head/devel/llvm60/files/clang/patch-head-r331066.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q4/devel/llvm60/files/clang/patch-head-r331066.diff	Wed Oct 31 18:49:04 2018	(r483602, copy of r483054, head/devel/llvm60/files/clang/patch-head-r331066.diff)
@@ -0,0 +1,40 @@
+r331066 | dim | 2018-03-16 19:04:13 +0100 (Fri, 16 Mar 2018) | 19 lines
+
+Pull in r321999 from upstream clang trunk (by Ivan A. Kosarev):
+
+  [CodeGen] Fix TBAA info for accesses to members of base classes
+
+  Resolves:
+  Bug 35724 - regression (r315984): fatal error: error in backend:
+  Broken function found (Did not see access type in access path!)
+  https://bugs.llvm.org/show_bug.cgi?id=35724
+
+  Differential Revision: https://reviews.llvm.org/D41547
+
+This fixes "Did not see access type in access path" fatal errors when
+building the devel/gdb port (version 8.1).
+
+Reported by:	jbeich
+PR:		226658
+MFC after:	3 months
+X-MFC-With:	r327952
+
+Index: tools/clang/lib/CodeGen/CGExpr.cpp
+===================================================================
+--- tools/clang/lib/CodeGen/CGExpr.cpp	(revision 331065)
++++ tools/clang/lib/CodeGen/CGExpr.cpp	(revision 331066)
+@@ -1034,8 +1034,12 @@ Address CodeGenFunction::EmitPointerWithAlignment(
+     // Derived-to-base conversions.
+     case CK_UncheckedDerivedToBase:
+     case CK_DerivedToBase: {
+-      Address Addr = EmitPointerWithAlignment(CE->getSubExpr(), BaseInfo,
+-                                              TBAAInfo);
++      // TODO: Support accesses to members of base classes in TBAA. For now, we
++      // conservatively pretend that the complete object is of the base class
++      // type.
++      if (TBAAInfo)
++        *TBAAInfo = CGM.getTBAAAccessInfo(E->getType());
++      Address Addr = EmitPointerWithAlignment(CE->getSubExpr(), BaseInfo);
+       auto Derived = CE->getSubExpr()->getType()->getPointeeCXXRecordDecl();
+       return GetAddressOfBaseClass(Addr, Derived,
+                                    CE->path_begin(), CE->path_end(),

Copied: branches/2018Q4/devel/llvm60/files/clang/patch-head-r336227.diff (from r483054, head/devel/llvm60/files/clang/patch-head-r336227.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q4/devel/llvm60/files/clang/patch-head-r336227.diff	Wed Oct 31 18:49:04 2018	(r483602, copy of r483054, head/devel/llvm60/files/clang/patch-head-r336227.diff)
@@ -0,0 +1,42 @@
+r336227 | dim | 2018-07-12 21:02:59 +0200 (Thu, 12 Jul 2018) | 27 lines
+
+Pull in r336008 from upstream clang trunk:
+
+  Request init/fini array on FreeBSD 12 and later
+
+  Summary:
+
+  It seems a bad idea to change the default in the middle of a release
+  branch due to possible changes in global ctor / dtor ordering between
+  .ctors and .init_array. With FreeBSD 11.0's release imminent lets
+  change the default now for FreeBSD 12 (the current development
+  stream) and later.
+
+  FreeBSD rtld has supported .init_array / .fini_array for many years.
+  As of Jan 1 2017 all supported FreeBSD releases and branches will
+  have support.
+
+  Reviewers: dim, brooks, arichardson
+
+  Reviewed By: dim, brooks, arichardson
+
+  Subscribers: bsdjhb, krytarowski, emaste, cfe-commits
+
+  Differential Revision: https://reviews.llvm.org/D24867
+
+Requested by:	jhb
+MFC after:	3 days
+
+Index: tools/clang/lib/Driver/ToolChains/Gnu.cpp
+===================================================================
+--- tools/clang/lib/Driver/ToolChains/Gnu.cpp	(revision 336226)
++++ tools/clang/lib/Driver/ToolChains/Gnu.cpp	(revision 336227)
+@@ -2375,6 +2375,8 @@ void Generic_ELF::addClangTargetOptions(const ArgL
+   bool UseInitArrayDefault =
+       getTriple().getArch() == llvm::Triple::aarch64 ||
+       getTriple().getArch() == llvm::Triple::aarch64_be ||
++      (getTriple().getOS() == llvm::Triple::FreeBSD &&
++       getTriple().getOSMajorVersion() >= 12) ||
+       (getTriple().getOS() == llvm::Triple::Linux &&
+        ((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) ||
+         getTriple().isAndroid())) ||

Copied: branches/2018Q4/devel/llvm60/files/clang/patch-head-r338697.diff (from r483054, head/devel/llvm60/files/clang/patch-head-r338697.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q4/devel/llvm60/files/clang/patch-head-r338697.diff	Wed Oct 31 18:49:04 2018	(r483602, copy of r483054, head/devel/llvm60/files/clang/patch-head-r338697.diff)
@@ -0,0 +1,104 @@
+r338697 | dim | 2018-09-15 23:22:50 +0200 (Sat, 15 Sep 2018) | 21 lines
+
+Pull in r325478 from upstream clang trunk (by Ivan A. Kosarev):
+
+  [CodeGen] Initialize large arrays by copying from a global
+
+  Currently, clang compiles explicit initializers for array elements
+  into series of store instructions. For large arrays of built-in types
+  this results in bloated output code and significant amount of time
+  spent on the instruction selection phase. This patch fixes the issue
+  by initializing such arrays with global constants that store the
+  binary image of the initializer.
+
+  Differential Revision: https://reviews.llvm.org/D43181
+
+This should fix a compiler hang (and excessive memory usage) while
+building the science/rmg port.
+
+Approved by:	re (kib)
+Reported by:	yuri@tsoft.com
+See also:	https://bugs.llvm.org/show_bug.cgi?id=38798
+MFC after:	3 days
+
+Index: tools/clang/lib/CodeGen/CGExprAgg.cpp
+===================================================================
+--- tools/clang/lib/CodeGen/CGExprAgg.cpp	(revision 338696)
++++ tools/clang/lib/CodeGen/CGExprAgg.cpp	(revision 338697)
+@@ -14,6 +14,7 @@
+ #include "CodeGenFunction.h"
+ #include "CGObjCRuntime.h"
+ #include "CodeGenModule.h"
++#include "ConstantEmitter.h"
+ #include "clang/AST/ASTContext.h"
+ #include "clang/AST/DeclCXX.h"
+ #include "clang/AST/DeclTemplate.h"
+@@ -85,7 +86,7 @@ class AggExprEmitter : public StmtVisitor<AggExprE
+   void EmitMoveFromReturnSlot(const Expr *E, RValue Src);
+ 
+   void EmitArrayInit(Address DestPtr, llvm::ArrayType *AType,
+-                     QualType elementType, InitListExpr *E);
++                     QualType ArrayQTy, InitListExpr *E);
+ 
+   AggValueSlot::NeedsGCBarriers_t needsGC(QualType T) {
+     if (CGF.getLangOpts().getGC() && TypeRequiresGCollection(T))
+@@ -392,12 +393,15 @@ static bool isTrivialFiller(Expr *E) {
+ 
+ /// \brief Emit initialization of an array from an initializer list.
+ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType,
+-                                   QualType elementType, InitListExpr *E) {
++                                   QualType ArrayQTy, InitListExpr *E) {
+   uint64_t NumInitElements = E->getNumInits();
+ 
+   uint64_t NumArrayElements = AType->getNumElements();
+   assert(NumInitElements <= NumArrayElements);
+ 
++  QualType elementType =
++      CGF.getContext().getAsArrayType(ArrayQTy)->getElementType();
++
+   // DestPtr is an array*.  Construct an elementType* by drilling
+   // down a level.
+   llvm::Value *zero = llvm::ConstantInt::get(CGF.SizeTy, 0);
+@@ -409,6 +413,29 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr
+   CharUnits elementAlign =
+     DestPtr.getAlignment().alignmentOfArrayElement(elementSize);
+ 
++  // Consider initializing the array by copying from a global. For this to be
++  // more efficient than per-element initialization, the size of the elements
++  // with explicit initializers should be large enough.
++  if (NumInitElements * elementSize.getQuantity() > 16 &&
++      elementType.isTriviallyCopyableType(CGF.getContext())) {
++    CodeGen::CodeGenModule &CGM = CGF.CGM;
++    ConstantEmitter Emitter(CGM);
++    LangAS AS = ArrayQTy.getAddressSpace();
++    if (llvm::Constant *C = Emitter.tryEmitForInitializer(E, AS, ArrayQTy)) {
++      auto GV = new llvm::GlobalVariable(
++          CGM.getModule(), C->getType(),
++          CGM.isTypeConstant(ArrayQTy, /* ExcludeCtorDtor= */ true),
++          llvm::GlobalValue::PrivateLinkage, C, "constinit",
++          /* InsertBefore= */ nullptr, llvm::GlobalVariable::NotThreadLocal,
++          CGM.getContext().getTargetAddressSpace(AS));
++      Emitter.finalize(GV);
++      CharUnits Align = CGM.getContext().getTypeAlignInChars(ArrayQTy);
++      GV->setAlignment(Align.getQuantity());
++      EmitFinalDestCopy(ArrayQTy, CGF.MakeAddrLValue(GV, ArrayQTy, Align));
++      return;
++    }
++  }
++
+   // Exception safety requires us to destroy all the
+   // already-constructed members if an initializer throws.
+   // For that, we'll need an EH cleanup.
+@@ -1156,11 +1183,8 @@ void AggExprEmitter::VisitInitListExpr(InitListExp
+ 
+   // Handle initialization of an array.
+   if (E->getType()->isArrayType()) {
+-    QualType elementType =
+-        CGF.getContext().getAsArrayType(E->getType())->getElementType();
+-
+     auto AType = cast<llvm::ArrayType>(Dest.getAddress().getElementType());
+-    EmitArrayInit(Dest.getAddress(), AType, elementType, E);
++    EmitArrayInit(Dest.getAddress(), AType, E->getType(), E);
+     return;
+   }
+ 

Copied: branches/2018Q4/devel/llvm60/files/clang/patch-head-r339019.diff (from r483054, head/devel/llvm60/files/clang/patch-head-r339019.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q4/devel/llvm60/files/clang/patch-head-r339019.diff	Wed Oct 31 18:49:04 2018	(r483602, copy of r483054, head/devel/llvm60/files/clang/patch-head-r339019.diff)
@@ -0,0 +1,30 @@
+r339019 | emaste | 2018-09-29 22:01:23 +0200 (Sat, 29 Sep 2018) | 15 lines
+
+clang: allow ifunc resolvers to accept arguments
+
+Previously Clang required ifunc resolution functions to take no
+arguments, presumably because GCC documented ifunc resolvers as taking
+no arguments.  However, GCC accepts resolvers accepting arguments, and
+our rtld passes CPU ID information (cpuid, hwcap, etc.) to ifunc
+resolvers.  Just remove the check from the in-tree compiler for our in-
+tree compiler; a different (per-OS) approach may be required upstream.
+
+Reported by:	mjg
+Approved by:	re (rgrimes)
+MFC after:	1 week
+Relnotes:	Yes
+Sponsored by:	The FreeBSD Foundation
+
+Index: tools/clang/lib/CodeGen/CodeGenModule.cpp
+===================================================================
+--- tools/clang/lib/CodeGen/CodeGenModule.cpp	(revision 339018)
++++ tools/clang/lib/CodeGen/CodeGenModule.cpp	(revision 339019)
+@@ -321,8 +321,6 @@ void CodeGenModule::checkAliases() {
+       assert(FTy);
+       if (!FTy->getReturnType()->isPointerTy())
+         Diags.Report(Location, diag::err_ifunc_resolver_return);
+-      if (FTy->getNumParams())
+-        Diags.Report(Location, diag::err_ifunc_resolver_params);
+     }
+ 
+     llvm::Constant *Aliasee = Alias->getIndirectSymbol();

Copied: branches/2018Q4/devel/llvm60/files/patch-head-r308867.diff (from r483054, head/devel/llvm60/files/patch-head-r308867.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q4/devel/llvm60/files/patch-head-r308867.diff	Wed Oct 31 18:49:04 2018	(r483602, copy of r483054, head/devel/llvm60/files/patch-head-r308867.diff)
@@ -0,0 +1,33 @@
+r308867 | dim | 2016-11-19 22:05:17 +0100 (Sat, 19 Nov 2016) | 15 lines
+
+Work around LLVM PR30879, which is about a bad interaction between X86
+Call Frame Optimization on i386 and libunwind, by disallowing the
+optimization for i386-freebsd12.
+
+This should fix some instances of broken exception handling when frame
+pointers are omitted, in particular some unittests run during the build
+of editors/libreoffice.
+
+This hack will be removed as soon as upstream has implemented a more
+permanent fix for this problem.
+
+Upstream PR:	https://llvm.org/bugs/show_bug.cgi?id=30879
+Reviewed by:	emaste
+PR:		212343
+
+Index: lib/Target/X86/X86CallFrameOptimization.cpp
+===================================================================
+--- lib/Target/X86/X86CallFrameOptimization.cpp	(revision 308866)
++++ lib/Target/X86/X86CallFrameOptimization.cpp	(revision 308867)
+@@ -125,6 +125,11 @@ bool X86CallFrameOptimization::isLegal(MachineFunc
+   if (NoX86CFOpt.getValue())
+     return false;
+ 
++  // Work around LLVM PR30879 (bad interaction between CFO and libunwind)
++  if (STI->isTargetFreeBSD() && STI->is32Bit() &&
++      STI->getTargetTriple().getOSMajorVersion() >= 12)
++    return false;
++
+   // We can't encode multiple DW_CFA_GNU_args_size or DW_CFA_def_cfa_offset
+   // in the compact unwind encoding that Darwin uses. So, bail if there
+   // is a danger of that being generated.

Copied: branches/2018Q4/devel/llvm60/files/patch-head-r330686.diff (from r483054, head/devel/llvm60/files/patch-head-r330686.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q4/devel/llvm60/files/patch-head-r330686.diff	Wed Oct 31 18:49:04 2018	(r483602, copy of r483054, head/devel/llvm60/files/patch-head-r330686.diff)
@@ -0,0 +1,80 @@
+r330686 | dim | 2018-03-09 10:21:22 +0100 (Fri, 09 Mar 2018) | 20 lines
+
+Pull in r326882 from upstream llvm trunk (by Sjoerd Meijer):
+
+  [ARM] Fix for PR36577
+
+  Don't PerformSHLSimplify if the given node is used by a node that
+  also uses a constant because we may get stuck in an infinite combine
+  loop.
+
+  bugzilla: https://bugs.llvm.org/show_bug.cgi?id=36577
+
+  Patch by Sam Parker.
+
+  Differential Revision: https://reviews.llvm.org/D44097
+
+This fixes a hang when compiling one particular file in java/openjdk8
+for armv6 and armv7.
+
+Reported by:	swills
+PR:		226388
+
+Index: lib/Target/ARM/ARMISelLowering.cpp
+===================================================================
+--- lib/Target/ARM/ARMISelLowering.cpp	(revision 330685)
++++ lib/Target/ARM/ARMISelLowering.cpp	(revision 330686)
+@@ -10201,7 +10201,14 @@ static SDValue PerformSHLSimplify(SDNode *N,
+     case ISD::XOR:
+     case ISD::SETCC:
+     case ARMISD::CMP:
+-      // Check that its not already using a shl.
++      // Check that the user isn't already using a constant because there
++      // aren't any instructions that support an immediate operand and a
++      // shifted operand.
++      if (isa<ConstantSDNode>(U->getOperand(0)) ||
++          isa<ConstantSDNode>(U->getOperand(1)))
++        return SDValue();
++
++      // Check that it's not already using a shift.
+       if (U->getOperand(0).getOpcode() == ISD::SHL ||
+           U->getOperand(1).getOpcode() == ISD::SHL)
+         return SDValue();
+@@ -10223,8 +10230,6 @@ static SDValue PerformSHLSimplify(SDNode *N,
+   if (!C1ShlC2 || !C2)
+     return SDValue();
+ 
+-  DEBUG(dbgs() << "Trying to simplify shl: "; N->dump());
+-
+   APInt C2Int = C2->getAPIntValue();
+   APInt C1Int = C1ShlC2->getAPIntValue();
+ 
+@@ -10238,12 +10243,12 @@ static SDValue PerformSHLSimplify(SDNode *N,
+   C1Int.lshrInPlace(C2Int);
+ 
+   // The immediates are encoded as an 8-bit value that can be rotated.
+-  unsigned Zeros = C1Int.countLeadingZeros() + C1Int.countTrailingZeros();
+-  if (C1Int.getBitWidth() - Zeros > 8)
+-    return SDValue();
++  auto LargeImm = [](const APInt &Imm) {
++    unsigned Zeros = Imm.countLeadingZeros() + Imm.countTrailingZeros();
++    return Imm.getBitWidth() - Zeros > 8;
++  };
+ 
+-  Zeros = C2Int.countLeadingZeros() + C2Int.countTrailingZeros();
+-  if (C2Int.getBitWidth() - Zeros > 8)
++  if (LargeImm(C1Int) || LargeImm(C2Int))
+     return SDValue();
+ 
+   SelectionDAG &DAG = DCI.DAG;
+@@ -10254,6 +10259,10 @@ static SDValue PerformSHLSimplify(SDNode *N,
+   // Shift left to compensate for the lshr of C1Int.
+   SDValue Res = DAG.getNode(ISD::SHL, dl, MVT::i32, BinOp, SHL.getOperand(1));
+ 
++  DEBUG(dbgs() << "Simplify shl use:\n"; SHL.getOperand(0).dump(); SHL.dump();
++        N->dump());
++  DEBUG(dbgs() << "Into:\n"; X.dump(); BinOp.dump(); Res.dump());
++
+   DAG.ReplaceAllUsesWith(SDValue(N, 0), Res);
+   return SDValue(N, 0);
+ }

Copied: branches/2018Q4/devel/llvm60/files/patch-head-r331065.diff (from r483054, head/devel/llvm60/files/patch-head-r331065.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q4/devel/llvm60/files/patch-head-r331065.diff	Wed Oct 31 18:49:04 2018	(r483602, copy of r483054, head/devel/llvm60/files/patch-head-r331065.diff)
@@ -0,0 +1,88 @@
+r331065 | dim | 2018-03-16 18:50:44 +0100 (Fri, 16 Mar 2018) | 17 lines
+
+Pull in r327638 from upstream llvm trunk (by Matthew Simpson):
+
+  [ConstantFolding, InstSimplify] Handle more vector GEPs
+
+  This patch addresses some additional cases where the compiler crashes
+  upon encountering vector GEPs. This should fix PR36116.
+
+  Differential Revision: https://reviews.llvm.org/D44219
+  Reference: https://bugs.llvm.org/show_bug.cgi?id=36116
+
+This fixes an assertion when building the emulators/snes9x port.
+
+Reported by:	jbeich
+PR:		225471
+MFC after:	3 months
+X-MFC-With:	r327952
+
+Index: lib/Analysis/InstructionSimplify.cpp
+===================================================================
+--- lib/Analysis/InstructionSimplify.cpp	(revision 331064)
++++ lib/Analysis/InstructionSimplify.cpp	(revision 331065)
+@@ -3697,7 +3697,7 @@ static Value *SimplifyGEPInst(Type *SrcTy, ArrayRe
+ 
+   if (Ops.size() == 2) {
+     // getelementptr P, 0 -> P.
+-    if (match(Ops[1], m_Zero()))
++    if (match(Ops[1], m_Zero()) && Ops[0]->getType() == GEPTy)
+       return Ops[0];
+ 
+     Type *Ty = SrcTy;
+@@ -3706,7 +3706,7 @@ static Value *SimplifyGEPInst(Type *SrcTy, ArrayRe
+       uint64_t C;
+       uint64_t TyAllocSize = Q.DL.getTypeAllocSize(Ty);
+       // getelementptr P, N -> P if P points to a type of zero size.
+-      if (TyAllocSize == 0)
++      if (TyAllocSize == 0 && Ops[0]->getType() == GEPTy)
+         return Ops[0];
+ 
+       // The following transforms are only safe if the ptrtoint cast
+Index: lib/IR/ConstantFold.cpp
+===================================================================
+--- lib/IR/ConstantFold.cpp	(revision 331064)
++++ lib/IR/ConstantFold.cpp	(revision 331065)
+@@ -2018,8 +2018,16 @@ static bool isInBoundsIndices(ArrayRef<IndexTy> Id
+ 
+   // If the first index is one and all the rest are zero, it's in bounds,
+   // by the one-past-the-end rule.
+-  if (!cast<ConstantInt>(Idxs[0])->isOne())
+-    return false;
++  if (auto *CI = dyn_cast<ConstantInt>(Idxs[0])) {
++    if (!CI->isOne())
++      return false;
++  } else {
++    auto *CV = cast<ConstantDataVector>(Idxs[0]);
++    CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue());
++    if (!CI || !CI->isOne())
++      return false;
++  }
++
+   for (unsigned i = 1, e = Idxs.size(); i != e; ++i)
+     if (!cast<Constant>(Idxs[i])->isNullValue())
+       return false;
+@@ -2049,15 +2057,18 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *Po
+                                           ArrayRef<Value *> Idxs) {
+   if (Idxs.empty()) return C;
+ 
+-  if (isa<UndefValue>(C)) {
+-    Type *GEPTy = GetElementPtrInst::getGEPReturnType(
+-        C, makeArrayRef((Value * const *)Idxs.data(), Idxs.size()));
++  Type *GEPTy = GetElementPtrInst::getGEPReturnType(
++      C, makeArrayRef((Value *const *)Idxs.data(), Idxs.size()));
++
++  if (isa<UndefValue>(C))
+     return UndefValue::get(GEPTy);
+-  }
+ 
+   Constant *Idx0 = cast<Constant>(Idxs[0]);
+   if (Idxs.size() == 1 && (Idx0->isNullValue() || isa<UndefValue>(Idx0)))
+-    return C;
++    return GEPTy->isVectorTy() && !C->getType()->isVectorTy()
++               ? ConstantVector::getSplat(
++                     cast<VectorType>(GEPTy)->getNumElements(), C)
++               : C;
+ 
+   if (C->isNullValue()) {
+     bool isNull = true;

Copied: branches/2018Q4/devel/llvm60/files/patch-head-r331366.diff (from r483054, head/devel/llvm60/files/patch-head-r331366.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q4/devel/llvm60/files/patch-head-r331366.diff	Wed Oct 31 18:49:04 2018	(r483602, copy of r483054, head/devel/llvm60/files/patch-head-r331366.diff)
@@ -0,0 +1,609 @@
+r331366 | dim | 2018-03-22 19:58:34 +0100 (Thu, 22 Mar 2018) | 61 lines
+
+Pull in r327101 from upstream llvm trunk (by Rafael Espindola):
+
+  Don't treat .symver as a regular alias definition.
+
+  This patch starts simplifying the handling of .symver.
+
+  For now it just moves the responsibility for creating an alias down to
+  the streamer. With that the asm streamer can pass a .symver unchanged,
+  which is nice since gas cannot parse "foo@bar = zed".
+
+  In a followup I hope to move the handling down to the writer so that
+  we don't need special hacks for avoiding breaking names with @@@ on
+  windows.
+
+Pull in r327160 from upstream llvm trunk (by Rafael Espindola):
+
+  Delay creating an alias for @@@.
+
+  With this we only create an alias for @@@ once we know if it should
+  use @ or @@. This avoids last minutes renames and hacks to handle MS
+  names.
+
+  This only handles the ELF writer. LTO still has issues with @@@
+  aliases.
+
+Pull in r327928 from upstream llvm trunk (by Vitaly Buka):
+
+  Object: Move attribute calculation into RecordStreamer. NFC
+
+  Summary: Preparation for D44274
+
+  Reviewers: pcc, espindola
+
+  Subscribers: hiraditya
+
+  Differential Revision: https://reviews.llvm.org/D44276
+
+Pull in r327930 from upstream llvm trunk (by Vitaly Buka):
+
+  Object: Fix handling of @@@ in .symver directive
+
+  Summary:
+  name@@@nodename is going to be replaced with name@@nodename if symbols is
+  defined in the assembled file, or name@nodename if undefined.
+  https://sourceware.org/binutils/docs/as/Symver.html
+
+  Fixes PR36623
+
+  Reviewers: pcc, espindola
+
+  Subscribers: mehdi_amini, hiraditya
+
+  Differential Revision: https://reviews.llvm.org/D44274
+
+Together, these changes fix handling of @@@ in .symver directives when
+doing Link Time Optimization.
+
+Reported by:	Shawn Webb <shawn.webb@hardenedbsd.org>
+MFC after:	3 months
+X-MFC-With:	r327952
+
+Index: include/llvm/MC/MCAssembler.h
+===================================================================
+--- include/llvm/MC/MCAssembler.h	(revision 331365)
++++ include/llvm/MC/MCAssembler.h	(revision 331366)
+@@ -206,6 +206,8 @@ class MCAssembler {
+   handleFixup(const MCAsmLayout &Layout, MCFragment &F, const MCFixup &Fixup);
+ 
+ public:
++  std::vector<std::pair<StringRef, const MCSymbol *>> Symvers;
++
+   /// Construct a new assembler instance.
+   //
+   // FIXME: How are we going to parameterize this? Two obvious options are stay
+Index: include/llvm/MC/MCELFStreamer.h
+===================================================================
+--- include/llvm/MC/MCELFStreamer.h	(revision 331365)
++++ include/llvm/MC/MCELFStreamer.h	(revision 331366)
+@@ -51,6 +51,8 @@ class MCELFStreamer : public MCObjectStreamer {
+                         unsigned ByteAlignment) override;
+ 
+   void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override;
++  void emitELFSymverDirective(StringRef AliasName,
++                              const MCSymbol *Aliasee) override;
+ 
+   void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
+                              unsigned ByteAlignment) override;
+Index: include/llvm/MC/MCStreamer.h
+===================================================================
+--- include/llvm/MC/MCStreamer.h	(revision 331365)
++++ include/llvm/MC/MCStreamer.h	(revision 331366)
+@@ -519,9 +519,10 @@ class MCStreamer {
+   ///
+   /// This corresponds to an assembler statement such as:
+   ///  .symver _start, foo@@SOME_VERSION
+-  /// \param Alias - The versioned alias (i.e. "foo@@SOME_VERSION")
++  /// \param AliasName - The versioned alias (i.e. "foo@@SOME_VERSION")
+   /// \param Aliasee - The aliased symbol (i.e. "_start")
+-  virtual void emitELFSymverDirective(MCSymbol *Alias, const MCSymbol *Aliasee);
++  virtual void emitELFSymverDirective(StringRef AliasName,
++                                      const MCSymbol *Aliasee);
+ 
+   /// \brief Emit a Linker Optimization Hint (LOH) directive.
+   /// \param Args - Arguments of the LOH.
+Index: lib/MC/ELFObjectWriter.cpp
+===================================================================
+--- lib/MC/ELFObjectWriter.cpp	(revision 331365)
++++ lib/MC/ELFObjectWriter.cpp	(revision 331366)
+@@ -128,8 +128,6 @@ class ELFObjectWriter : public MCObjectWriter {
+   /// @name Symbol Table Data
+   /// @{
+ 
+-  BumpPtrAllocator Alloc;
+-  StringSaver VersionSymSaver{Alloc};
+   StringTableBuilder StrTabBuilder{StringTableBuilder::ELF};
+ 
+   /// @}
+@@ -391,27 +389,29 @@ void ELFObjectWriter::executePostLayoutBinding(MCA
+                                                const MCAsmLayout &Layout) {
+   // The presence of symbol versions causes undefined symbols and
+   // versions declared with @@@ to be renamed.
+-  for (const MCSymbol &A : Asm.symbols()) {
+-    const auto &Alias = cast<MCSymbolELF>(A);
+-    // Not an alias.
+-    if (!Alias.isVariable())
+-      continue;
+-    auto *Ref = dyn_cast<MCSymbolRefExpr>(Alias.getVariableValue());
+-    if (!Ref)
+-      continue;
+-    const auto &Symbol = cast<MCSymbolELF>(Ref->getSymbol());
+-
+-    StringRef AliasName = Alias.getName();
++  for (const std::pair<StringRef, const MCSymbol *> &P : Asm.Symvers) {
++    StringRef AliasName = P.first;
++    const auto &Symbol = cast<MCSymbolELF>(*P.second);
+     size_t Pos = AliasName.find('@');
+-    if (Pos == StringRef::npos)
+-      continue;
++    assert(Pos != StringRef::npos);
+ 
++    StringRef Prefix = AliasName.substr(0, Pos);
++    StringRef Rest = AliasName.substr(Pos);
++    StringRef Tail = Rest;
++    if (Rest.startswith("@@@"))
++      Tail = Rest.substr(Symbol.isUndefined() ? 2 : 1);
++
++    auto *Alias =
++        cast<MCSymbolELF>(Asm.getContext().getOrCreateSymbol(Prefix + Tail));
++    Asm.registerSymbol(*Alias);
++    const MCExpr *Value = MCSymbolRefExpr::create(&Symbol, Asm.getContext());
++    Alias->setVariableValue(Value);
++
+     // Aliases defined with .symvar copy the binding from the symbol they alias.
+     // This is the first place we are able to copy this information.
+-    Alias.setExternal(Symbol.isExternal());
+-    Alias.setBinding(Symbol.getBinding());
++    Alias->setExternal(Symbol.isExternal());
++    Alias->setBinding(Symbol.getBinding());
+ 
+-    StringRef Rest = AliasName.substr(Pos);
+     if (!Symbol.isUndefined() && !Rest.startswith("@@@"))
+       continue;
+ 
+@@ -420,7 +420,7 @@ void ELFObjectWriter::executePostLayoutBinding(MCA
+         !Rest.startswith("@@@"))
+       report_fatal_error("A @@ version cannot be undefined");
+ 
+-    Renames.insert(std::make_pair(&Symbol, &Alias));
++    Renames.insert(std::make_pair(&Symbol, Alias));
+   }
+ }
+ 
+@@ -836,44 +836,7 @@ void ELFObjectWriter::computeSymbolTable(
+         HasLargeSectionIndex = true;
+     }
+ 
+-    // The @@@ in symbol version is replaced with @ in undefined symbols and @@
+-    // in defined ones.
+-    //
+-    // FIXME: All name handling should be done before we get to the writer,
+-    // including dealing with GNU-style version suffixes.  Fixing this isn't
+-    // trivial.
+-    //
+-    // We thus have to be careful to not perform the symbol version replacement
+-    // blindly:
+-    //
+-    // The ELF format is used on Windows by the MCJIT engine.  Thus, on
+-    // Windows, the ELFObjectWriter can encounter symbols mangled using the MS
+-    // Visual Studio C++ name mangling scheme. Symbols mangled using the MSVC
+-    // C++ name mangling can legally have "@@@" as a sub-string. In that case,
+-    // the EFLObjectWriter should not interpret the "@@@" sub-string as
+-    // specifying GNU-style symbol versioning. The ELFObjectWriter therefore
+-    // checks for the MSVC C++ name mangling prefix which is either "?", "@?",
+-    // "__imp_?" or "__imp_@?".
+-    //
+-    // It would have been interesting to perform the MS mangling prefix check
+-    // only when the target triple is of the form *-pc-windows-elf. But, it
+-    // seems that this information is not easily accessible from the
+-    // ELFObjectWriter.
+     StringRef Name = Symbol.getName();
+-    SmallString<32> Buf;
+-    if (!Name.startswith("?") && !Name.startswith("@?") &&
+-        !Name.startswith("__imp_?") && !Name.startswith("__imp_@?")) {
+-      // This symbol isn't following the MSVC C++ name mangling convention. We
+-      // can thus safely interpret the @@@ in symbol names as specifying symbol
+-      // versioning.
+-      size_t Pos = Name.find("@@@");
+-      if (Pos != StringRef::npos) {
+-        Buf += Name.substr(0, Pos);
+-        unsigned Skip = MSD.SectionIndex == ELF::SHN_UNDEF ? 2 : 1;
+-        Buf += Name.substr(Pos + Skip);
+-        Name = VersionSymSaver.save(Buf.c_str());
+-      }
+-    }
+ 
+     // Sections have their own string table
+     if (Symbol.getType() != ELF::STT_SECTION) {
+Index: lib/MC/MCAsmStreamer.cpp
+===================================================================
+--- lib/MC/MCAsmStreamer.cpp	(revision 331365)
++++ lib/MC/MCAsmStreamer.cpp	(revision 331366)
+@@ -129,6 +129,9 @@ class MCAsmStreamer final : public MCStreamer {
+ 
+   void ChangeSection(MCSection *Section, const MCExpr *Subsection) override;
+ 
++  void emitELFSymverDirective(StringRef AliasName,
++                              const MCSymbol *Aliasee) override;
++
+   void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override;
+   void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
+ 
+@@ -411,6 +414,14 @@ void MCAsmStreamer::ChangeSection(MCSection *Secti
+   }
+ }
+ 
++void MCAsmStreamer::emitELFSymverDirective(StringRef AliasName,
++                                           const MCSymbol *Aliasee) {
++  OS << ".symver ";
++  Aliasee->print(OS, MAI);
++  OS << ", " << AliasName;
++  EmitEOL();
++}
++
+ void MCAsmStreamer::EmitLabel(MCSymbol *Symbol, SMLoc Loc) {
+   MCStreamer::EmitLabel(Symbol, Loc);
+ 
+Index: lib/MC/MCELFStreamer.cpp
+===================================================================
+--- lib/MC/MCELFStreamer.cpp	(revision 331365)
++++ lib/MC/MCELFStreamer.cpp	(revision 331366)
+@@ -337,6 +337,11 @@ void MCELFStreamer::emitELFSize(MCSymbol *Symbol,
+   cast<MCSymbolELF>(Symbol)->setSize(Value);
+ }
+ 
++void MCELFStreamer::emitELFSymverDirective(StringRef AliasName,
++                                           const MCSymbol *Aliasee) {
++  getAssembler().Symvers.push_back({AliasName, Aliasee});
++}
++
+ void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
+                                           unsigned ByteAlignment) {
+   auto *Symbol = cast<MCSymbolELF>(S);
+Index: lib/MC/MCParser/ELFAsmParser.cpp
+===================================================================
+--- lib/MC/MCParser/ELFAsmParser.cpp	(revision 331365)
++++ lib/MC/MCParser/ELFAsmParser.cpp	(revision 331366)
+@@ -767,12 +767,8 @@ bool ELFAsmParser::ParseDirectiveSymver(StringRef,
+   if (AliasName.find('@') == StringRef::npos)
+     return TokError("expected a '@' in the name");
+ 
+-  MCSymbol *Alias = getContext().getOrCreateSymbol(AliasName);
+   MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
+-  const MCExpr *Value = MCSymbolRefExpr::create(Sym, getContext());
+-
+-  getStreamer().EmitAssignment(Alias, Value);
+-  getStreamer().emitELFSymverDirective(Alias, Sym);
++  getStreamer().emitELFSymverDirective(AliasName, Sym);
+   return false;
+ }
+ 
+Index: lib/MC/MCStreamer.cpp
+===================================================================
+--- lib/MC/MCStreamer.cpp	(revision 331365)
++++ lib/MC/MCStreamer.cpp	(revision 331366)
+@@ -925,7 +925,7 @@ void MCStreamer::EmitCOFFSymbolType(int Type) {
+   llvm_unreachable("this directive only supported on COFF targets");
+ }
+ void MCStreamer::emitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
+-void MCStreamer::emitELFSymverDirective(MCSymbol *Alias,
++void MCStreamer::emitELFSymverDirective(StringRef AliasName,
+                                         const MCSymbol *Aliasee) {}
+ void MCStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
+                                        unsigned ByteAlignment) {}
+Index: lib/Object/ModuleSymbolTable.cpp
+===================================================================
+--- lib/Object/ModuleSymbolTable.cpp	(revision 331365)
++++ lib/Object/ModuleSymbolTable.cpp	(revision 331366)
+@@ -24,7 +24,6 @@
+ #include "llvm/IR/GlobalAlias.h"
+ #include "llvm/IR/GlobalValue.h"
+ #include "llvm/IR/GlobalVariable.h"
+-#include "llvm/IR/Mangler.h"
+ #include "llvm/IR/Module.h"
+ #include "llvm/MC/MCAsmInfo.h"
+ #include "llvm/MC/MCContext.h"
+@@ -69,81 +68,6 @@ void ModuleSymbolTable::addModule(Module *M) {
+   });
+ }
+ 
+-// Ensure ELF .symver aliases get the same binding as the defined symbol
+-// they alias with.
+-static void handleSymverAliases(const Module &M, RecordStreamer &Streamer) {
+-  if (Streamer.symverAliases().empty())
+-    return;
+-
+-  // The name in the assembler will be mangled, but the name in the IR
+-  // might not, so we first compute a mapping from mangled name to GV.
+-  Mangler Mang;
+-  SmallString<64> MangledName;
+-  StringMap<const GlobalValue *> MangledNameMap;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



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