[arch-commits] Commit in llvm/repos (12 files)

Evangelos Foutras foutrelis at archlinux.org
Tue Mar 28 13:06:18 UTC 2017


    Date: Tuesday, March 28, 2017 @ 13:06:17
  Author: foutrelis
Revision: 291754

archrelease: copy trunk to staging-i686, staging-x86_64

Added:
  llvm/repos/staging-i686/
  llvm/repos/staging-i686/0001-AMDGPU-Fix-bug-31610.patch
    (from rev 291753, llvm/trunk/0001-AMDGPU-Fix-bug-31610.patch)
  llvm/repos/staging-i686/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
    (from rev 291753, llvm/trunk/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch)
  llvm/repos/staging-i686/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
    (from rev 291753, llvm/trunk/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch)
  llvm/repos/staging-i686/PKGBUILD
    (from rev 291753, llvm/trunk/PKGBUILD)
  llvm/repos/staging-i686/llvm-config.h
    (from rev 291753, llvm/trunk/llvm-config.h)
  llvm/repos/staging-x86_64/
  llvm/repos/staging-x86_64/0001-AMDGPU-Fix-bug-31610.patch
    (from rev 291753, llvm/trunk/0001-AMDGPU-Fix-bug-31610.patch)
  llvm/repos/staging-x86_64/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
    (from rev 291753, llvm/trunk/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch)
  llvm/repos/staging-x86_64/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
    (from rev 291753, llvm/trunk/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch)
  llvm/repos/staging-x86_64/PKGBUILD
    (from rev 291753, llvm/trunk/PKGBUILD)
  llvm/repos/staging-x86_64/llvm-config.h
    (from rev 291753, llvm/trunk/llvm-config.h)

-----------------------------------------------------------------------------+
 staging-i686/0001-AMDGPU-Fix-bug-31610.patch                                |   74 +++
 staging-i686/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch   |  193 +++++++
 staging-i686/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch   |   36 +
 staging-i686/PKGBUILD                                                       |  246 ++++++++++
 staging-i686/llvm-config.h                                                  |    9 
 staging-x86_64/0001-AMDGPU-Fix-bug-31610.patch                              |   74 +++
 staging-x86_64/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch |  193 +++++++
 staging-x86_64/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch |   36 +
 staging-x86_64/PKGBUILD                                                     |  246 ++++++++++
 staging-x86_64/llvm-config.h                                                |    9 
 10 files changed, 1116 insertions(+)

Copied: llvm/repos/staging-i686/0001-AMDGPU-Fix-bug-31610.patch (from rev 291753, llvm/trunk/0001-AMDGPU-Fix-bug-31610.patch)
===================================================================
--- staging-i686/0001-AMDGPU-Fix-bug-31610.patch	                        (rev 0)
+++ staging-i686/0001-AMDGPU-Fix-bug-31610.patch	2017-03-28 13:06:17 UTC (rev 291754)
@@ -0,0 +1,74 @@
+From bc72a21666a9efc78e71b0296313f6e1449649fa Mon Sep 17 00:00:00 2001
+From: Konstantin Zhuravlyov <kzhuravl_dev at outlook.com>
+Date: Wed, 22 Mar 2017 21:48:18 +0000
+Subject: [PATCH] [AMDGPU] Fix bug 31610
+
+Differential Revision: https://reviews.llvm.org/D31258
+
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298551 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ lib/Target/AMDGPU/AMDGPURuntimeMetadata.h          | 8 ++++----
+ lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp | 5 ++---
+ 2 files changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h b/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h
+index ed147ff4c43..36e7a0c42a9 100644
+--- a/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h
++++ b/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h
+@@ -40,8 +40,8 @@ namespace AMDGPU {
+ namespace RuntimeMD {
+ 
+   // Version and revision of runtime metadata
+-  const unsigned char MDVersion   = 2;
+-  const unsigned char MDRevision  = 0;
++  const uint32_t MDVersion   = 2;
++  const uint32_t MDRevision  = 0;
+ 
+   // Name of keys for runtime metadata.
+   namespace KeyName {
+@@ -215,7 +215,7 @@ namespace RuntimeMD {
+     struct Metadata {
+       std::string Name;
+       std::string Language;
+-      std::vector<uint8_t> LanguageVersion;
++      std::vector<uint32_t> LanguageVersion;
+       std::vector<uint32_t> ReqdWorkGroupSize;
+       std::vector<uint32_t> WorkGroupSizeHint;
+       std::string VecTypeHint;
+@@ -265,7 +265,7 @@ namespace RuntimeMD {
+   namespace Program {
+     // In-memory representation of program information.
+     struct Metadata {
+-      std::vector<uint8_t> MDVersionSeq;
++      std::vector<uint32_t> MDVersionSeq;
+       std::vector<std::string> PrintfInfo;
+       std::vector<Kernel::Metadata> Kernels;
+ 
+diff --git a/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp b/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp
+index 0e87d750f5d..7c96898297c 100644
+--- a/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp
++++ b/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp
+@@ -49,7 +49,6 @@ static cl::opt<bool>
+ CheckRuntimeMDParser("amdgpu-check-rtmd-parser", cl::Hidden,
+                      cl::desc("Check AMDGPU runtime metadata YAML parser"));
+ 
+-LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint8_t)
+ LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint32_t)
+ LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(std::string)
+ LLVM_YAML_IS_SEQUENCE_VECTOR(Kernel::Metadata)
+@@ -297,9 +296,9 @@ static Kernel::Metadata getRuntimeMDForKernel(const Function &F) {
+       auto Node = MD->getOperand(0);
+       if (Node->getNumOperands() > 1) {
+         Kernel.Language = "OpenCL C";
+-        uint16_t Major = mdconst::extract<ConstantInt>(Node->getOperand(0))
++        uint32_t Major = mdconst::extract<ConstantInt>(Node->getOperand(0))
+                          ->getZExtValue();
+-        uint16_t Minor = mdconst::extract<ConstantInt>(Node->getOperand(1))
++        uint32_t Minor = mdconst::extract<ConstantInt>(Node->getOperand(1))
+                          ->getZExtValue();
+         Kernel.LanguageVersion.push_back(Major);
+         Kernel.LanguageVersion.push_back(Minor);
+-- 
+2.12.2
+

Copied: llvm/repos/staging-i686/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch (from rev 291753, llvm/trunk/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch)
===================================================================
--- staging-i686/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch	                        (rev 0)
+++ staging-i686/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch	2017-03-28 13:06:17 UTC (rev 291754)
@@ -0,0 +1,193 @@
+From a61fc423f3c043314efd4c0cdb1367de2077ac36 Mon Sep 17 00:00:00 2001
+From: Eric Fiselier <eric at efcs.ca>
+Date: Fri, 10 Feb 2017 01:59:20 +0000
+Subject: [PATCH] [CMake] Fix pthread handling for out-of-tree builds
+
+LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
+to correctly link the threading library when needed. Unfortunately
+`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
+and therefore can't be used when configuring out-of-tree builds. This causes
+such builds to fail since `pthread` isn't being correctly linked.
+
+This patch attempts to fix that problem by renaming and exporting
+`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
+because It seemed likely to cause collisions with downstream users of
+`LLVMConfig.cmake`.
+
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294690 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ cmake/config-ix.cmake                             | 2 +-
+ cmake/modules/AddLLVM.cmake                       | 6 +++---
+ cmake/modules/LLVMConfig.cmake.in                 | 4 ++++
+ examples/ParallelJIT/CMakeLists.txt               | 2 +-
+ lib/CodeGen/CMakeLists.txt                        | 2 +-
+ lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt | 2 +-
+ lib/Fuzzer/CMakeLists.txt                         | 4 ++--
+ lib/Support/CMakeLists.txt                        | 2 +-
+ unittests/ExecutionEngine/Orc/CMakeLists.txt      | 2 +-
+ unittests/Support/CMakeLists.txt                  | 2 +-
+ utils/unittest/CMakeLists.txt                     | 4 ++--
+ 11 files changed, 18 insertions(+), 14 deletions(-)
+
+diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
+index 50bcc508a80..6bd2b535500 100755
+--- a/cmake/config-ix.cmake
++++ b/cmake/config-ix.cmake
+@@ -115,7 +115,7 @@ if(HAVE_LIBPTHREAD)
+   set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+   set(THREADS_HAVE_PTHREAD_ARG Off)
+   find_package(Threads REQUIRED)
+-  set(PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
++  set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
+ endif()
+ 
+ # Don't look for these libraries on Windows. Also don't look for them if we're
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index b3c7746c480..cb4171c9bc8 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -718,11 +718,11 @@ macro(add_llvm_executable name)
+   if(NOT ARG_IGNORE_EXTERNALIZE_DEBUGINFO)
+     llvm_externalize_debuginfo(${name})
+   endif()
+-  if (PTHREAD_LIB)
++  if (LLVM_PTHREAD_LIB)
+     # libpthreads overrides some standard library symbols, so main
+     # executable must be linked with it in order to provide consistent
+     # API for all shared libaries loaded by this executable.
+-    target_link_libraries(${name} ${PTHREAD_LIB})
++    target_link_libraries(${name} ${LLVM_PTHREAD_LIB})
+   endif()
+ endmacro(add_llvm_executable name)
+ 
+@@ -1027,7 +1027,7 @@ function(add_unittest test_suite test_name)
+   # libpthreads overrides some standard library symbols, so main
+   # executable must be linked with it in order to provide consistent
+   # API for all shared libaries loaded by this executable.
+-  target_link_libraries(${test_name} gtest_main gtest ${PTHREAD_LIB})
++  target_link_libraries(${test_name} gtest_main gtest ${LLVM_PTHREAD_LIB})
+ 
+   add_dependencies(${test_suite} ${test_name})
+   get_target_property(test_suite_folder ${test_suite} FOLDER)
+diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in
+index 2aea2dcaa54..7a8eb367472 100644
+--- a/cmake/modules/LLVMConfig.cmake.in
++++ b/cmake/modules/LLVMConfig.cmake.in
+@@ -45,6 +45,10 @@ set(LLVM_ENABLE_PIC @LLVM_ENABLE_PIC@)
+ 
+ set(LLVM_BUILD_32_BITS @LLVM_BUILD_32_BITS@)
+ 
++if (NOT "@LLVM_PTHREAD_LIB@" STREQUAL "")
++  set(LLVM_PTHREAD_LIB "@LLVM_PTHREAD_LIB@")
++endif()
++
+ set(LLVM_ENABLE_PLUGINS @LLVM_ENABLE_PLUGINS@)
+ set(LLVM_EXPORT_SYMBOLS_FOR_PLUGINS @LLVM_EXPORT_SYMBOLS_FOR_PLUGINS@)
+ set(LLVM_PLUGIN_EXT @LLVM_PLUGIN_EXT@)
+diff --git a/examples/ParallelJIT/CMakeLists.txt b/examples/ParallelJIT/CMakeLists.txt
+index e85b470f503..deeee072b33 100644
+--- a/examples/ParallelJIT/CMakeLists.txt
++++ b/examples/ParallelJIT/CMakeLists.txt
+@@ -11,4 +11,4 @@ add_llvm_example(ParallelJIT
+   ParallelJIT.cpp
+   )
+ 
+-target_link_libraries(ParallelJIT ${PTHREAD_LIB})
++target_link_libraries(ParallelJIT ${LLVM_PTHREAD_LIB})
+diff --git a/lib/CodeGen/CMakeLists.txt b/lib/CodeGen/CMakeLists.txt
+index a1e5fd46610..a9a3d85f3c2 100644
+--- a/lib/CodeGen/CMakeLists.txt
++++ b/lib/CodeGen/CMakeLists.txt
+@@ -150,7 +150,7 @@ add_llvm_library(LLVMCodeGen
+   ${LLVM_MAIN_INCLUDE_DIR}/llvm/CodeGen
+   ${LLVM_MAIN_INCLUDE_DIR}/llvm/CodeGen/PBQP
+ 
+-  LINK_LIBS ${PTHREAD_LIB}
++  LINK_LIBS ${LLVM_PTHREAD_LIB}
+ 
+   DEPENDS
+   intrinsics_gen
+diff --git a/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt b/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
+index 3b8c4b973e6..e6c33b2ecc2 100644
+--- a/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
++++ b/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
+@@ -4,7 +4,7 @@ if( HAVE_LIBDL )
+     set(LLVM_INTEL_JIT_LIBS ${CMAKE_DL_LIBS})
+ endif()
+ 
+-set(LLVM_INTEL_JIT_LIBS ${PTHREAD_LIB} ${LLVM_INTEL_JIT_LIBS})
++set(LLVM_INTEL_JIT_LIBS ${LLVM_PTHREAD_LIB} ${LLVM_INTEL_JIT_LIBS})
+ 
+ 
+ add_llvm_library(LLVMIntelJITEvents
+diff --git a/lib/Fuzzer/CMakeLists.txt b/lib/Fuzzer/CMakeLists.txt
+index 5ba126e69cc..f490b3681b9 100644
+--- a/lib/Fuzzer/CMakeLists.txt
++++ b/lib/Fuzzer/CMakeLists.txt
+@@ -34,12 +34,12 @@ if( LLVM_USE_SANITIZE_COVERAGE )
+   add_library(LLVMFuzzerNoMain STATIC
+     $<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
+     )
+-  target_link_libraries(LLVMFuzzerNoMain ${PTHREAD_LIB})
++  target_link_libraries(LLVMFuzzerNoMain ${LLVM_PTHREAD_LIB})
+   add_library(LLVMFuzzer STATIC
+     FuzzerMain.cpp
+     $<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
+     )
+-  target_link_libraries(LLVMFuzzer ${PTHREAD_LIB})
++  target_link_libraries(LLVMFuzzer ${LLVM_PTHREAD_LIB})
+ 
+   if( LLVM_INCLUDE_TESTS )
+     add_subdirectory(test)
+diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt
+index 3301364cf2c..f7cfa760ba0 100644
+--- a/lib/Support/CMakeLists.txt
++++ b/lib/Support/CMakeLists.txt
+@@ -17,7 +17,7 @@ elseif( CMAKE_HOST_UNIX )
+   if( LLVM_ENABLE_THREADS AND HAVE_LIBATOMIC )
+     set(system_libs ${system_libs} atomic)
+   endif()
+-  set(system_libs ${system_libs} ${PTHREAD_LIB})
++  set(system_libs ${system_libs} ${LLVM_PTHREAD_LIB})
+   if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
+     set(system_libs ${system_libs} z)
+   endif()
+diff --git a/unittests/ExecutionEngine/Orc/CMakeLists.txt b/unittests/ExecutionEngine/Orc/CMakeLists.txt
+index 68f6d0c28d7..80c344e040a 100644
+--- a/unittests/ExecutionEngine/Orc/CMakeLists.txt
++++ b/unittests/ExecutionEngine/Orc/CMakeLists.txt
+@@ -21,4 +21,4 @@ add_llvm_unittest(OrcJITTests
+   RPCUtilsTest.cpp
+   )
+ 
+-target_link_libraries(OrcJITTests ${PTHREAD_LIB})
++target_link_libraries(OrcJITTests ${LLVM_PTHREAD_LIB})
+diff --git a/unittests/Support/CMakeLists.txt b/unittests/Support/CMakeLists.txt
+index 4c9bb5eea38..ea260792282 100644
+--- a/unittests/Support/CMakeLists.txt
++++ b/unittests/Support/CMakeLists.txt
+@@ -64,4 +64,4 @@ add_llvm_unittest(SupportTests
+   )
+ 
+ # ManagedStatic.cpp uses <pthread>.
+-target_link_libraries(SupportTests ${PTHREAD_LIB})
++target_link_libraries(SupportTests ${LLVM_PTHREAD_LIB})
+diff --git a/utils/unittest/CMakeLists.txt b/utils/unittest/CMakeLists.txt
+index a50733af9aa..b42ac834e3a 100644
+--- a/utils/unittest/CMakeLists.txt
++++ b/utils/unittest/CMakeLists.txt
+@@ -40,8 +40,8 @@ if (NOT LLVM_ENABLE_THREADS)
+   add_definitions( -DGTEST_HAS_PTHREAD=0 )
+ endif()
+ 
+-find_library(PTHREAD_LIBRARY_PATH pthread)
+-if (PTHREAD_LIBRARY_PATH)
++find_library(LLVM_PTHREAD_LIBRARY_PATH pthread)
++if (LLVM_PTHREAD_LIBRARY_PATH)
+   list(APPEND LIBS pthread)
+ endif()
+ 
+-- 
+2.12.2
+

Copied: llvm/repos/staging-i686/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch (from rev 291753, llvm/trunk/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch)
===================================================================
--- staging-i686/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch	                        (rev 0)
+++ staging-i686/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch	2017-03-28 13:06:17 UTC (rev 291754)
@@ -0,0 +1,36 @@
+From f5f712dfcac6ee99381c5aca212950276f1743e8 Mon Sep 17 00:00:00 2001
+From: Eric Fiselier <eric at efcs.ca>
+Date: Fri, 10 Feb 2017 01:59:20 +0000
+Subject: [PATCH] [CMake] Fix pthread handling for out-of-tree builds
+
+LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
+to correctly link the threading library when needed. Unfortunately
+`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
+and therefore can't be used when configuring out-of-tree builds. This causes
+such builds to fail since `pthread` isn't being correctly linked.
+
+This patch attempts to fix that problem by renaming and exporting
+`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
+because It seemed likely to cause collisions with downstream users of
+`LLVMConfig.cmake`.
+
+
+git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@294690 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include-fixer/plugin/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include-fixer/plugin/CMakeLists.txt b/include-fixer/plugin/CMakeLists.txt
+index 2799fd4a..df792ea1 100644
+--- a/include-fixer/plugin/CMakeLists.txt
++++ b/include-fixer/plugin/CMakeLists.txt
+@@ -9,5 +9,5 @@ add_clang_library(clangIncludeFixerPlugin
+   clangParse
+   clangSema
+   clangTooling
+-  ${PTHREAD_LIB}
++  ${LLVM_PTHREAD_LIB}
+   )
+-- 
+2.12.2
+

Copied: llvm/repos/staging-i686/PKGBUILD (from rev 291753, llvm/trunk/PKGBUILD)
===================================================================
--- staging-i686/PKGBUILD	                        (rev 0)
+++ staging-i686/PKGBUILD	2017-03-28 13:06:17 UTC (rev 291754)
@@ -0,0 +1,246 @@
+# $Id$
+# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
+# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
+# Contributor: Sebastian Nowicki <sebnow at gmail.com>
+# Contributor: Devin Cofer <ranguvar{AT]archlinux[DOT}us>
+# Contributor: Tobias Kieslich <tobias at justdreams.de>
+# Contributor: Geoffroy Carrier <geoffroy.carrier at aur.archlinux.org>
+# Contributor: Tomas Lindquist Olsen <tomas at famolsen.dk>
+# Contributor: Roberto Alsina <ralsina at kde.org>
+# Contributor: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
+
+pkgname=('llvm' 'llvm-libs' 'llvm-ocaml' 'lldb' 'clang' 'clang-tools-extra')
+pkgver=4.0.0
+pkgrel=1
+_ocaml_ver=4.04.0
+arch=('i686' 'x86_64')
+url="http://llvm.org/"
+license=('custom:University of Illinois/NCSA Open Source License')
+makedepends=('cmake' 'libffi' 'python2' "ocaml=$_ocaml_ver" 'python-sphinx'
+             'ocaml-ctypes' 'ocaml-findlib' 'libedit' 'swig')
+# Use gcc-multilib to build 32-bit compiler-rt libraries on x86_64 (FS#41911)
+makedepends_x86_64=('gcc-multilib')
+options=('staticlibs')
+source=(http://releases.llvm.org/$pkgver/llvm-$pkgver.src.tar.xz{,.sig}
+        http://releases.llvm.org/$pkgver/cfe-$pkgver.src.tar.xz{,.sig}
+        http://releases.llvm.org/$pkgver/clang-tools-extra-$pkgver.src.tar.xz{,.sig}
+        http://releases.llvm.org/$pkgver/compiler-rt-$pkgver.src.tar.xz{,.sig}
+        http://releases.llvm.org/$pkgver/lldb-$pkgver.src.tar.xz{,.sig}
+        0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
+        0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
+        0001-AMDGPU-Fix-bug-31610.patch
+        llvm-config.h)
+sha256sums=('8d10511df96e73b8ff9e7abbfb4d4d432edbdbe965f1f4f07afaf370b8a533be'
+            'SKIP'
+            'cea5f88ebddb30e296ca89130c83b9d46c2d833685e2912303c828054c4dc98a'
+            'SKIP'
+            '41b7d37eb128fd362ab3431be5244cf50325bb3bb153895735c5bacede647c99'
+            'SKIP'
+            'd3f25b23bef24c305137e6b44f7e81c51bbec764c119e01512a9bd2330be3115'
+            'SKIP'
+            '2dbd8f05c662c1c9f11270fc9d0c63b419ddc988095e0ad107ed911cf882033d'
+            'SKIP'
+            'ead18f586f1ee902b01bebd1f7f9feec07be271fe3229d67808b8016fe99d512'
+            '6d4e7541a70981d8c5162d92bf5604eec3f61536cc1a3ebc9f118dc892ae879b'
+            'cddd04be4fd822e03ff16b7640618e424d475d3bf04494c0d38aa225b920f00e'
+            '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48')
+validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D')
+
+prepare() {
+  cd "$srcdir/llvm-$pkgver.src"
+
+  mv "$srcdir/cfe-$pkgver.src" tools/clang
+  mv "$srcdir/clang-tools-extra-$pkgver.src" tools/clang/tools/extra
+  mv "$srcdir/compiler-rt-$pkgver.src" projects/compiler-rt
+  mv "$srcdir/lldb-$pkgver.src" tools/lldb
+
+  patch -Np1 -i ../0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
+  patch -Np1 -i ../0001-AMDGPU-Fix-bug-31610.patch
+  patch -Np1 -d tools/clang/tools/extra <../0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
+
+  mkdir build
+}
+
+build() {
+  cd "$srcdir/llvm-$pkgver.src/build"
+
+  cmake \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DCMAKE_INSTALL_PREFIX=/usr \
+    -DLLVM_BUILD_LLVM_DYLIB=ON \
+    -DLLVM_LINK_LLVM_DYLIB=ON \
+    -DLLVM_INSTALL_UTILS=ON \
+    -DLLVM_ENABLE_RTTI=ON \
+    -DLLVM_ENABLE_FFI=ON \
+    -DLLVM_BUILD_TESTS=ON \
+    -DLLVM_BUILD_DOCS=ON \
+    -DLLVM_ENABLE_SPHINX=ON \
+    -DLLVM_ENABLE_DOXYGEN=OFF \
+    -DLLDB_DISABLE_LIBEDIT=1 \
+    -DSPHINX_WARNINGS_AS_ERRORS=OFF \
+    -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \
+    -DLLVM_BINUTILS_INCDIR=/usr/include \
+    ..
+
+  make
+  make ocaml_doc
+
+  # Disable automatic installation of components that go into subpackages
+  sed -i '/\(clang\|lldb\)\/cmake_install.cmake/d' tools/cmake_install.cmake
+  sed -i '/extra\/cmake_install.cmake/d' tools/clang/tools/cmake_install.cmake
+  sed -i '/compiler-rt\/cmake_install.cmake/d' projects/cmake_install.cmake
+}
+
+check() {
+  cd "$srcdir/llvm-$pkgver.src/build"
+  make check
+  make check-clang
+}
+
+package_llvm() {
+  pkgdesc="Low Level Virtual Machine"
+  depends=('llvm-libs' 'perl')
+
+  cd "$srcdir/llvm-$pkgver.src"
+
+  make -C build DESTDIR="$pkgdir" install
+
+  # Remove documentation sources
+  rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo}
+
+  # The runtime libraries go into llvm-libs
+  mv -f "$pkgdir"/usr/lib/lib{LLVM,LTO}*.so* "$srcdir"
+  mv -f "$pkgdir"/usr/lib/LLVMgold.so "$srcdir"
+
+  # OCaml bindings go to a separate package
+  rm -rf "$srcdir"/ocaml.{lib,doc}
+  mv "$pkgdir/usr/lib/ocaml" "$srcdir/ocaml.lib"
+  mv "$pkgdir/usr/share/doc/$pkgname/ocaml-html" "$srcdir/ocaml.doc"
+
+  if [[ $CARCH == x86_64 ]]; then
+    # Needed for multilib (https://bugs.archlinux.org/task/29951)
+    # Header stub is taken from Fedora
+    mv "$pkgdir/usr/include/llvm/Config/llvm-config"{,-64}.h
+    cp "$srcdir/llvm-config.h" "$pkgdir/usr/include/llvm/Config/llvm-config.h"
+  fi
+
+  install -Dm644 LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+package_llvm-libs() {
+  pkgdesc="Low Level Virtual Machine (runtime libraries)"
+  depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses')
+
+  install -d "$pkgdir/usr/lib"
+  cp -P \
+    "$srcdir"/lib{LLVM,LTO}*.so* \
+    "$srcdir"/LLVMgold.so \
+    "$pkgdir/usr/lib/"
+
+  # Symlink LLVMgold.so from /usr/lib/bfd-plugins
+  # https://bugs.archlinux.org/task/28479
+  install -d "$pkgdir/usr/lib/bfd-plugins"
+  ln -s ../LLVMgold.so "$pkgdir/usr/lib/bfd-plugins/LLVMgold.so"
+
+  install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \
+    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+package_llvm-ocaml() {
+  pkgdesc="OCaml bindings for LLVM"
+  depends=("llvm=$pkgver-$pkgrel" "ocaml=$_ocaml_ver" 'ocaml-ctypes')
+
+  cd "$srcdir/llvm-$pkgver.src"
+
+  install -d "$pkgdir"/{usr/lib,usr/share/doc/$pkgname}
+  cp -a "$srcdir/ocaml.lib" "$pkgdir/usr/lib/ocaml"
+  cp -a "$srcdir/ocaml.doc" "$pkgdir/usr/share/doc/$pkgname/html"
+
+  install -Dm644 LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+package_lldb() {
+  pkgdesc="Next generation, high-performance debugger"
+  url="http://lldb.llvm.org/"
+  depends=('llvm-libs' 'libxml2' 'python2' 'python2-six')
+
+  cd "$srcdir/llvm-$pkgver.src"
+
+  make -C build/tools/lldb DESTDIR="$pkgdir" install
+
+  # https://bugs.archlinux.org/task/50759
+  sed -i "/import_module('_lldb')/s/_lldb/lldb.&/" \
+    "$pkgdir/usr/lib/python2.7/site-packages/lldb/__init__.py"
+
+  # Remove bundled six library
+  rm "$pkgdir/usr/lib/python2.7/site-packages/six.py"
+
+  # Compile Python scripts
+  python2 -m compileall "$pkgdir/usr/lib/python2.7/site-packages/lldb"
+  python2 -O -m compileall "$pkgdir/usr/lib/python2.7/site-packages/lldb"
+
+  install -Dm644 tools/lldb/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+package_clang() {
+  pkgdesc="C language family frontend for LLVM"
+  url="http://clang.llvm.org/"
+  depends=('llvm-libs' 'gcc' 'libxml2')
+  optdepends=('openmp: OpenMP support in clang with -fopenmp'
+              'python2: for scan-view and git-clang-format')
+  provides=("clang-analyzer=$pkgver")
+  conflicts=('clang-analyzer')
+  replaces=('clang-analyzer')
+
+  cd "$srcdir/llvm-$pkgver.src"
+
+  make -C build/tools/clang DESTDIR="$pkgdir" install
+  make -C build/projects/compiler-rt DESTDIR="$pkgdir" install
+
+  # Remove documentation sources
+  rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo}
+
+  # Move analyzer scripts out of /usr/libexec
+  mv "$pkgdir"/usr/libexec/{ccc,c++}-analyzer "$pkgdir/usr/lib/clang/"
+  rmdir "$pkgdir/usr/libexec"
+  sed -i 's|libexec|lib/clang|' "$pkgdir/usr/bin/scan-build"
+
+  # Install Python bindings
+  install -d "$pkgdir/usr/lib/python2.7/site-packages"
+  cp -a tools/clang/bindings/python/clang "$pkgdir/usr/lib/python2.7/site-packages/"
+
+  # Use Python 2
+  sed -i 's|/usr/bin/env python|&2|' \
+    "$pkgdir/usr/bin/scan-view" \
+    "$pkgdir/usr/bin/git-clang-format" \
+    "$pkgdir/usr/share/$pkgname/clang-format-diff.py"
+
+  # Compile Python scripts
+  python2 -m compileall "$pkgdir"
+  python2 -O -m compileall "$pkgdir"
+
+  install -Dm644 tools/clang/LICENSE.TXT \
+    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+package_clang-tools-extra() {
+  pkgdesc="Extra tools built using clang's tooling APIs"
+  url="http://clang.llvm.org/"
+  depends=("clang=$pkgver-$pkgrel")
+
+  cd "$srcdir/llvm-$pkgver.src"
+
+  make -C build/tools/clang/tools/extra DESTDIR="$pkgdir" install
+
+  # Remove documentation sources
+  rm -r "$pkgdir"/usr/share/doc/clang-tools/html/{_sources,.buildinfo}
+
+  # Use Python 2
+  sed -i 's|/usr/bin/env python|&2|' \
+    "$pkgdir"/usr/share/clang/{clang-tidy-diff,run-clang-tidy,run-find-all-symbols}.py
+
+  install -Dm644 tools/clang/tools/extra/LICENSE.TXT \
+    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+# vim:set ts=2 sw=2 et:

Copied: llvm/repos/staging-i686/llvm-config.h (from rev 291753, llvm/trunk/llvm-config.h)
===================================================================
--- staging-i686/llvm-config.h	                        (rev 0)
+++ staging-i686/llvm-config.h	2017-03-28 13:06:17 UTC (rev 291754)
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif

Copied: llvm/repos/staging-x86_64/0001-AMDGPU-Fix-bug-31610.patch (from rev 291753, llvm/trunk/0001-AMDGPU-Fix-bug-31610.patch)
===================================================================
--- staging-x86_64/0001-AMDGPU-Fix-bug-31610.patch	                        (rev 0)
+++ staging-x86_64/0001-AMDGPU-Fix-bug-31610.patch	2017-03-28 13:06:17 UTC (rev 291754)
@@ -0,0 +1,74 @@
+From bc72a21666a9efc78e71b0296313f6e1449649fa Mon Sep 17 00:00:00 2001
+From: Konstantin Zhuravlyov <kzhuravl_dev at outlook.com>
+Date: Wed, 22 Mar 2017 21:48:18 +0000
+Subject: [PATCH] [AMDGPU] Fix bug 31610
+
+Differential Revision: https://reviews.llvm.org/D31258
+
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298551 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ lib/Target/AMDGPU/AMDGPURuntimeMetadata.h          | 8 ++++----
+ lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp | 5 ++---
+ 2 files changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h b/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h
+index ed147ff4c43..36e7a0c42a9 100644
+--- a/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h
++++ b/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h
+@@ -40,8 +40,8 @@ namespace AMDGPU {
+ namespace RuntimeMD {
+ 
+   // Version and revision of runtime metadata
+-  const unsigned char MDVersion   = 2;
+-  const unsigned char MDRevision  = 0;
++  const uint32_t MDVersion   = 2;
++  const uint32_t MDRevision  = 0;
+ 
+   // Name of keys for runtime metadata.
+   namespace KeyName {
+@@ -215,7 +215,7 @@ namespace RuntimeMD {
+     struct Metadata {
+       std::string Name;
+       std::string Language;
+-      std::vector<uint8_t> LanguageVersion;
++      std::vector<uint32_t> LanguageVersion;
+       std::vector<uint32_t> ReqdWorkGroupSize;
+       std::vector<uint32_t> WorkGroupSizeHint;
+       std::string VecTypeHint;
+@@ -265,7 +265,7 @@ namespace RuntimeMD {
+   namespace Program {
+     // In-memory representation of program information.
+     struct Metadata {
+-      std::vector<uint8_t> MDVersionSeq;
++      std::vector<uint32_t> MDVersionSeq;
+       std::vector<std::string> PrintfInfo;
+       std::vector<Kernel::Metadata> Kernels;
+ 
+diff --git a/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp b/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp
+index 0e87d750f5d..7c96898297c 100644
+--- a/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp
++++ b/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp
+@@ -49,7 +49,6 @@ static cl::opt<bool>
+ CheckRuntimeMDParser("amdgpu-check-rtmd-parser", cl::Hidden,
+                      cl::desc("Check AMDGPU runtime metadata YAML parser"));
+ 
+-LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint8_t)
+ LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint32_t)
+ LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(std::string)
+ LLVM_YAML_IS_SEQUENCE_VECTOR(Kernel::Metadata)
+@@ -297,9 +296,9 @@ static Kernel::Metadata getRuntimeMDForKernel(const Function &F) {
+       auto Node = MD->getOperand(0);
+       if (Node->getNumOperands() > 1) {
+         Kernel.Language = "OpenCL C";
+-        uint16_t Major = mdconst::extract<ConstantInt>(Node->getOperand(0))
++        uint32_t Major = mdconst::extract<ConstantInt>(Node->getOperand(0))
+                          ->getZExtValue();
+-        uint16_t Minor = mdconst::extract<ConstantInt>(Node->getOperand(1))
++        uint32_t Minor = mdconst::extract<ConstantInt>(Node->getOperand(1))
+                          ->getZExtValue();
+         Kernel.LanguageVersion.push_back(Major);
+         Kernel.LanguageVersion.push_back(Minor);
+-- 
+2.12.2
+

Copied: llvm/repos/staging-x86_64/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch (from rev 291753, llvm/trunk/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch)
===================================================================
--- staging-x86_64/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch	                        (rev 0)
+++ staging-x86_64/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch	2017-03-28 13:06:17 UTC (rev 291754)
@@ -0,0 +1,193 @@
+From a61fc423f3c043314efd4c0cdb1367de2077ac36 Mon Sep 17 00:00:00 2001
+From: Eric Fiselier <eric at efcs.ca>
+Date: Fri, 10 Feb 2017 01:59:20 +0000
+Subject: [PATCH] [CMake] Fix pthread handling for out-of-tree builds
+
+LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
+to correctly link the threading library when needed. Unfortunately
+`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
+and therefore can't be used when configuring out-of-tree builds. This causes
+such builds to fail since `pthread` isn't being correctly linked.
+
+This patch attempts to fix that problem by renaming and exporting
+`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
+because It seemed likely to cause collisions with downstream users of
+`LLVMConfig.cmake`.
+
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294690 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ cmake/config-ix.cmake                             | 2 +-
+ cmake/modules/AddLLVM.cmake                       | 6 +++---
+ cmake/modules/LLVMConfig.cmake.in                 | 4 ++++
+ examples/ParallelJIT/CMakeLists.txt               | 2 +-
+ lib/CodeGen/CMakeLists.txt                        | 2 +-
+ lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt | 2 +-
+ lib/Fuzzer/CMakeLists.txt                         | 4 ++--
+ lib/Support/CMakeLists.txt                        | 2 +-
+ unittests/ExecutionEngine/Orc/CMakeLists.txt      | 2 +-
+ unittests/Support/CMakeLists.txt                  | 2 +-
+ utils/unittest/CMakeLists.txt                     | 4 ++--
+ 11 files changed, 18 insertions(+), 14 deletions(-)
+
+diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
+index 50bcc508a80..6bd2b535500 100755
+--- a/cmake/config-ix.cmake
++++ b/cmake/config-ix.cmake
+@@ -115,7 +115,7 @@ if(HAVE_LIBPTHREAD)
+   set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+   set(THREADS_HAVE_PTHREAD_ARG Off)
+   find_package(Threads REQUIRED)
+-  set(PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
++  set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
+ endif()
+ 
+ # Don't look for these libraries on Windows. Also don't look for them if we're
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index b3c7746c480..cb4171c9bc8 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -718,11 +718,11 @@ macro(add_llvm_executable name)
+   if(NOT ARG_IGNORE_EXTERNALIZE_DEBUGINFO)
+     llvm_externalize_debuginfo(${name})
+   endif()
+-  if (PTHREAD_LIB)
++  if (LLVM_PTHREAD_LIB)
+     # libpthreads overrides some standard library symbols, so main
+     # executable must be linked with it in order to provide consistent
+     # API for all shared libaries loaded by this executable.
+-    target_link_libraries(${name} ${PTHREAD_LIB})
++    target_link_libraries(${name} ${LLVM_PTHREAD_LIB})
+   endif()
+ endmacro(add_llvm_executable name)
+ 
+@@ -1027,7 +1027,7 @@ function(add_unittest test_suite test_name)
+   # libpthreads overrides some standard library symbols, so main
+   # executable must be linked with it in order to provide consistent
+   # API for all shared libaries loaded by this executable.
+-  target_link_libraries(${test_name} gtest_main gtest ${PTHREAD_LIB})
++  target_link_libraries(${test_name} gtest_main gtest ${LLVM_PTHREAD_LIB})
+ 
+   add_dependencies(${test_suite} ${test_name})
+   get_target_property(test_suite_folder ${test_suite} FOLDER)
+diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in
+index 2aea2dcaa54..7a8eb367472 100644
+--- a/cmake/modules/LLVMConfig.cmake.in
++++ b/cmake/modules/LLVMConfig.cmake.in
+@@ -45,6 +45,10 @@ set(LLVM_ENABLE_PIC @LLVM_ENABLE_PIC@)
+ 
+ set(LLVM_BUILD_32_BITS @LLVM_BUILD_32_BITS@)
+ 
++if (NOT "@LLVM_PTHREAD_LIB@" STREQUAL "")
++  set(LLVM_PTHREAD_LIB "@LLVM_PTHREAD_LIB@")
++endif()
++
+ set(LLVM_ENABLE_PLUGINS @LLVM_ENABLE_PLUGINS@)
+ set(LLVM_EXPORT_SYMBOLS_FOR_PLUGINS @LLVM_EXPORT_SYMBOLS_FOR_PLUGINS@)
+ set(LLVM_PLUGIN_EXT @LLVM_PLUGIN_EXT@)
+diff --git a/examples/ParallelJIT/CMakeLists.txt b/examples/ParallelJIT/CMakeLists.txt
+index e85b470f503..deeee072b33 100644
+--- a/examples/ParallelJIT/CMakeLists.txt
++++ b/examples/ParallelJIT/CMakeLists.txt
+@@ -11,4 +11,4 @@ add_llvm_example(ParallelJIT
+   ParallelJIT.cpp
+   )
+ 
+-target_link_libraries(ParallelJIT ${PTHREAD_LIB})
++target_link_libraries(ParallelJIT ${LLVM_PTHREAD_LIB})
+diff --git a/lib/CodeGen/CMakeLists.txt b/lib/CodeGen/CMakeLists.txt
+index a1e5fd46610..a9a3d85f3c2 100644
+--- a/lib/CodeGen/CMakeLists.txt
++++ b/lib/CodeGen/CMakeLists.txt
+@@ -150,7 +150,7 @@ add_llvm_library(LLVMCodeGen
+   ${LLVM_MAIN_INCLUDE_DIR}/llvm/CodeGen
+   ${LLVM_MAIN_INCLUDE_DIR}/llvm/CodeGen/PBQP
+ 
+-  LINK_LIBS ${PTHREAD_LIB}
++  LINK_LIBS ${LLVM_PTHREAD_LIB}
+ 
+   DEPENDS
+   intrinsics_gen
+diff --git a/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt b/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
+index 3b8c4b973e6..e6c33b2ecc2 100644
+--- a/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
++++ b/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
+@@ -4,7 +4,7 @@ if( HAVE_LIBDL )
+     set(LLVM_INTEL_JIT_LIBS ${CMAKE_DL_LIBS})
+ endif()
+ 
+-set(LLVM_INTEL_JIT_LIBS ${PTHREAD_LIB} ${LLVM_INTEL_JIT_LIBS})
++set(LLVM_INTEL_JIT_LIBS ${LLVM_PTHREAD_LIB} ${LLVM_INTEL_JIT_LIBS})
+ 
+ 
+ add_llvm_library(LLVMIntelJITEvents
+diff --git a/lib/Fuzzer/CMakeLists.txt b/lib/Fuzzer/CMakeLists.txt
+index 5ba126e69cc..f490b3681b9 100644
+--- a/lib/Fuzzer/CMakeLists.txt
++++ b/lib/Fuzzer/CMakeLists.txt
+@@ -34,12 +34,12 @@ if( LLVM_USE_SANITIZE_COVERAGE )
+   add_library(LLVMFuzzerNoMain STATIC
+     $<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
+     )
+-  target_link_libraries(LLVMFuzzerNoMain ${PTHREAD_LIB})
++  target_link_libraries(LLVMFuzzerNoMain ${LLVM_PTHREAD_LIB})
+   add_library(LLVMFuzzer STATIC
+     FuzzerMain.cpp
+     $<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
+     )
+-  target_link_libraries(LLVMFuzzer ${PTHREAD_LIB})
++  target_link_libraries(LLVMFuzzer ${LLVM_PTHREAD_LIB})
+ 
+   if( LLVM_INCLUDE_TESTS )
+     add_subdirectory(test)
+diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt
+index 3301364cf2c..f7cfa760ba0 100644
+--- a/lib/Support/CMakeLists.txt
++++ b/lib/Support/CMakeLists.txt
+@@ -17,7 +17,7 @@ elseif( CMAKE_HOST_UNIX )
+   if( LLVM_ENABLE_THREADS AND HAVE_LIBATOMIC )
+     set(system_libs ${system_libs} atomic)
+   endif()
+-  set(system_libs ${system_libs} ${PTHREAD_LIB})
++  set(system_libs ${system_libs} ${LLVM_PTHREAD_LIB})
+   if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
+     set(system_libs ${system_libs} z)
+   endif()
+diff --git a/unittests/ExecutionEngine/Orc/CMakeLists.txt b/unittests/ExecutionEngine/Orc/CMakeLists.txt
+index 68f6d0c28d7..80c344e040a 100644
+--- a/unittests/ExecutionEngine/Orc/CMakeLists.txt
++++ b/unittests/ExecutionEngine/Orc/CMakeLists.txt
+@@ -21,4 +21,4 @@ add_llvm_unittest(OrcJITTests
+   RPCUtilsTest.cpp
+   )
+ 
+-target_link_libraries(OrcJITTests ${PTHREAD_LIB})
++target_link_libraries(OrcJITTests ${LLVM_PTHREAD_LIB})
+diff --git a/unittests/Support/CMakeLists.txt b/unittests/Support/CMakeLists.txt
+index 4c9bb5eea38..ea260792282 100644
+--- a/unittests/Support/CMakeLists.txt
++++ b/unittests/Support/CMakeLists.txt
+@@ -64,4 +64,4 @@ add_llvm_unittest(SupportTests
+   )
+ 
+ # ManagedStatic.cpp uses <pthread>.
+-target_link_libraries(SupportTests ${PTHREAD_LIB})
++target_link_libraries(SupportTests ${LLVM_PTHREAD_LIB})
+diff --git a/utils/unittest/CMakeLists.txt b/utils/unittest/CMakeLists.txt
+index a50733af9aa..b42ac834e3a 100644
+--- a/utils/unittest/CMakeLists.txt
++++ b/utils/unittest/CMakeLists.txt
+@@ -40,8 +40,8 @@ if (NOT LLVM_ENABLE_THREADS)
+   add_definitions( -DGTEST_HAS_PTHREAD=0 )
+ endif()
+ 
+-find_library(PTHREAD_LIBRARY_PATH pthread)
+-if (PTHREAD_LIBRARY_PATH)
++find_library(LLVM_PTHREAD_LIBRARY_PATH pthread)
++if (LLVM_PTHREAD_LIBRARY_PATH)
+   list(APPEND LIBS pthread)
+ endif()
+ 
+-- 
+2.12.2
+

Copied: llvm/repos/staging-x86_64/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch (from rev 291753, llvm/trunk/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch)
===================================================================
--- staging-x86_64/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch	                        (rev 0)
+++ staging-x86_64/0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch	2017-03-28 13:06:17 UTC (rev 291754)
@@ -0,0 +1,36 @@
+From f5f712dfcac6ee99381c5aca212950276f1743e8 Mon Sep 17 00:00:00 2001
+From: Eric Fiselier <eric at efcs.ca>
+Date: Fri, 10 Feb 2017 01:59:20 +0000
+Subject: [PATCH] [CMake] Fix pthread handling for out-of-tree builds
+
+LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
+to correctly link the threading library when needed. Unfortunately
+`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
+and therefore can't be used when configuring out-of-tree builds. This causes
+such builds to fail since `pthread` isn't being correctly linked.
+
+This patch attempts to fix that problem by renaming and exporting
+`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
+because It seemed likely to cause collisions with downstream users of
+`LLVMConfig.cmake`.
+
+
+git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@294690 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include-fixer/plugin/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include-fixer/plugin/CMakeLists.txt b/include-fixer/plugin/CMakeLists.txt
+index 2799fd4a..df792ea1 100644
+--- a/include-fixer/plugin/CMakeLists.txt
++++ b/include-fixer/plugin/CMakeLists.txt
+@@ -9,5 +9,5 @@ add_clang_library(clangIncludeFixerPlugin
+   clangParse
+   clangSema
+   clangTooling
+-  ${PTHREAD_LIB}
++  ${LLVM_PTHREAD_LIB}
+   )
+-- 
+2.12.2
+

Copied: llvm/repos/staging-x86_64/PKGBUILD (from rev 291753, llvm/trunk/PKGBUILD)
===================================================================
--- staging-x86_64/PKGBUILD	                        (rev 0)
+++ staging-x86_64/PKGBUILD	2017-03-28 13:06:17 UTC (rev 291754)
@@ -0,0 +1,246 @@
+# $Id$
+# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
+# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
+# Contributor: Sebastian Nowicki <sebnow at gmail.com>
+# Contributor: Devin Cofer <ranguvar{AT]archlinux[DOT}us>
+# Contributor: Tobias Kieslich <tobias at justdreams.de>
+# Contributor: Geoffroy Carrier <geoffroy.carrier at aur.archlinux.org>
+# Contributor: Tomas Lindquist Olsen <tomas at famolsen.dk>
+# Contributor: Roberto Alsina <ralsina at kde.org>
+# Contributor: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
+
+pkgname=('llvm' 'llvm-libs' 'llvm-ocaml' 'lldb' 'clang' 'clang-tools-extra')
+pkgver=4.0.0
+pkgrel=1
+_ocaml_ver=4.04.0
+arch=('i686' 'x86_64')
+url="http://llvm.org/"
+license=('custom:University of Illinois/NCSA Open Source License')
+makedepends=('cmake' 'libffi' 'python2' "ocaml=$_ocaml_ver" 'python-sphinx'
+             'ocaml-ctypes' 'ocaml-findlib' 'libedit' 'swig')
+# Use gcc-multilib to build 32-bit compiler-rt libraries on x86_64 (FS#41911)
+makedepends_x86_64=('gcc-multilib')
+options=('staticlibs')
+source=(http://releases.llvm.org/$pkgver/llvm-$pkgver.src.tar.xz{,.sig}
+        http://releases.llvm.org/$pkgver/cfe-$pkgver.src.tar.xz{,.sig}
+        http://releases.llvm.org/$pkgver/clang-tools-extra-$pkgver.src.tar.xz{,.sig}
+        http://releases.llvm.org/$pkgver/compiler-rt-$pkgver.src.tar.xz{,.sig}
+        http://releases.llvm.org/$pkgver/lldb-$pkgver.src.tar.xz{,.sig}
+        0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
+        0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
+        0001-AMDGPU-Fix-bug-31610.patch
+        llvm-config.h)
+sha256sums=('8d10511df96e73b8ff9e7abbfb4d4d432edbdbe965f1f4f07afaf370b8a533be'
+            'SKIP'
+            'cea5f88ebddb30e296ca89130c83b9d46c2d833685e2912303c828054c4dc98a'
+            'SKIP'
+            '41b7d37eb128fd362ab3431be5244cf50325bb3bb153895735c5bacede647c99'
+            'SKIP'
+            'd3f25b23bef24c305137e6b44f7e81c51bbec764c119e01512a9bd2330be3115'
+            'SKIP'
+            '2dbd8f05c662c1c9f11270fc9d0c63b419ddc988095e0ad107ed911cf882033d'
+            'SKIP'
+            'ead18f586f1ee902b01bebd1f7f9feec07be271fe3229d67808b8016fe99d512'
+            '6d4e7541a70981d8c5162d92bf5604eec3f61536cc1a3ebc9f118dc892ae879b'
+            'cddd04be4fd822e03ff16b7640618e424d475d3bf04494c0d38aa225b920f00e'
+            '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48')
+validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D')
+
+prepare() {
+  cd "$srcdir/llvm-$pkgver.src"
+
+  mv "$srcdir/cfe-$pkgver.src" tools/clang
+  mv "$srcdir/clang-tools-extra-$pkgver.src" tools/clang/tools/extra
+  mv "$srcdir/compiler-rt-$pkgver.src" projects/compiler-rt
+  mv "$srcdir/lldb-$pkgver.src" tools/lldb
+
+  patch -Np1 -i ../0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
+  patch -Np1 -i ../0001-AMDGPU-Fix-bug-31610.patch
+  patch -Np1 -d tools/clang/tools/extra <../0002-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
+
+  mkdir build
+}
+
+build() {
+  cd "$srcdir/llvm-$pkgver.src/build"
+
+  cmake \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DCMAKE_INSTALL_PREFIX=/usr \
+    -DLLVM_BUILD_LLVM_DYLIB=ON \
+    -DLLVM_LINK_LLVM_DYLIB=ON \
+    -DLLVM_INSTALL_UTILS=ON \
+    -DLLVM_ENABLE_RTTI=ON \
+    -DLLVM_ENABLE_FFI=ON \
+    -DLLVM_BUILD_TESTS=ON \
+    -DLLVM_BUILD_DOCS=ON \
+    -DLLVM_ENABLE_SPHINX=ON \
+    -DLLVM_ENABLE_DOXYGEN=OFF \
+    -DLLDB_DISABLE_LIBEDIT=1 \
+    -DSPHINX_WARNINGS_AS_ERRORS=OFF \
+    -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \
+    -DLLVM_BINUTILS_INCDIR=/usr/include \
+    ..
+
+  make
+  make ocaml_doc
+
+  # Disable automatic installation of components that go into subpackages
+  sed -i '/\(clang\|lldb\)\/cmake_install.cmake/d' tools/cmake_install.cmake
+  sed -i '/extra\/cmake_install.cmake/d' tools/clang/tools/cmake_install.cmake
+  sed -i '/compiler-rt\/cmake_install.cmake/d' projects/cmake_install.cmake
+}
+
+check() {
+  cd "$srcdir/llvm-$pkgver.src/build"
+  make check
+  make check-clang
+}
+
+package_llvm() {
+  pkgdesc="Low Level Virtual Machine"
+  depends=('llvm-libs' 'perl')
+
+  cd "$srcdir/llvm-$pkgver.src"
+
+  make -C build DESTDIR="$pkgdir" install
+
+  # Remove documentation sources
+  rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo}
+
+  # The runtime libraries go into llvm-libs
+  mv -f "$pkgdir"/usr/lib/lib{LLVM,LTO}*.so* "$srcdir"
+  mv -f "$pkgdir"/usr/lib/LLVMgold.so "$srcdir"
+
+  # OCaml bindings go to a separate package
+  rm -rf "$srcdir"/ocaml.{lib,doc}
+  mv "$pkgdir/usr/lib/ocaml" "$srcdir/ocaml.lib"
+  mv "$pkgdir/usr/share/doc/$pkgname/ocaml-html" "$srcdir/ocaml.doc"
+
+  if [[ $CARCH == x86_64 ]]; then
+    # Needed for multilib (https://bugs.archlinux.org/task/29951)
+    # Header stub is taken from Fedora
+    mv "$pkgdir/usr/include/llvm/Config/llvm-config"{,-64}.h
+    cp "$srcdir/llvm-config.h" "$pkgdir/usr/include/llvm/Config/llvm-config.h"
+  fi
+
+  install -Dm644 LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+package_llvm-libs() {
+  pkgdesc="Low Level Virtual Machine (runtime libraries)"
+  depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses')
+
+  install -d "$pkgdir/usr/lib"
+  cp -P \
+    "$srcdir"/lib{LLVM,LTO}*.so* \
+    "$srcdir"/LLVMgold.so \
+    "$pkgdir/usr/lib/"
+
+  # Symlink LLVMgold.so from /usr/lib/bfd-plugins
+  # https://bugs.archlinux.org/task/28479
+  install -d "$pkgdir/usr/lib/bfd-plugins"
+  ln -s ../LLVMgold.so "$pkgdir/usr/lib/bfd-plugins/LLVMgold.so"
+
+  install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \
+    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+package_llvm-ocaml() {
+  pkgdesc="OCaml bindings for LLVM"
+  depends=("llvm=$pkgver-$pkgrel" "ocaml=$_ocaml_ver" 'ocaml-ctypes')
+
+  cd "$srcdir/llvm-$pkgver.src"
+
+  install -d "$pkgdir"/{usr/lib,usr/share/doc/$pkgname}
+  cp -a "$srcdir/ocaml.lib" "$pkgdir/usr/lib/ocaml"
+  cp -a "$srcdir/ocaml.doc" "$pkgdir/usr/share/doc/$pkgname/html"
+
+  install -Dm644 LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+package_lldb() {
+  pkgdesc="Next generation, high-performance debugger"
+  url="http://lldb.llvm.org/"
+  depends=('llvm-libs' 'libxml2' 'python2' 'python2-six')
+
+  cd "$srcdir/llvm-$pkgver.src"
+
+  make -C build/tools/lldb DESTDIR="$pkgdir" install
+
+  # https://bugs.archlinux.org/task/50759
+  sed -i "/import_module('_lldb')/s/_lldb/lldb.&/" \
+    "$pkgdir/usr/lib/python2.7/site-packages/lldb/__init__.py"
+
+  # Remove bundled six library
+  rm "$pkgdir/usr/lib/python2.7/site-packages/six.py"
+
+  # Compile Python scripts
+  python2 -m compileall "$pkgdir/usr/lib/python2.7/site-packages/lldb"
+  python2 -O -m compileall "$pkgdir/usr/lib/python2.7/site-packages/lldb"
+
+  install -Dm644 tools/lldb/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+package_clang() {
+  pkgdesc="C language family frontend for LLVM"
+  url="http://clang.llvm.org/"
+  depends=('llvm-libs' 'gcc' 'libxml2')
+  optdepends=('openmp: OpenMP support in clang with -fopenmp'
+              'python2: for scan-view and git-clang-format')
+  provides=("clang-analyzer=$pkgver")
+  conflicts=('clang-analyzer')
+  replaces=('clang-analyzer')
+
+  cd "$srcdir/llvm-$pkgver.src"
+
+  make -C build/tools/clang DESTDIR="$pkgdir" install
+  make -C build/projects/compiler-rt DESTDIR="$pkgdir" install
+
+  # Remove documentation sources
+  rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo}
+
+  # Move analyzer scripts out of /usr/libexec
+  mv "$pkgdir"/usr/libexec/{ccc,c++}-analyzer "$pkgdir/usr/lib/clang/"
+  rmdir "$pkgdir/usr/libexec"
+  sed -i 's|libexec|lib/clang|' "$pkgdir/usr/bin/scan-build"
+
+  # Install Python bindings
+  install -d "$pkgdir/usr/lib/python2.7/site-packages"
+  cp -a tools/clang/bindings/python/clang "$pkgdir/usr/lib/python2.7/site-packages/"
+
+  # Use Python 2
+  sed -i 's|/usr/bin/env python|&2|' \
+    "$pkgdir/usr/bin/scan-view" \
+    "$pkgdir/usr/bin/git-clang-format" \
+    "$pkgdir/usr/share/$pkgname/clang-format-diff.py"
+
+  # Compile Python scripts
+  python2 -m compileall "$pkgdir"
+  python2 -O -m compileall "$pkgdir"
+
+  install -Dm644 tools/clang/LICENSE.TXT \
+    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+package_clang-tools-extra() {
+  pkgdesc="Extra tools built using clang's tooling APIs"
+  url="http://clang.llvm.org/"
+  depends=("clang=$pkgver-$pkgrel")
+
+  cd "$srcdir/llvm-$pkgver.src"
+
+  make -C build/tools/clang/tools/extra DESTDIR="$pkgdir" install
+
+  # Remove documentation sources
+  rm -r "$pkgdir"/usr/share/doc/clang-tools/html/{_sources,.buildinfo}
+
+  # Use Python 2
+  sed -i 's|/usr/bin/env python|&2|' \
+    "$pkgdir"/usr/share/clang/{clang-tidy-diff,run-clang-tidy,run-find-all-symbols}.py
+
+  install -Dm644 tools/clang/tools/extra/LICENSE.TXT \
+    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+# vim:set ts=2 sw=2 et:

Copied: llvm/repos/staging-x86_64/llvm-config.h (from rev 291753, llvm/trunk/llvm-config.h)
===================================================================
--- staging-x86_64/llvm-config.h	                        (rev 0)
+++ staging-x86_64/llvm-config.h	2017-03-28 13:06:17 UTC (rev 291754)
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif


More information about the arch-commits mailing list