summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/0003-Debian-version-info-and-bugreport.patch19
-rw-r--r--debian/patches/0011-SimplifyCFG-Hoisting-invalidates-metadata.patch84
-rw-r--r--debian/patches/0021-shared-lib-debian.patch26
-rw-r--r--debian/patches/0023-link-libopagent.patch33
-rw-r--r--debian/patches/0044-soname.diff30
-rw-r--r--debian/patches/19-clang_debian_version.patch21
-rw-r--r--debian/patches/23-strlcpy_strlcat_warning_removed.diff195
-rw-r--r--debian/patches/26-set-correct-float-abi.diff33
-rw-r--r--debian/patches/27-fix_clang_stdint.diff29
-rw-r--r--debian/patches/31-powerpcspe.diff15
-rw-r--r--debian/patches/34-powerpc-no-altivec.diff24
-rw-r--r--debian/patches/atomic_library_1.diff46
-rw-r--r--debian/patches/atomic_library_2.diff43
-rw-r--r--debian/patches/bug-30342.diff0
-rw-r--r--debian/patches/clang-analyzer-force-version.diff25
-rw-r--r--debian/patches/clang-apply-replacements.diff35
-rw-r--r--debian/patches/clang-default-to-i686-on-32bit-x86-targets.patch15
-rw-r--r--debian/patches/clang-fix-cmpxchg8-detection-on-i386.patch54
-rw-r--r--debian/patches/clang-format-version.diff39
-rw-r--r--debian/patches/clang-tidy-run-bin.diff17
-rw-r--r--debian/patches/compiler-rt-i586.diff34
-rw-r--r--debian/patches/declare_clear_cache.diff15
-rw-r--r--debian/patches/disable-display-PASS-UNSUPPORTED-XFAIL.diff17
-rw-r--r--debian/patches/disable-error-xray.diff13
-rw-r--r--debian/patches/disable-execinfo-usage.diff13
-rw-r--r--debian/patches/disable-llvm-symbolizer-test.diff26
-rw-r--r--debian/patches/disable-path-test-failing.diff29
-rw-r--r--debian/patches/disable-source-interleave.diff12
-rw-r--r--debian/patches/do-not-fail-on-unexpected-pass.diff13
-rw-r--r--debian/patches/fix-clang-path-and-build.diff24
-rw-r--r--debian/patches/fix-cmake-config-prefix.diff27
-rw-r--r--debian/patches/fix-lldb-server-build73
-rw-r--r--debian/patches/fix-llvm-config-obj-src-root.patch20
-rw-r--r--debian/patches/fix-scan-view-path.diff21
-rw-r--r--debian/patches/follow-parallel-var.diff16
-rw-r--r--debian/patches/force-gcc-header-obj.diff16
-rw-r--r--debian/patches/force-link-pass.o.diff28
-rw-r--r--debian/patches/gcc-7.1-workaround.diff0
-rw-r--r--debian/patches/hurd-EIEIO-undef.diff14
-rw-r--r--debian/patches/hurd-pathmax.diff77
-rw-r--r--debian/patches/install-scan-build-py.diff14
-rw-r--r--debian/patches/lld-arg-cmake-issue.diff141
-rw-r--r--debian/patches/lldb-addversion-suffix-to-llvm-server-exec.patch35
-rw-r--r--debian/patches/lldb-disable-swig-error.diff13
-rw-r--r--debian/patches/lldb-libname.diff15
-rw-r--r--debian/patches/lldb-link-atomic-cmake.patch26
-rw-r--r--debian/patches/lldb-missing-install.diff22
-rw-r--r--debian/patches/lldb-soname.diff43
-rw-r--r--debian/patches/mips-fpxx-enable.diff17
-rw-r--r--debian/patches/pthread-link.diff18
-rw-r--r--debian/patches/python-clangpath.diff15
-rw-r--r--debian/patches/removeduplicatedeclaration.diff40
-rw-r--r--debian/patches/scan-build-clang-path.diff15
-rw-r--r--debian/patches/scan-build-py-default.diff518
-rw-r--r--debian/patches/scan-view-fix-path.diff13
-rw-r--r--debian/patches/series48
-rw-r--r--debian/patches/silent-MCJIIT-tests.diff178
-rw-r--r--debian/patches/silent-amd-tet.diff132
-rw-r--r--debian/patches/silent-amdgpu-test-failing.diff46
-rw-r--r--debian/patches/silent-gold-test.diff26
-rw-r--r--debian/patches/silent-gold-utils.diff190
-rw-r--r--debian/patches/silent-more-tests.diff52
-rw-r--r--debian/patches/silent-test-failing-codeverage.diff13
-rw-r--r--debian/patches/strip-svn.diff0
-rw-r--r--debian/patches/ubuntu-precise-compiler-rt.diff23
-rw-r--r--debian/patches/unwind-chain-inclusion.diff41
66 files changed, 2965 insertions, 0 deletions
diff --git a/debian/patches/0003-Debian-version-info-and-bugreport.patch b/debian/patches/0003-Debian-version-info-and-bugreport.patch
new file mode 100644
index 0000000..6c8a1d5
--- /dev/null
+++ b/debian/patches/0003-Debian-version-info-and-bugreport.patch
@@ -0,0 +1,19 @@
+---
+ lib/Support/CommandLine.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+Index: llvm-toolchain-snapshot_5.0~svn296106/lib/Support/CommandLine.cpp
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn296106.orig/lib/Support/CommandLine.cpp
++++ llvm-toolchain-snapshot_5.0~svn296106/lib/Support/CommandLine.cpp
+@@ -2064,6 +2064,10 @@ public:
+ OS << " " << LLVM_VERSION_INFO;
+ #endif
+ OS << "\n ";
++#ifdef LLVM_DEBIAN_INFO
++ OS << LLVM_DEBIAN_INFO;
++#endif
++ OS << "\n ";
+ #ifndef __OPTIMIZE__
+ OS << "DEBUG build";
+ #else
diff --git a/debian/patches/0011-SimplifyCFG-Hoisting-invalidates-metadata.patch b/debian/patches/0011-SimplifyCFG-Hoisting-invalidates-metadata.patch
new file mode 100644
index 0000000..b184a40
--- /dev/null
+++ b/debian/patches/0011-SimplifyCFG-Hoisting-invalidates-metadata.patch
@@ -0,0 +1,84 @@
+From eee68eafa7e8e4ce996b49f5551636639a6c331a Mon Sep 17 00:00:00 2001
+From: David Majnemer <david.majnemer@gmail.com>
+Date: Mon, 29 Aug 2016 17:14:08 +0000
+Subject: [PATCH 11/17] [SimplifyCFG] Hoisting invalidates metadata
+
+We forgot to remove optimization metadata when performing hosting during
+FoldTwoEntryPHINode.
+
+This fixes PR29163.
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279980 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ lib/Transforms/Utils/SimplifyCFG.cpp | 10 ++++++++--
+ test/Transforms/SimplifyCFG/PR29163.ll | 31 +++++++++++++++++++++++++++++++
+ 2 files changed, 39 insertions(+), 2 deletions(-)
+ create mode 100644 test/Transforms/SimplifyCFG/PR29163.ll
+
+diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
+index 0504646..c197317 100644
+--- a/lib/Transforms/Utils/SimplifyCFG.cpp
++++ b/lib/Transforms/Utils/SimplifyCFG.cpp
+@@ -2024,14 +2024,20 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetTransformInfo &TTI,
+
+ // Move all 'aggressive' instructions, which are defined in the
+ // conditional parts of the if's up to the dominating block.
+- if (IfBlock1)
++ if (IfBlock1) {
++ for (auto &I : *IfBlock1)
++ I.dropUnknownNonDebugMetadata();
+ DomBlock->getInstList().splice(InsertPt->getIterator(),
+ IfBlock1->getInstList(), IfBlock1->begin(),
+ IfBlock1->getTerminator()->getIterator());
+- if (IfBlock2)
++ }
++ if (IfBlock2) {
++ for (auto &I : *IfBlock2)
++ I.dropUnknownNonDebugMetadata();
+ DomBlock->getInstList().splice(InsertPt->getIterator(),
+ IfBlock2->getInstList(), IfBlock2->begin(),
+ IfBlock2->getTerminator()->getIterator());
++ }
+
+ while (PHINode *PN = dyn_cast<PHINode>(BB->begin())) {
+ // Change the PHI node into a select instruction.
+diff --git a/test/Transforms/SimplifyCFG/PR29163.ll b/test/Transforms/SimplifyCFG/PR29163.ll
+new file mode 100644
+index 0000000..65f9090
+--- /dev/null
++++ b/test/Transforms/SimplifyCFG/PR29163.ll
+@@ -0,0 +1,31 @@
++; RUN: opt -S -simplifycfg < %s | FileCheck %s
++target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
++target triple = "x86_64-unknown-linux-gnu"
++
++@GV = external constant i64*
++
++define i64* @test1(i1 %cond, i8* %P) {
++entry:
++ br i1 %cond, label %if, label %then
++
++then:
++ %bc = bitcast i8* %P to i64*
++ br label %join
++
++if:
++ %load = load i64*, i64** @GV, align 8, !dereferenceable !0
++ br label %join
++
++join:
++ %phi = phi i64* [ %bc, %then ], [ %load, %if ]
++ ret i64* %phi
++}
++
++; CHECK-LABEL: define i64* @test1(
++; CHECK: %[[bc:.*]] = bitcast i8* %P to i64*
++; CHECK: %[[load:.*]] = load i64*, i64** @GV, align 8{{$}}
++; CHECK: %[[phi:.*]] = select i1 %cond, i64* %[[load]], i64* %[[bc]]
++; CHECK: ret i64* %[[phi]]
++
++
++!0 = !{i64 8}
+--
+2.10.1
+
diff --git a/debian/patches/0021-shared-lib-debian.patch b/debian/patches/0021-shared-lib-debian.patch
new file mode 100644
index 0000000..b6291fb
--- /dev/null
+++ b/debian/patches/0021-shared-lib-debian.patch
@@ -0,0 +1,26 @@
+Index: llvm-toolchain-snapshot_3.7~svn241915/tools/llvm-shlib/Makefile
+===================================================================
+--- llvm-toolchain-snapshot_3.7~svn241915.orig/tools/llvm-shlib/Makefile
++++ llvm-toolchain-snapshot_3.7~svn241915/tools/llvm-shlib/Makefile
+@@ -41,6 +41,12 @@ LLVMLibsOptions := $(IncludeInLibLlvm:$(
+ LLVMLibsPaths := $(IncludeInLibLlvm)
+
+ $(LibName.SO): $(LLVMLibsPaths)
++ $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
++ $(LIBRARYNAME)$(SHLIBEXT)
++ $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
++ $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
++ mv $(LibName.SO) $(LibName.SO).1
++ ln -s $(notdir $(LibName.SO)).1 $(LibName.SO)
+
+ ifeq ($(HOST_OS),Darwin)
+ # set dylib internal version number to llvmCore submission number
+@@ -61,7 +67,7 @@ endif
+
+ ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux FreeBSD GNU/kFreeBSD GNU))
+ # Add soname to the library.
+- LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT)
++ LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT) -Wl,-Bsymbolic-functions
+ endif
+
+ ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU GNU/kFreeBSD))
diff --git a/debian/patches/0023-link-libopagent.patch b/debian/patches/0023-link-libopagent.patch
new file mode 100644
index 0000000..7a4ac52
--- /dev/null
+++ b/debian/patches/0023-link-libopagent.patch
@@ -0,0 +1,33 @@
+Index: llvm-toolchain-snapshot_3.7~svn241915/configure
+===================================================================
+--- llvm-toolchain-snapshot_3.7~svn241915.orig/configure
++++ llvm-toolchain-snapshot_3.7~svn241915/configure
+@@ -10115,7 +10115,7 @@ if test "${with_oprofile+set}" = set; th
+ case $llvm_cv_os_type in
+ Linux)
+ if test -n "$llvm_cv_oppath" ; then
+- LIBS="$LIBS -lopagent -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}"
++ #LIBS="$LIBS -lopagent -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}"
+ { echo "$as_me:$LINENO: checking for library containing bfd_init" >&5
+ echo $ECHO_N "checking for library containing bfd_init... $ECHO_C" >&6; }
+ if test "${ac_cv_search_bfd_init+set}" = set; then
+@@ -10211,7 +10211,7 @@ fi
+ echo "${ECHO_T}$ac_cv_search_bfd_init" >&6; }
+ ac_res=$ac_cv_search_bfd_init
+ if test "$ac_res" != no; then
+- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
++ test "$ac_res" = "none required" || true
+
+ fi
+
+@@ -10247,8 +10247,8 @@ for ac_lib in '' opagent; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+- ac_res=-l$ac_lib
+- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
++ ac_res="-Wl,--as-needed -l$ac_lib -Wl,--no-as-needed"
++ LIBS="-Wl,--as-needed -l$ac_lib -Wl,--no-as-needed $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { (ac_try="$ac_link"
diff --git a/debian/patches/0044-soname.diff b/debian/patches/0044-soname.diff
new file mode 100644
index 0000000..0cf7616
--- /dev/null
+++ b/debian/patches/0044-soname.diff
@@ -0,0 +1,30 @@
+---
+ clang/tools/libclang/CMakeLists.txt | 2 +-
+ tools/llvm-shlib/CMakeLists.txt | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+Index: llvm-toolchain-snapshot_5.0~svn307684/clang/tools/libclang/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn307684.orig/clang/tools/libclang/CMakeLists.txt
++++ llvm-toolchain-snapshot_5.0~svn307684/clang/tools/libclang/CMakeLists.txt
+@@ -84,7 +84,7 @@ else()
+ set(output_name "clang")
+ endif()
+
+-add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
++add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC} SONAME
+ OUTPUT_NAME ${output_name}
+ ${SOURCES}
+ DEPENDS clang-headers
+Index: llvm-toolchain-snapshot_5.0~svn307684/tools/llvm-shlib/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn307684.orig/tools/llvm-shlib/CMakeLists.txt
++++ llvm-toolchain-snapshot_5.0~svn307684/tools/llvm-shlib/CMakeLists.txt
+@@ -35,6 +35,7 @@ if(LLVM_DYLIB_EXPORTED_SYMBOL_FILE)
+ endif()
+
+ add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES})
++set_property(TARGET LLVM PROPERTY VERSION "1") # Append .1 to SONAME
+
+ list(REMOVE_DUPLICATES LIB_NAMES)
+ if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU) OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")) # FIXME: It should be "GNU ld for elf"
diff --git a/debian/patches/19-clang_debian_version.patch b/debian/patches/19-clang_debian_version.patch
new file mode 100644
index 0000000..c530e14
--- /dev/null
+++ b/debian/patches/19-clang_debian_version.patch
@@ -0,0 +1,21 @@
+Index: llvm-toolchain-snapshot_3.5~svn210337/clang/lib/Basic/Version.cpp
+===================================================================
+--- llvm-toolchain-snapshot_3.5~svn210337.orig/clang/lib/Basic/Version.cpp
++++ llvm-toolchain-snapshot_3.5~svn210337/clang/lib/Basic/Version.cpp
+@@ -15,6 +15,7 @@
+ #include "clang/Basic/LLVM.h"
+ #include "clang/Config/config.h"
+ #include "llvm/Support/raw_ostream.h"
++#include "clang/Debian/debian_path.h"
+ #include <cstdlib>
+ #include <cstring>
+
+@@ -125,7 +126,7 @@ std::string getClangToolFullVersion(Stri
+ #ifdef CLANG_VENDOR
+ OS << CLANG_VENDOR;
+ #endif
+- OS << ToolName << " version " CLANG_VERSION_STRING " "
++ OS << ToolName << " version " CLANG_VERSION_STRING "-" DEB_PATCHSETVERSION " "
+ << getClangFullRepositoryVersion();
+
+ // If vendor supplied, include the base LLVM version as well.
diff --git a/debian/patches/23-strlcpy_strlcat_warning_removed.diff b/debian/patches/23-strlcpy_strlcat_warning_removed.diff
new file mode 100644
index 0000000..235ffd4
--- /dev/null
+++ b/debian/patches/23-strlcpy_strlcat_warning_removed.diff
@@ -0,0 +1,195 @@
+---
+ clang/include/clang/Basic/Builtins.def | 8 +-
+ clang/lib/AST/Decl.cpp | 12 +--
+ clang/lib/Sema/SemaChecking.cpp | 11 +-
+ clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp | 6 -
+ clang/test/Sema/builtins.c | 11 +-
+ clang/test/Sema/warn-strlcpycat-size.c | 55 --------------
+ 6 files changed, 25 insertions(+), 78 deletions(-)
+
+--- a/clang/include/clang/Basic/Builtins.def
++++ b/clang/include/clang/Basic/Builtins.def
+@@ -488,8 +488,8 @@ BUILTIN(__builtin___memset_chk, "v*v*izz
+ BUILTIN(__builtin___stpcpy_chk, "c*c*cC*z", "nF")
+ BUILTIN(__builtin___strcat_chk, "c*c*cC*z", "nF")
+ BUILTIN(__builtin___strcpy_chk, "c*c*cC*z", "nF")
+-BUILTIN(__builtin___strlcat_chk, "zc*cC*zz", "nF")
+-BUILTIN(__builtin___strlcpy_chk, "zc*cC*zz", "nF")
++//BUILTIN(__builtin___strlcat_chk, "zc*cC*zz", "nF")
++//BUILTIN(__builtin___strlcpy_chk, "zc*cC*zz", "nF")
+ BUILTIN(__builtin___strncat_chk, "c*c*cC*zz", "nF")
+ BUILTIN(__builtin___strncpy_chk, "c*c*cC*zz", "nF")
+ BUILTIN(__builtin___stpncpy_chk, "c*c*cC*zz", "nF")
+@@ -874,8 +874,8 @@ LIBBUILTIN(getcontext, "iK*", "fj",
+ LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES)
+ LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES)
+ // non-standard but very common
+-LIBBUILTIN(strlcpy, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
+-LIBBUILTIN(strlcat, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
++//LIBBUILTIN(strlcpy, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
++//LIBBUILTIN(strlcat, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
+ // id objc_msgSend(id, SEL, ...)
+ LIBBUILTIN(objc_msgSend, "GGH.", "f", "objc/message.h", OBJC_LANG)
+ // long double objc_msgSend_fpret(id self, SEL op, ...)
+--- a/clang/lib/AST/Decl.cpp
++++ b/clang/lib/AST/Decl.cpp
+@@ -3455,13 +3455,13 @@ unsigned FunctionDecl::getMemoryFunction
+ case Builtin::BImemmove:
+ return Builtin::BImemmove;
+
+- case Builtin::BIstrlcpy:
+- case Builtin::BI__builtin___strlcpy_chk:
+- return Builtin::BIstrlcpy;
++// case Builtin::BIstrlcpy:
++// case Builtin::BI__builtin___strlcpy_chk:
++// return Builtin::BIstrlcpy;
+
+- case Builtin::BIstrlcat:
+- case Builtin::BI__builtin___strlcat_chk:
+- return Builtin::BIstrlcat;
++// case Builtin::BIstrlcat:
++// case Builtin::BI__builtin___strlcat_chk:
++// return Builtin::BIstrlcat;
+
+ case Builtin::BI__builtin_memcmp:
+ case Builtin::BImemcmp:
+--- a/clang/lib/Sema/SemaChecking.cpp
++++ b/clang/lib/Sema/SemaChecking.cpp
+@@ -975,8 +975,8 @@ Sema::CheckBuiltinFunctionCall(FunctionD
+ case Builtin::BI__builtin___memcpy_chk:
+ case Builtin::BI__builtin___memmove_chk:
+ case Builtin::BI__builtin___memset_chk:
+- case Builtin::BI__builtin___strlcat_chk:
+- case Builtin::BI__builtin___strlcpy_chk:
++// case Builtin::BI__builtin___strlcat_chk:
++// case Builtin::BI__builtin___strlcpy_chk:
+ case Builtin::BI__builtin___strncat_chk:
+ case Builtin::BI__builtin___strncpy_chk:
+ case Builtin::BI__builtin___stpncpy_chk:
+@@ -2512,9 +2512,10 @@ bool Sema::CheckFunctionCall(FunctionDec
+ return false;
+
+ // Handle memory setting and copying functions.
+- if (CMId == Builtin::BIstrlcpy || CMId == Builtin::BIstrlcat)
+- CheckStrlcpycatArguments(TheCall, FnInfo);
+- else if (CMId == Builtin::BIstrncat)
++// if (CMId == Builtin::BIstrlcpy || CMId == Builtin::BIstrlcat)
++// CheckStrlcpycatArguments(TheCall, FnInfo);
++// else
++ if (CMId == Builtin::BIstrncat)
+ CheckStrncatArguments(TheCall, FnInfo);
+ else
+ CheckMemaccessArguments(TheCall, CMId, FnInfo);
+--- a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
++++ b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+@@ -237,9 +237,9 @@ GenericTaintChecker::TaintPropagationRul
+ case Builtin::BIstrncpy:
+ case Builtin::BIstrncat:
+ return TaintPropagationRule(1, 2, 0, true);
+- case Builtin::BIstrlcpy:
+- case Builtin::BIstrlcat:
+- return TaintPropagationRule(1, 2, 0, false);
++// case Builtin::BIstrlcpy:
++// case Builtin::BIstrlcat:
++// return TaintPropagationRule(1, 2, 0, false);
+ case Builtin::BIstrndup:
+ return TaintPropagationRule(0, 1, ReturnValueIndex);
+
+--- a/clang/test/Sema/builtins.c
++++ b/clang/test/Sema/builtins.c
+@@ -190,11 +190,11 @@ void test18() {
+
+ ptr = __builtin___memccpy_chk(dst, src, '\037', sizeof(src), sizeof(dst));
+ result = __builtin___strlcpy_chk(dst, src, sizeof(dst), sizeof(dst));
+- result = __builtin___strlcat_chk(dst, src, sizeof(dst), sizeof(dst));
++// result = __builtin___strlcat_chk(dst, src, sizeof(dst), sizeof(dst));
+
+ ptr = __builtin___memccpy_chk(dst, src, '\037', sizeof(src)); // expected-error {{too few arguments to function call}}
+ ptr = __builtin___strlcpy_chk(dst, src, sizeof(dst), sizeof(dst)); // expected-warning {{incompatible integer to pointer conversion}}
+- ptr = __builtin___strlcat_chk(dst, src, sizeof(dst), sizeof(dst)); // expected-warning {{incompatible integer to pointer conversion}}
++// ptr = __builtin___strlcat_chk(dst, src, sizeof(dst), sizeof(dst)); // expected-warning {{incompatible integer to pointer conversion}}
+ }
+
+ void no_ms_builtins() {
+@@ -209,12 +209,12 @@ void unavailable() {
+ }
+
+ // rdar://18259539
+-size_t strlcpy(char * restrict dst, const char * restrict src, size_t size);
+-size_t strlcat(char * restrict dst, const char * restrict src, size_t size);
++//size_t strlcpy(char * restrict dst, const char * restrict src, size_t size);
++//size_t strlcat(char * restrict dst, const char * restrict src, size_t size);
+
+ void Test19(void)
+ {
+- static char b[40];
++/* static char b[40];
+ static char buf[20];
+
+ strlcpy(buf, b, sizeof(b)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} \\
+@@ -229,6 +229,7 @@ void Test19(void)
+ __builtin___strlcat_chk(buf, b, sizeof(b), __builtin_object_size(buf, 0)); // expected-warning {{size argument in '__builtin___strlcat_chk' call appears to be size of the source; expected the size of the destination}} \
+ // expected-note {{change size argument to be the size of the destination}} \
+ // expected-warning {{'__builtin___strlcat_chk' will always overflow destination buffer}}
++ */
+ }
+
+ // rdar://11076881
+--- a/clang/test/Sema/warn-strlcpycat-size.c
++++ /dev/null
+@@ -1,55 +0,0 @@
+-// RUN: %clang_cc1 -Wstrlcpy-strlcat-size -verify -fsyntax-only %s
+-
+-typedef __SIZE_TYPE__ size_t;
+-size_t strlcpy (char * restrict dst, const char * restrict src, size_t size);
+-size_t strlcat (char * restrict dst, const char * restrict src, size_t size);
+-size_t strlen (const char *s);
+-
+-char s1[100];
+-char s2[200];
+-char * s3;
+-
+-struct {
+- char f1[100];
+- char f2[100][3];
+-} s4, **s5;
+-
+-int x;
+-
+-void f(void)
+-{
+- strlcpy(s1, s2, sizeof(s1)); // no warning
+- strlcpy(s1, s2, sizeof(s2)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}}
+- strlcpy(s1, s3, strlen(s3)+1); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}}
+- strlcat(s2, s3, sizeof(s3)); // expected-warning {{size argument in 'strlcat' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}}
+- strlcpy(s4.f1, s2, sizeof(s2)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}}
+- strlcpy((*s5)->f2[x], s2, sizeof(s2)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}}
+- strlcpy(s1+3, s2, sizeof(s2)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}}
+-}
+-
+-// Don't issue FIXIT for flexible arrays.
+-struct S {
+- int y;
+- char x[];
+-};
+-
+-void flexible_arrays(struct S *s) {
+- char str[] = "hi";
+- strlcpy(s->x, str, sizeof(str)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}}
+-}
+-
+-// Don't issue FIXIT for destinations of size 1.
+-void size_1() {
+- char z[1];
+- char str[] = "hi";
+-
+- strlcpy(z, str, sizeof(str)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}}
+-}
+-
+-// Support VLAs.
+-void vlas(int size) {
+- char z[size];
+- char str[] = "hi";
+-
+- strlcpy(z, str, sizeof(str)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}}
+-}
diff --git a/debian/patches/26-set-correct-float-abi.diff b/debian/patches/26-set-correct-float-abi.diff
new file mode 100644
index 0000000..c7fe931
--- /dev/null
+++ b/debian/patches/26-set-correct-float-abi.diff
@@ -0,0 +1,33 @@
+Description: set correct float abi settings for armel and armhf
+ debian armel supports systems that don't have a fpu so should use a "float abi"
+ setting of soft by default.
+
+ Debian armhf needs a float abi setting of "hard"
+Author: Peter Michael Green <plugwash@debian.org>
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: http://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>
+
+Index: llvm-toolchain-snapshot_5.0~svn297449/clang/lib/Driver/ToolChains/Arch/ARM.cpp
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn297449.orig/clang/lib/Driver/ToolChains/Arch/ARM.cpp
++++ llvm-toolchain-snapshot_5.0~svn297449/clang/lib/Driver/ToolChains/Arch/ARM.cpp
+@@ -206,7 +206,7 @@ arm::FloatABI arm::getARMFloatABI(const
+ case llvm::Triple::MuslEABI:
+ case llvm::Triple::EABI:
+ // EABI is always AAPCS, and if it was not marked 'hard', it's softfp
+- ABI = FloatABI::SoftFP;
++ ABI = FloatABI::Soft;
+ break;
+ case llvm::Triple::Android:
+ ABI = (SubArch == 7) ? FloatABI::SoftFP : FloatABI::Soft;
diff --git a/debian/patches/27-fix_clang_stdint.diff b/debian/patches/27-fix_clang_stdint.diff
new file mode 100644
index 0000000..f1c751f
--- /dev/null
+++ b/debian/patches/27-fix_clang_stdint.diff
@@ -0,0 +1,29 @@
+Index: llvm-toolchain-snapshot_5.0~svn301630/clang/lib/Headers/stdint.h
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn301630.orig/clang/lib/Headers/stdint.h
++++ llvm-toolchain-snapshot_5.0~svn301630/clang/lib/Headers/stdint.h
+@@ -22,8 +22,6 @@
+ *
+ \*===----------------------------------------------------------------------===*/
+
+-#ifndef __CLANG_STDINT_H
+-#define __CLANG_STDINT_H
+
+ /* If we're hosted, fall back to the system's stdint.h, which might have
+ * additional definitions.
+@@ -72,6 +70,8 @@
+ # endif
+
+ #else
++#ifndef __CLANG_STDINT_H
++#define __CLANG_STDINT_H
+
+ /* C99 7.18.1.1 Exact-width integer types.
+ * C99 7.18.1.2 Minimum-width integer types.
+@@ -700,5 +700,5 @@ typedef __UINTMAX_TYPE__ uintmax_t;
+ #define INTMAX_C(v) __int_c(v, __INTMAX_C_SUFFIX__)
+ #define UINTMAX_C(v) __int_c(v, __UINTMAX_C_SUFFIX__)
+
+-#endif /* __STDC_HOSTED__ */
+ #endif /* __CLANG_STDINT_H */
++#endif /* __STDC_HOSTED__ */
diff --git a/debian/patches/31-powerpcspe.diff b/debian/patches/31-powerpcspe.diff
new file mode 100644
index 0000000..8eacce7
--- /dev/null
+++ b/debian/patches/31-powerpcspe.diff
@@ -0,0 +1,15 @@
+Index: llvm-toolchain-snapshot_3.4~svn188990/clang/lib/Lex/Makefile
+===================================================================
+--- llvm-toolchain-snapshot_3.4~svn188990.orig/clang/lib/Lex/Makefile 2013-08-22 09:07:43.368608381 +0200
++++ llvm-toolchain-snapshot_3.4~svn188990/clang/lib/Lex/Makefile 2013-08-22 09:07:43.368608381 +0200
+@@ -17,8 +17,10 @@
+ LIBRARYNAME := clangLex
+
+ ifeq ($(ARCH),PowerPC)
++ifneq ($(shell dpkg-architecture -qDEB_HOST_ARCH),powerpcspe)
+ CXX.Flags += -maltivec
+ endif
++endif
+
+ include $(CLANG_LEVEL)/Makefile
+
diff --git a/debian/patches/34-powerpc-no-altivec.diff b/debian/patches/34-powerpc-no-altivec.diff
new file mode 100644
index 0000000..5f05828
--- /dev/null
+++ b/debian/patches/34-powerpc-no-altivec.diff
@@ -0,0 +1,24 @@
+Description: Make sure PowerPC doesn't default to altivec on
+Author: Adam Conrad <adconrad@ubuntu.com>
+Author: Peter Michael Green <plugwash@debian.org>
+Forwarded: no
+Reviewed-By: Colin Watson <cjwatson@ubuntu.com>
+
+Last-Update: 2013-04-01
+
+Index: llvm-toolchain-snapshot_3.4~svn188990/clang/lib/Lex/Makefile
+===================================================================
+--- llvm-toolchain-snapshot_3.4~svn188990.orig/clang/lib/Lex/Makefile 2013-08-22 09:11:26.616602695 +0200
++++ llvm-toolchain-snapshot_3.4~svn188990/clang/lib/Lex/Makefile 2013-08-22 09:11:26.616602695 +0200
+@@ -16,11 +16,5 @@
+
+ LIBRARYNAME := clangLex
+
+-ifeq ($(ARCH),PowerPC)
+-ifneq ($(shell dpkg-architecture -qDEB_HOST_ARCH),powerpcspe)
+-CXX.Flags += -maltivec
+-endif
+-endif
+-
+ include $(CLANG_LEVEL)/Makefile
+
diff --git a/debian/patches/atomic_library_1.diff b/debian/patches/atomic_library_1.diff
new file mode 100644
index 0000000..b73581d
--- /dev/null
+++ b/debian/patches/atomic_library_1.diff
@@ -0,0 +1,46 @@
+---
+ clang/lib/Basic/Targets.cpp | 14 ++++++++++++++
+ clang/test/CodeGen/linux-arm-atomic.c | 10 ++++++++++
+ 2 files changed, 24 insertions(+)
+
+--- a/clang/lib/Basic/Targets.cpp
++++ b/clang/lib/Basic/Targets.cpp
+@@ -4414,6 +4414,20 @@ protected:
+ Builder.defineMacro("__ELF__");
+ }
+
++ static bool shouldUseInlineAtomic(const llvm::Triple &T) {
++ // On linux, binaries targeting old cpus call functions in libgcc to
++ // perform atomic operations. The implementation in libgcc then calls into
++ // the kernel which on armv6 and newer uses ldrex and strex. The net result
++ // is that if we assume the kernel is at least as recent as the hardware,
++ // it is safe to use atomic instructions on armv6 and newer.
++ if (T.getOS() != llvm::Triple::Linux)
++ return false;
++ StringRef ArchName = T.getArchName();
++ if (ArchName.startswith("armv6") || ArchName.startswith("armv7"))
++ return true;
++ return false;
++ }
++
+ public:
+ RTEMSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
+ : OSTargetInfo<Target>(Triple, Opts) {
+--- a/clang/test/CodeGen/linux-arm-atomic.c
++++ b/clang/test/CodeGen/linux-arm-atomic.c
+@@ -1,5 +1,15 @@
+ // RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv7-unknown-linux | FileCheck %s
+ // RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv6-unknown-linux | FileCheck %s
++
++typedef int _Atomic_word;
++_Atomic_word exchange_and_add(volatile _Atomic_word *__mem, int __val) {
++ return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL);
++}
++
++// CHECK: define {{.*}} @exchange_and_add
++// CHECK: atomicrmw {{.*}} add
++// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv7-unknown-linux | FileCheck %s
++// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv6-unknown-linux | FileCheck %s
+ // RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-unknown-linux | FileCheck %s
+ // RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv6-unknown-freebsd | FileCheck %s
+ // RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv6-unknown-bitrig | FileCheck %s
diff --git a/debian/patches/atomic_library_2.diff b/debian/patches/atomic_library_2.diff
new file mode 100644
index 0000000..e388350
--- /dev/null
+++ b/debian/patches/atomic_library_2.diff
@@ -0,0 +1,43 @@
+---
+ clang/lib/Basic/Targets.cpp | 20 +++++++++++++++++---
+ clang/test/CodeGen/linux-arm-atomic.c | 1 +
+ 2 files changed, 18 insertions(+), 3 deletions(-)
+
+--- a/clang/lib/Basic/Targets.cpp
++++ b/clang/lib/Basic/Targets.cpp
+@@ -4423,9 +4423,23 @@ protected:
+ if (T.getOS() != llvm::Triple::Linux)
+ return false;
+ StringRef ArchName = T.getArchName();
+- if (ArchName.startswith("armv6") || ArchName.startswith("armv7"))
+- return true;
+- return false;
++ if (T.getArch() == llvm::Triple::arm) {
++ if (!ArchName.startswith("armv"))
++ return false;
++ StringRef VersionStr = ArchName.substr(4);
++ unsigned Version;
++ if (VersionStr.getAsInteger(10, Version))
++ return false;
++ return Version >= 6;
++ }
++ assert(T.getArch() == llvm::Triple::thumb);
++ if (!ArchName.startswith("thumbv"))
++ return false;
++ StringRef VersionStr = ArchName.substr(6);
++ unsigned Version;
++ if (VersionStr.getAsInteger(10, Version))
++ return false;
++ return Version >= 7;
+ }
+
+ public:
+--- a/clang/test/CodeGen/linux-arm-atomic.c
++++ b/clang/test/CodeGen/linux-arm-atomic.c
+@@ -1,5 +1,6 @@
+ // RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv7-unknown-linux | FileCheck %s
+ // RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv6-unknown-linux | FileCheck %s
++// RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-unknown-linux | FileCheck %s
+
+ typedef int _Atomic_word;
+ _Atomic_word exchange_and_add(volatile _Atomic_word *__mem, int __val) {
diff --git a/debian/patches/bug-30342.diff b/debian/patches/bug-30342.diff
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/debian/patches/bug-30342.diff
diff --git a/debian/patches/clang-analyzer-force-version.diff b/debian/patches/clang-analyzer-force-version.diff
new file mode 100644
index 0000000..c1d682a
--- /dev/null
+++ b/debian/patches/clang-analyzer-force-version.diff
@@ -0,0 +1,25 @@
+# Force the version of clang in the analyzer
+# This was causing the static analyzer to fail silently if the clang & clang++ are
+# not installed
+Index: llvm-toolchain-snapshot_5.0~svn255.06/clang/tools/scan-build/libexec/ccc-analyzer
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn255.06.orig/clang/tools/scan-build/libexec/ccc-analyzer
++++ llvm-toolchain-snapshot_5.0~svn255.06/clang/tools/scan-build/libexec/ccc-analyzer
+@@ -91,7 +91,7 @@ if ($FindBin::Script =~ /c\+\+-analyzer/
+ if (!defined $Compiler || (! -x $Compiler && ! SearchInPath($Compiler))) { $Compiler = $DefaultCXXCompiler; }
+
+ $Clang = $ENV{'CLANG_CXX'};
+- if (!defined $Clang || ! -x $Clang) { $Clang = 'clang++'; }
++ if (!defined $Clang || ! -x $Clang) { $Clang = 'clang++-5.0'; }
+
+ $IsCXX = 1
+ }
+@@ -100,7 +100,7 @@ else {
+ if (!defined $Compiler || (! -x $Compiler && ! SearchInPath($Compiler))) { $Compiler = $DefaultCCompiler; }
+
+ $Clang = $ENV{'CLANG'};
+- if (!defined $Clang || ! -x $Clang) { $Clang = 'clang'; }
++ if (!defined $Clang || ! -x $Clang) { $Clang = 'clang-5.0'; }
+
+ $IsCXX = 0
+ }
diff --git a/debian/patches/clang-apply-replacements.diff b/debian/patches/clang-apply-replacements.diff
new file mode 100644
index 0000000..f66f025
--- /dev/null
+++ b/debian/patches/clang-apply-replacements.diff
@@ -0,0 +1,35 @@
+Index: llvm-toolchain-3.7-3.7/clang-tools-extra/clang-modernize/Core/ReplacementHandling.cpp
+===================================================================
+--- llvm-toolchain-3.7-3.7.orig/clang-tools-extra/clang-modernize/Core/ReplacementHandling.cpp
++++ llvm-toolchain-3.7-3.7/clang-tools-extra/clang-modernize/Core/ReplacementHandling.cpp
+@@ -26,7 +26,7 @@ using namespace clang::tooling;
+
+ bool ReplacementHandling::findClangApplyReplacements(const char *Argv0) {
+ ErrorOr<std::string> CARPathOrErr =
+- findProgramByName("clang-apply-replacements");
++ findProgramByName("clang-apply-replacements-5.0");
+ if (!CARPathOrErr)
+ return true;
+
+@@ -34,7 +34,7 @@ bool ReplacementHandling::findClangApply
+ static int StaticSymbol;
+ std::string ClangModernizePath = fs::getMainExecutable(Argv0, &StaticSymbol);
+ SmallString<128> TestPath = path::parent_path(ClangModernizePath);
+- path::append(TestPath, "clang-apply-replacements");
++ path::append(TestPath, "clang-apply-replacements-5.0");
+ if (fs::can_execute(Twine(TestPath)))
+ CARPath = TestPath.str();
+
+Index: llvm-toolchain-3.7-3.7/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+===================================================================
+--- llvm-toolchain-3.7-3.7.orig/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
++++ llvm-toolchain-3.7-3.7/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+@@ -111,7 +111,7 @@ def main():
+ default='clang-tidy',
+ help='path to clang-tidy binary')
+ parser.add_argument('-clang-apply-replacements-binary', metavar='PATH',
+- default='clang-apply-replacements',
++ default='clang-apply-replacements-5.0',
+ help='path to clang-apply-replacements binary')
+ parser.add_argument('-checks', default=None,
+ help='checks filter, when not specified, use clang-tidy '
diff --git a/debian/patches/clang-default-to-i686-on-32bit-x86-targets.patch b/debian/patches/clang-default-to-i686-on-32bit-x86-targets.patch
new file mode 100644
index 0000000..5df4296
--- /dev/null
+++ b/debian/patches/clang-default-to-i686-on-32bit-x86-targets.patch
@@ -0,0 +1,15 @@
+Set i386 default target CPU to be i686 (same as gcc)
+
+Closes: #812803
+Index: llvm-toolchain-3.9-3.9/clang/lib/Driver/Tools.cpp
+===================================================================
+--- llvm-toolchain-3.9-3.9.orig/clang/lib/Driver/Tools.cpp
++++ llvm-toolchain-3.9-3.9/clang/lib/Driver/Tools.cpp
+@@ -1898,6 +1898,7 @@ static const char *getX86TargetCPU(const
+ case llvm::Triple::Haiku:
+ return "i586";
+ case llvm::Triple::Bitrig:
++ case llvm::Triple::Linux:
+ return "i686";
+ default:
+ // Fallback to p4.
diff --git a/debian/patches/clang-fix-cmpxchg8-detection-on-i386.patch b/debian/patches/clang-fix-cmpxchg8-detection-on-i386.patch
new file mode 100644
index 0000000..868e76a
--- /dev/null
+++ b/debian/patches/clang-fix-cmpxchg8-detection-on-i386.patch
@@ -0,0 +1,54 @@
+libcxx atomic tests for old i386 fail with wrong Atomic inline width.
+cmpxchg8b instruction is required for 8 byte atomics that clang was
+assuming.
+
+Too bad _GCC_ATOMIC_LLONG_LOCK_FREE 2 isn't supported even with this change
+because llvm doesn't support unaligned atomic compare and exchange operation.
+Fallback calls to libatomic.so should handle long long lock free but clang
+can't tell program if libatomic is always lock free.
+
+Related bug: https://llvm.org/bugs/show_bug.cgi?id=19355
+
+Index: llvm-toolchain-snapshot_5.0~svn304075/clang/lib/Basic/Targets.cpp
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn304075.orig/clang/lib/Basic/Targets.cpp
++++ llvm-toolchain-snapshot_5.0~svn304075/clang/lib/Basic/Targets.cpp
+@@ -2913,7 +2913,10 @@ class X86TargetInfo : public TargetInfo
+ FP_SSE,
+ FP_387
+ } FPMath = FP_Default;
+-
++protected:
++ bool isCmpXChg8Supported() const {
++ return CPU >= CK_i586;
++ }
+ public:
+ X86TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
+ : TargetInfo(Triple) {
+@@ -3034,6 +3037,8 @@ public:
+ // acceptable.
+ // FIXME: This results in terrible diagnostics. Clang just says the CPU is
+ // invalid without explaining *why*.
++ if (!isCmpXChg8Supported())
++ MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+ switch (CPU) {
+ case CK_Generic:
+ // No processor selected!
+@@ -4163,7 +4168,7 @@ void X86TargetInfo::getTargetDefines(con
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
+ }
+- if (CPU >= CK_i586)
++ if (isCmpXChg8Supported())
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
+
+ if (HasFloat128)
+@@ -4469,8 +4474,6 @@ public:
+ (1 << TargetInfo::LongDouble));
+
+ // x86-32 has atomics up to 8 bytes
+- // FIXME: Check that we actually have cmpxchg8b before setting
+- // MaxAtomicInlineWidth. (cmpxchg8b is an i586 instruction.)
+ MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
+ }
+ BuiltinVaListKind getBuiltinVaListKind() const override {
diff --git a/debian/patches/clang-format-version.diff b/debian/patches/clang-format-version.diff
new file mode 100644
index 0000000..f8e1619
--- /dev/null
+++ b/debian/patches/clang-format-version.diff
@@ -0,0 +1,39 @@
+---
+ clang/tools/clang-format/clang-format-diff.py | 2 +-
+ clang/tools/clang-format/clang-format.el | 2 +-
+ clang/tools/clang-format/clang-format.py | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+--- a/clang/tools/clang-format/clang-format-diff.py
++++ b/clang/tools/clang-format/clang-format-diff.py
+@@ -55,7 +55,7 @@ def main():
+ parser.add_argument('-style',
+ help='formatting style to apply (LLVM, Google, Chromium, '
+ 'Mozilla, WebKit)')
+- parser.add_argument('-binary', default='clang-format',
++ parser.add_argument('-binary', default='clang-format-5.0',
+ help='location of binary to use for clang-format')
+ args = parser.parse_args()
+
+--- a/clang/tools/clang-format/clang-format.el
++++ b/clang/tools/clang-format/clang-format.el
+@@ -36,7 +36,7 @@
+ :group 'tools)
+
+ (defcustom clang-format-executable
+- (or (executable-find "clang-format")
++ (or (executable-find "clang-format-5.0")
+ "clang-format")
+ "Location of the clang-format executable.
+
+--- a/clang/tools/clang-format/clang-format.py
++++ b/clang/tools/clang-format/clang-format.py
+@@ -35,7 +35,7 @@ import vim
+
+ # set g:clang_format_path to the path to clang-format if it is not on the path
+ # Change this to the full path if clang-format is not on the path.
+-binary = 'clang-format'
++binary = 'clang-format-5.0'
+ if vim.eval('exists("g:clang_format_path")') == "1":
+ binary = vim.eval('g:clang_format_path')
+
diff --git a/debian/patches/clang-tidy-run-bin.diff b/debian/patches/clang-tidy-run-bin.diff
new file mode 100644
index 0000000..3e21b5b
--- /dev/null
+++ b/debian/patches/clang-tidy-run-bin.diff
@@ -0,0 +1,17 @@
+Index: llvm-toolchain-3.8-3.8.1/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+===================================================================
+--- llvm-toolchain-3.8-3.8.1.orig/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
++++ llvm-toolchain-3.8-3.8.1/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+@@ -108,10 +108,10 @@ def main():
+ 'clang-tidy and clang-apply-replacements in '
+ '$PATH.')
+ parser.add_argument('-clang-tidy-binary', metavar='PATH',
+- default='clang-tidy',
++ default='clang-tidy-5.0',
+ help='path to clang-tidy binary')
+ parser.add_argument('-clang-apply-replacements-binary', metavar='PATH',
+- default='clang-apply-replacements',
++ default='clang-apply-replacements-5.0',
+ help='path to clang-apply-replacements binary')
+ parser.add_argument('-checks', default=None,
+ help='checks filter, when not specified, use clang-tidy '
diff --git a/debian/patches/compiler-rt-i586.diff b/debian/patches/compiler-rt-i586.diff
new file mode 100644
index 0000000..d2c754a
--- /dev/null
+++ b/debian/patches/compiler-rt-i586.diff
@@ -0,0 +1,34 @@
+Index: llvm-toolchain-snapshot-3.8~svn249990/compiler-rt/make/platform/clang_linux.mk
+===================================================================
+--- llvm-toolchain-snapshot-3.8~svn249990.orig/compiler-rt/make/platform/clang_linux.mk
++++ llvm-toolchain-snapshot-3.8~svn249990/compiler-rt/make/platform/clang_linux.mk
+@@ -21,7 +21,7 @@ ifneq ($(findstring -linux-,$(CompilerTa
+
+ # Define configs only if arch in triple is i386 or x86_64
+ CompilerTargetArch := $(firstword $(subst -, ,$(CompilerTargetTriple)))
+-ifeq ($(call contains,i386 x86_64,$(CompilerTargetArch)),true)
++ifeq ($(call contains,i386 x86_64 i586 i686,$(CompilerTargetArch)),true)
+
+ # TryCompile compiler source flags
+ # Returns exit code of running a compiler invocation.
+@@ -35,7 +35,7 @@ TryCompile = \
+ echo $$?)
+
+ test_source = $(ProjSrcRoot)/make/platform/clang_linux_test_input.c
+-ifeq ($(CompilerTargetArch),i386)
++ifneq (,$(filter $(CompilerTargetArch),i386 i586 i686))
+ SupportedArches := i386
+ ifeq ($(call TryCompile,$(CC),$(test_source),-m64),0)
+ SupportedArches += x86_64
+Index: llvm-toolchain-snapshot-3.8~svn249990/clang/runtime/compiler-rt/Makefile
+===================================================================
+--- llvm-toolchain-snapshot-3.8~svn249990.orig/clang/runtime/compiler-rt/Makefile
++++ llvm-toolchain-snapshot-3.8~svn249990/clang/runtime/compiler-rt/Makefile
+@@ -161,6 +161,7 @@ BuildRuntimeLibraries:
+ ProjSrcRoot=$(COMPILERRT_SRC_ROOT) \
+ ProjObjRoot=$(PROJ_OBJ_DIR) \
+ CC="$(ToolDir)/clang" \
++ LD_LIBRARY_PATH=../build-llvm/Release/lib \
+ VERBOSE=$(VERBOSE) \
+ $(RuntimeDirs:%=clang_%)
+ .PHONY: BuildRuntimeLibraries
diff --git a/debian/patches/declare_clear_cache.diff b/debian/patches/declare_clear_cache.diff
new file mode 100644
index 0000000..9c559b0
--- /dev/null
+++ b/debian/patches/declare_clear_cache.diff
@@ -0,0 +1,15 @@
+---
+ lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -319,7 +319,7 @@ void Memory::InvalidateInstructionCache(
+ // FIXME: Can we safely always call this for __GNUC__ everywhere?
+ const char *Start = static_cast<const char *>(Addr);
+ const char *End = Start + Len;
+- __clear_cache(const_cast<char *>(Start), const_cast<char *>(End));
++ __builtin___clear_cache(const_cast<char *>(Start), const_cast<char *>(End));
+ # endif
+
+ #endif // end apple
diff --git a/debian/patches/disable-display-PASS-UNSUPPORTED-XFAIL.diff b/debian/patches/disable-display-PASS-UNSUPPORTED-XFAIL.diff
new file mode 100644
index 0000000..cde5326
--- /dev/null
+++ b/debian/patches/disable-display-PASS-UNSUPPORTED-XFAIL.diff
@@ -0,0 +1,17 @@
+Index: llvm-toolchain-snapshot_4.0~svn280802/lldb/third_party/Python/module/unittest2/unittest2/runner.py
+===================================================================
+--- llvm-toolchain-snapshot_4.0~svn280802.orig/lldb/third_party/Python/module/unittest2/unittest2/runner.py
++++ llvm-toolchain-snapshot_4.0~svn280802/lldb/third_party/Python/module/unittest2/unittest2/runner.py
+@@ -174,9 +174,9 @@ class TextTestRunner(unittest.TextTestRu
+ if hasattr(result, 'separator2'):
+ self.stream.writeln(result.separator2)
+ run = result.testsRun
+- self.stream.writeln("Ran %d test%s in %.3fs" %
+- (run, run != 1 and "s" or "", timeTaken))
+- self.stream.writeln()
++# self.stream.writeln("Ran %d test%s in %.3fs" %
++# (run, run != 1 and "s" or "", timeTaken))
++# self.stream.writeln()
+
+ expectedFails = unexpectedSuccesses = skipped = passed = failed = errored = 0
+ try:
diff --git a/debian/patches/disable-error-xray.diff b/debian/patches/disable-error-xray.diff
new file mode 100644
index 0000000..2b77cf8
--- /dev/null
+++ b/debian/patches/disable-error-xray.diff
@@ -0,0 +1,13 @@
+Index: llvm-toolchain-snapshot_5.0~svn300419/compiler-rt/lib/xray/xray_tsc.h
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn300419.orig/compiler-rt/lib/xray/xray_tsc.h
++++ llvm-toolchain-snapshot_5.0~svn300419/compiler-rt/lib/xray/xray_tsc.h
+@@ -61,8 +61,6 @@ inline uint64_t getTSCFrequency() XRAY_N
+
+ } // namespace __xray
+
+-#else
+-#error Target architecture is not supported.
+ #endif // CPU architecture
+
+ #endif // XRAY_EMULATE_TSC_H
diff --git a/debian/patches/disable-execinfo-usage.diff b/debian/patches/disable-execinfo-usage.diff
new file mode 100644
index 0000000..e9d5bec
--- /dev/null
+++ b/debian/patches/disable-execinfo-usage.diff
@@ -0,0 +1,13 @@
+Index: llvm-toolchain-snapshot_3.8~svn253186/lldb/lib/Makefile
+===================================================================
+--- llvm-toolchain-snapshot_3.8~svn253186.orig/lldb/lib/Makefile
++++ llvm-toolchain-snapshot_3.8~svn253186/lldb/lib/Makefile
+@@ -201,7 +201,7 @@ ifeq ($(HOST_OS),FreeBSD)
+ # Allow unresolved symbols.
+ LLVMLibsOptions += -Wl,--allow-shlib-undefined
+ # Link in python
+- LLVMLibsOptions += $(PYTHON_BUILD_FLAGS) -lrt -L/usr/local/lib -lexecinfo \
++ LLVMLibsOptions += $(PYTHON_BUILD_FLAGS) -lrt \
+ -ledit -lncurses -lpanel -lpthread
+ endif
+
diff --git a/debian/patches/disable-llvm-symbolizer-test.diff b/debian/patches/disable-llvm-symbolizer-test.diff
new file mode 100644
index 0000000..f949169
--- /dev/null
+++ b/debian/patches/disable-llvm-symbolizer-test.diff
@@ -0,0 +1,26 @@
+Description: Silent a test failing on yakkety amd64
+ /tmp/buildd/llvm-toolchain-snapshot-4.0~svn279801/test/tools/llvm-symbolizer/print_context.c:16:11: error: expected string not found in input
+ // CHECK: inc
+ ^
+ <stdin>:1:1: note: scanning from here
+ _fini
+ ^
+ <stdin>:1:3: note: possible intended match here
+ _fini
+ ^
+Author: Sylvestre <sylvestre@debian.org>
+Last-Update: 2016-08-26
+
+Index: llvm-toolchain-3.9-3.9~+rc1/test/tools/llvm-symbolizer/print_context.c
+===================================================================
+--- llvm-toolchain-3.9-3.9~+rc1.orig/test/tools/llvm-symbolizer/print_context.c
++++ llvm-toolchain-3.9-3.9~+rc1/test/tools/llvm-symbolizer/print_context.c
+@@ -1,7 +1,7 @@
+ // REQUIRES: x86_64-linux
+ // RUN: %host_cc -O0 -g %s -o %t 2>&1
+ // RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s
+-
++// XFAIL: *
+ #include <stdio.h>
+
+ int inc(int a) {
diff --git a/debian/patches/disable-path-test-failing.diff b/debian/patches/disable-path-test-failing.diff
new file mode 100644
index 0000000..d239a12
--- /dev/null
+++ b/debian/patches/disable-path-test-failing.diff
@@ -0,0 +1,29 @@
+Index: llvm-toolchain-snapshot_5.0~svn298832/unittests/Support/Path.cpp
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn298832.orig/unittests/Support/Path.cpp
++++ llvm-toolchain-snapshot_5.0~svn298832/unittests/Support/Path.cpp
+@@ -472,7 +472,7 @@ protected:
+ errs().flush();
+ }
+
+- void TearDown() override { ASSERT_NO_ERROR(fs::remove(TestDirectory.str())); }
++// void TearDown() override { ASSERT_NO_ERROR(fs::remove(TestDirectory.str())); }
+ };
+
+ TEST_F(FileSystemTest, Unique) {
+@@ -552,13 +552,13 @@ TEST_F(FileSystemTest, RealPath) {
+
+ SmallString<64> HomeDir;
+ bool Result = llvm::sys::path::home_directory(HomeDir);
+- if (Result) {
++/* if (Result) {
+ ASSERT_NO_ERROR(fs::real_path(HomeDir, Expected));
+ ASSERT_NO_ERROR(fs::real_path("~", Actual, true));
+ EXPECT_EQ(Expected, Actual);
+ ASSERT_NO_ERROR(fs::real_path("~/", Actual, true));
+ EXPECT_EQ(Expected, Actual);
+- }
++ }*/
+
+ ASSERT_NO_ERROR(fs::remove_directories(Twine(TestDirectory) + "/test1"));
+ }
diff --git a/debian/patches/disable-source-interleave.diff b/debian/patches/disable-source-interleave.diff
new file mode 100644
index 0000000..929098e
--- /dev/null
+++ b/debian/patches/disable-source-interleave.diff
@@ -0,0 +1,12 @@
+Index: llvm-toolchain-snapshot_4.0~svn290969/test/tools/llvm-objdump/X86/source-interleave-x86_64.ll
+===================================================================
+--- llvm-toolchain-snapshot_4.0~svn290969.orig/test/tools/llvm-objdump/X86/source-interleave-x86_64.ll
++++ llvm-toolchain-snapshot_4.0~svn290969/test/tools/llvm-objdump/X86/source-interleave-x86_64.ll
+@@ -4,6 +4,7 @@
+ ; RUN: llvm-objdump -d -l %t.o | FileCheck --check-prefix="LINES" %t.ll
+ ; RUN: llvm-objdump -d -S %t.o | FileCheck --check-prefix="SOURCE" %t.ll
+ ; ModuleID = 'source-interleave-x86_64.bc'
++; XFAIL: *
+ source_filename = "source-interleave-x86_64.c"
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
diff --git a/debian/patches/do-not-fail-on-unexpected-pass.diff b/debian/patches/do-not-fail-on-unexpected-pass.diff
new file mode 100644
index 0000000..f9b8fab
--- /dev/null
+++ b/debian/patches/do-not-fail-on-unexpected-pass.diff
@@ -0,0 +1,13 @@
+Index: llvm-toolchain-snapshot_3.9~svn268880/utils/lit/lit/Test.py
+===================================================================
+--- llvm-toolchain-snapshot_3.9~svn268880.orig/utils/lit/lit/Test.py
++++ llvm-toolchain-snapshot_3.9~svn268880/utils/lit/lit/Test.py
+@@ -30,7 +30,7 @@ PASS = ResultCode('PASS', False)
+ FLAKYPASS = ResultCode('FLAKYPASS', False)
+ XFAIL = ResultCode('XFAIL', False)
+ FAIL = ResultCode('FAIL', True)
+-XPASS = ResultCode('XPASS', True)
++XPASS = ResultCode('XPASS', False)
+ UNRESOLVED = ResultCode('UNRESOLVED', True)
+ UNSUPPORTED = ResultCode('UNSUPPORTED', False)
+ TIMEOUT = ResultCode('TIMEOUT', True)
diff --git a/debian/patches/fix-clang-path-and-build.diff b/debian/patches/fix-clang-path-and-build.diff
new file mode 100644
index 0000000..1b47f0e
--- /dev/null
+++ b/debian/patches/fix-clang-path-and-build.diff
@@ -0,0 +1,24 @@
+---
+ clang/lib/Driver/ToolChains.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+Index: llvm-toolchain-5.0-5.0~+rc2/clang/lib/Driver/ToolChains/Gnu.cpp
+===================================================================
+--- llvm-toolchain-5.0-5.0~+rc2.orig/clang/lib/Driver/ToolChains/Gnu.cpp
++++ llvm-toolchain-5.0-5.0~+rc2/clang/lib/Driver/ToolChains/Gnu.cpp
+@@ -15,6 +15,7 @@
+ #include "Arch/SystemZ.h"
+ #include "CommonArgs.h"
+ #include "clang/Basic/VirtualFileSystem.h"
++#include "clang/Basic/Version.h"
+ #include "clang/Config/config.h" // for GCC_INSTALL_PREFIX
+ #include "clang/Driver/Compilation.h"
+ #include "clang/Driver/Driver.h"
+@@ -2368,6 +2369,7 @@ void Generic_GCC::AddClangCXXStdlibInclu
+ addLibStdCxxIncludePaths(DriverArgs, CC1Args);
+ break;
+ }
++ addSystemInclude(DriverArgs, CC1Args, "/usr/include/clang/" + std::string(CLANG_VERSION_STRING) + "/include/");
+ }
+
+ std::string Generic_GCC::findLibCxxIncludePath() const {
diff --git a/debian/patches/fix-cmake-config-prefix.diff b/debian/patches/fix-cmake-config-prefix.diff
new file mode 100644
index 0000000..2587d10
--- /dev/null
+++ b/debian/patches/fix-cmake-config-prefix.diff
@@ -0,0 +1,27 @@
+## Description: add some description
+## Origin/Author: add some origin or author
+## Bug: bug URL
+---
+# cmake/modules/CMakeLists.txt | 11 +----------
+# 1 file changed, 1 insertion(+), 10 deletions(-)
+#
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -74,16 +74,7 @@ file(COPY .
+ )
+
+ # Generate LLVMConfig.cmake for the install tree.
+-set(LLVM_CONFIG_CODE "
+-# Compute the installation prefix from this LLVMConfig.cmake file location.
+-get_filename_component(LLVM_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
+-# Construct the proper number of get_filename_component(... PATH)
+-# calls to compute the installation prefix.
+-string(REGEX REPLACE "/" ";" _count "${LLVM_INSTALL_PACKAGE_DIR}")
+-foreach(p ${_count})
+- set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
+-get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
+-endforeach(p)
++set(LLVM_CONFIG_CODE "set(LLVM_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\")")
+ set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
+ set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
diff --git a/debian/patches/fix-lldb-server-build b/debian/patches/fix-lldb-server-build
new file mode 100644
index 0000000..c9f92d4
--- /dev/null
+++ b/debian/patches/fix-lldb-server-build
@@ -0,0 +1,73 @@
+---
+ cmake/modules/AddLLVM.cmake | 2 -
+ polly/lib/CMakeLists.txt | 47 +++++++++++++++++---------------------------
+ 2 files changed, 20 insertions(+), 29 deletions(-)
+
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -501,7 +501,7 @@ function(llvm_add_library name)
+ # On DLL platforms symbols are imported from the tool by linking against it.
+ set(llvm_libs ${ARG_PLUGIN_TOOL})
+ elseif (DEFINED LLVM_LINK_COMPONENTS OR DEFINED ARG_LINK_COMPONENTS)
+- if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
++ if (NOT ARG_STATIC AND LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
+ set(llvm_libs LLVM)
+ else()
+ llvm_map_components_to_libnames(llvm_libs
+--- a/polly/lib/CMakeLists.txt
++++ b/polly/lib/CMakeLists.txt
+@@ -66,35 +66,26 @@ endif (GPU_CODEGEN)
+
+ target_link_libraries(Polly PollyISL jsoncpp)
+
+-if (BUILD_SHARED_LIBS)
+- target_link_libraries(Polly
+- LLVMSupport
+- LLVMCore
+- LLVMScalarOpts
+- LLVMInstCombine
+- LLVMTransformUtils
+- LLVMAnalysis
+- LLVMipo
+- LLVMMC
++target_link_libraries(Polly
++ LLVMSupport
++ LLVMCore
++ LLVMScalarOpts
++ LLVMInstCombine
++ LLVMTransformUtils
++ LLVMAnalysis
++ LLVMipo
++ LLVMMC
+ # The libraries below are required for darwin: http://PR26392
+- LLVMBitReader
+- LLVMMCParser
+- LLVMObject
+- LLVMProfileData
+- LLVMTarget
+- LLVMVectorize
+- )
+- link_directories(
+- ${LLVM_LIBRARY_DIR}
+- )
+-elseif (LLVM_LINK_LLVM_DYLIB)
+- target_link_libraries(Polly
+- LLVM
+- )
+- link_directories(
+- ${LLVM_LIBRARY_DIR}
+- )
+-endif()
++ LLVMBitReader
++ LLVMMCParser
++ LLVMObject
++ LLVMProfileData
++ LLVMTarget
++ LLVMVectorize
++)
++link_directories(
++ ${LLVM_LIBRARY_DIR}
++)
+
+ # Build a monolithic Polly.a and a thin module LLVMPolly.moduleext that links to
+ # that static library.
diff --git a/debian/patches/fix-llvm-config-obj-src-root.patch b/debian/patches/fix-llvm-config-obj-src-root.patch
new file mode 100644
index 0000000..bc1e679
--- /dev/null
+++ b/debian/patches/fix-llvm-config-obj-src-root.patch
@@ -0,0 +1,20 @@
+---
+ tools/llvm-config/llvm-config.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: llvm-toolchain-snapshot_5.0~svn298810/tools/llvm-config/llvm-config.cpp
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn298810.orig/tools/llvm-config/llvm-config.cpp
++++ llvm-toolchain-snapshot_5.0~svn298810/tools/llvm-config/llvm-config.cpp
+@@ -555,9 +555,9 @@ int main(int argc, char **argv) {
+ } else if (Arg == "--shared-mode") {
+ PrintSharedMode = true;
+ } else if (Arg == "--obj-root") {
+- OS << ActivePrefix << '\n';
++ OS << ActivePrefix << "/build/" << '\n';
+ } else if (Arg == "--src-root") {
+- OS << LLVM_SRC_ROOT << '\n';
++ OS << ActivePrefix << "/build/" << '\n';
+ } else if (Arg == "--ignore-libllvm") {
+ LinkDyLib = false;
+ LinkMode = BuiltSharedLibs ? LinkModeShared : LinkModeAuto;
diff --git a/debian/patches/fix-scan-view-path.diff b/debian/patches/fix-scan-view-path.diff
new file mode 100644
index 0000000..d9fa6c8
--- /dev/null
+++ b/debian/patches/fix-scan-view-path.diff
@@ -0,0 +1,21 @@
+Index: llvm-toolchain-3.9-3.9/clang/tools/scan-view/bin/scan-view
+===================================================================
+--- llvm-toolchain-3.9-3.9.orig/clang/tools/scan-view/bin/scan-view
++++ llvm-toolchain-3.9-3.9/clang/tools/scan-view/bin/scan-view
+@@ -23,6 +23,7 @@ kDefaultPort = 8181
+ kMaxPortsToTry = 100
+
+ ###
++BASE_DIR = '/usr/share/clang/scan-view-3.9'
+
+
+ def url_is_up(url):
+@@ -61,7 +62,7 @@ def start_browser(port, options):
+
+ def run(port, options, root):
+ # Prefer to look relative to the installed binary
+- share = os.path.dirname(__file__) + "/../share/"
++ share = os.path.join(BASE_DIR, 'share')
+ if not os.path.isdir(share):
+ # Otherwise look relative to the source
+ share = os.path.dirname(__file__) + "/../../scan-view/share"
diff --git a/debian/patches/follow-parallel-var.diff b/debian/patches/follow-parallel-var.diff
new file mode 100644
index 0000000..45af781
--- /dev/null
+++ b/debian/patches/follow-parallel-var.diff
@@ -0,0 +1,16 @@
+Index: llvm-toolchain-3.4-3.4.2/test/Makefile
+===================================================================
+--- llvm-toolchain-3.4-3.4.2.orig/test/Makefile
++++ llvm-toolchain-3.4-3.4.2/test/Makefile
+@@ -29,6 +29,11 @@ else
+ LIT_ARGS := -s -v
+ endif
+
++# NJOBS allows an override of the number of threads
++ifneq ($(NJOBS),)
++LIT_ARGS += $(NJOBS)
++endif
++
+ ifdef TESTSUITE
+ LIT_TESTSUITE := $(TESTSUITE)
+ else
diff --git a/debian/patches/force-gcc-header-obj.diff b/debian/patches/force-gcc-header-obj.diff
new file mode 100644
index 0000000..bcd2cbd
--- /dev/null
+++ b/debian/patches/force-gcc-header-obj.diff
@@ -0,0 +1,16 @@
+Index: llvm-toolchain-snapshot_3.5~svn201651/clang/lib/Driver/ToolChains.cpp
+===================================================================
+--- llvm-toolchain-snapshot_3.5~svn201651.orig/clang/lib/Driver/ToolChains.cpp 2014-02-19 09:46:43.433569829 +0100
++++ llvm-toolchain-snapshot_3.5~svn201651/clang/lib/Driver/ToolChains.cpp 2014-02-19 09:46:45.621708435 +0100
+@@ -3078,6 +3078,11 @@
+ return;
+ }
+
++ // Force the inclusion of the gcc headers (objc/objc.h)
++ addExternCSystemIncludeIfExists(
++ DriverArgs, CC1Args, GCCInstallation.getInstallPath() + "/include");
++
++
+ // Lacking those, try to detect the correct set of system includes for the
+ // target triple.
+
diff --git a/debian/patches/force-link-pass.o.diff b/debian/patches/force-link-pass.o.diff
new file mode 100644
index 0000000..f913491
--- /dev/null
+++ b/debian/patches/force-link-pass.o.diff
@@ -0,0 +1,28 @@
+Index: llvm-toolchain-snapshot_3.7~svn231588/tools/bugpoint/Makefile
+===================================================================
+--- llvm-toolchain-snapshot_3.7~svn231588.orig/tools/bugpoint/Makefile
++++ llvm-toolchain-snapshot_3.7~svn231588/tools/bugpoint/Makefile
+@@ -12,6 +12,9 @@ TOOLNAME := bugpoint
+ LINK_COMPONENTS := asmparser instrumentation scalaropts ipo linker bitreader \
+ bitwriter irreader vectorize objcarcopts codegen
+
++# Crappy workaround to make sure it links correctly.
++LLVMLibsOptions := ../../lib/IR/Release*/Pass.o
++
+ # Support plugins.
+ NO_DEAD_STRIP := 1
+
+Index: llvm-toolchain-snapshot_3.7~svn231588/tools/opt/Makefile
+===================================================================
+--- llvm-toolchain-snapshot_3.7~svn231588.orig/tools/opt/Makefile
++++ llvm-toolchain-snapshot_3.7~svn231588/tools/opt/Makefile
+@@ -11,6 +11,9 @@ LEVEL := ../..
+ TOOLNAME := opt
+ LINK_COMPONENTS := bitreader bitwriter asmparser irreader instrumentation scalaropts objcarcopts ipo vectorize all-targets codegen passes
+
++# Crappy workaround to make sure it links correctly.
++LLVMLibsOptions := ../../lib/IR/Release*/Pass.o
++
+ # Support plugins.
+ NO_DEAD_STRIP := 1
+
diff --git a/debian/patches/gcc-7.1-workaround.diff b/debian/patches/gcc-7.1-workaround.diff
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/debian/patches/gcc-7.1-workaround.diff
diff --git a/debian/patches/hurd-EIEIO-undef.diff b/debian/patches/hurd-EIEIO-undef.diff
new file mode 100644
index 0000000..3b98ad9
--- /dev/null
+++ b/debian/patches/hurd-EIEIO-undef.diff
@@ -0,0 +1,14 @@
+Index: llvm-toolchain-snapshot_3.9~svn268880/utils/TableGen/CodeEmitterGen.cpp
+===================================================================
+--- llvm-toolchain-snapshot_3.9~svn268880.orig/utils/TableGen/CodeEmitterGen.cpp
++++ llvm-toolchain-snapshot_3.9~svn268880/utils/TableGen/CodeEmitterGen.cpp
+@@ -229,6 +229,9 @@ void CodeEmitterGen::run(raw_ostream &o)
+ ArrayRef<const CodeGenInstruction*> NumberedInstructions =
+ Target.getInstructionsByEnumValue();
+
++ o << "// Undef for HURD\n";
++ o << "#ifdef EIEIO\n#undef EIEIO\n#endif\n";
++
+ // Emit function declaration
+ o << "uint64_t " << Target.getName();
+ o << "MCCodeEmitter::getBinaryCodeForInstr(const MCInst &MI,\n"
diff --git a/debian/patches/hurd-pathmax.diff b/debian/patches/hurd-pathmax.diff
new file mode 100644
index 0000000..229c9d5
--- /dev/null
+++ b/debian/patches/hurd-pathmax.diff
@@ -0,0 +1,77 @@
+Index: llvm-toolchain-4.0-4.0.1~+rc2/clang/lib/Basic/FileManager.cpp
+===================================================================
+--- llvm-toolchain-4.0-4.0.1~+rc2.orig/clang/lib/Basic/FileManager.cpp
++++ llvm-toolchain-4.0-4.0.1~+rc2/clang/lib/Basic/FileManager.cpp
+@@ -500,6 +500,12 @@ void FileManager::invalidateCache(const
+ UniqueRealFiles.erase(Entry->getUniqueID());
+ }
+
++// For GNU Hurd
++#if defined(__GNU__) && !defined(PATH_MAX)
++# define PATH_MAX 4096
++#endif
++
++
+ void FileManager::GetUniqueIDMapping(
+ SmallVectorImpl<const FileEntry *> &UIDToFiles) const {
+ UIDToFiles.clear();
+Index: llvm-toolchain-4.0-4.0.1~+rc2/lldb/include/lldb/lldb-defines.h
+===================================================================
+--- llvm-toolchain-4.0-4.0.1~+rc2.orig/lldb/include/lldb/lldb-defines.h
++++ llvm-toolchain-4.0-4.0.1~+rc2/lldb/include/lldb/lldb-defines.h
+@@ -28,6 +28,11 @@
+ #define INT32_MAX 2147483647
+ #endif
+
++// For GNU Hurd
++#if defined(__GNU__) && !defined(PATH_MAX)
++# define PATH_MAX 4096
++#endif
++
+ #if !defined(UINT32_MAX)
+ #define UINT32_MAX 4294967295U
+ #endif
+Index: llvm-toolchain-4.0-4.0.1~+rc2/lib/Support/Unix/Path.inc
+===================================================================
+--- llvm-toolchain-4.0-4.0.1~+rc2.orig/lib/Support/Unix/Path.inc
++++ llvm-toolchain-4.0-4.0.1~+rc2/lib/Support/Unix/Path.inc
+@@ -62,6 +62,7 @@
+ // For GNU Hurd
+ #if defined(__GNU__) && !defined(PATH_MAX)
+ # define PATH_MAX 4096
++# define MAXPATHLEN 4096
+ #endif
+
+ #include <sys/types.h>
+Index: llvm-toolchain-4.0-4.0.1~+rc2/tools/dsymutil/DwarfLinker.cpp
+===================================================================
+--- llvm-toolchain-4.0-4.0.1~+rc2.orig/tools/dsymutil/DwarfLinker.cpp
++++ llvm-toolchain-4.0-4.0.1~+rc2/tools/dsymutil/DwarfLinker.cpp
+@@ -42,6 +42,11 @@
+ #include <string>
+ #include <tuple>
+
++// For GNU Hurd
++#if defined(__GNU__) && !defined(PATH_MAX)
++# define PATH_MAX 4096
++#endif
++
+ namespace llvm {
+ namespace dsymutil {
+
+Index: llvm-toolchain-4.0-4.0.1~+rc2/polly/lib/External/ppcg/cuda_common.c
+===================================================================
+--- llvm-toolchain-4.0-4.0.1~+rc2.orig/polly/lib/External/ppcg/cuda_common.c
++++ llvm-toolchain-4.0-4.0.1~+rc2/polly/lib/External/ppcg/cuda_common.c
+@@ -15,6 +15,11 @@
+ #include "cuda_common.h"
+ #include "ppcg.h"
+
++// For GNU Hurd
++#if defined(__GNU__) && !defined(PATH_MAX)
++# define PATH_MAX 4096
++#endif
++
+ /* Open the host .cu file and the kernel .hu and .cu files for writing.
+ * Add the necessary includes.
+ */
diff --git a/debian/patches/install-scan-build-py.diff b/debian/patches/install-scan-build-py.diff
new file mode 100644
index 0000000..0d09cdc
--- /dev/null
+++ b/debian/patches/install-scan-build-py.diff
@@ -0,0 +1,14 @@
+---
+ clang/tools/CMakeLists.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/clang/tools/CMakeLists.txt
++++ b/clang/tools/CMakeLists.txt
+@@ -17,6 +17,7 @@ endif()
+ if(CLANG_ENABLE_STATIC_ANALYZER)
+ add_clang_subdirectory(clang-check)
+ add_clang_subdirectory(scan-build)
++ add_clang_subdirectory(scan-build-py)
+ add_clang_subdirectory(scan-view)
+ endif()
+
diff --git a/debian/patches/lld-arg-cmake-issue.diff b/debian/patches/lld-arg-cmake-issue.diff
new file mode 100644
index 0000000..40ff8ab
--- /dev/null
+++ b/debian/patches/lld-arg-cmake-issue.diff
@@ -0,0 +1,141 @@
+Index: llvm-toolchain-snapshot_4.0~svn290969/lld/cmake/modules/AddLLD.cmake
+===================================================================
+--- llvm-toolchain-snapshot_4.0~svn290969.orig/lld/cmake/modules/AddLLD.cmake
++++ llvm-toolchain-snapshot_4.0~svn290969/lld/cmake/modules/AddLLD.cmake
+@@ -1,5 +1,5 @@
+ macro(add_lld_library name)
+- add_llvm_library(${name} ${ARGN})
++ llvm_add_library(${name} ${ARGN})
+ set_target_properties(${name} PROPERTIES FOLDER "lld libraries")
+ endmacro(add_lld_library)
+
+Index: llvm-toolchain-snapshot_4.0~svn290969/lld/lib/Config/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_4.0~svn290969.orig/lld/lib/Config/CMakeLists.txt
++++ llvm-toolchain-snapshot_4.0~svn290969/lld/lib/Config/CMakeLists.txt
+@@ -4,6 +4,6 @@
+ ADDITIONAL_HEADER_DIRS
+ ${LLD_INCLUDE_DIR}/lld/Config
+
+- LINK_LIBS
+- LLVMSupport
++ LINK_COMPONENTS
++ Support
+ )
+Index: llvm-toolchain-snapshot_4.0~svn290969/lld/lib/Core/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_4.0~svn290969.orig/lld/lib/Core/CMakeLists.txt
++++ llvm-toolchain-snapshot_4.0~svn290969/lld/lib/Core/CMakeLists.txt
+@@ -12,6 +12,6 @@
+ ADDITIONAL_HEADER_DIRS
+ ${LLD_INCLUDE_DIR}/lld/Core
+
+- LINK_LIBS
+- LLVMSupport
++ LINK_COMPONENTS
++ Support
+ )
+Index: llvm-toolchain-snapshot_4.0~svn290969/lld/lib/Driver/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_4.0~svn290969.orig/lld/lib/Driver/CMakeLists.txt
++++ llvm-toolchain-snapshot_4.0~svn290969/lld/lib/Driver/CMakeLists.txt
+@@ -8,15 +8,17 @@
+ ADDITIONAL_HEADER_DIRS
+ ${LLD_INCLUDE_DIR}/lld/Driver
+
++ LINK_COMPONENTS
++ Object
++ Option
++ Support
++
+ LINK_LIBS
+ lldConfig
+ lldMachO
+ lldCore
+ lldReaderWriter
+ lldYAML
+- LLVMObject
+- LLVMOption
+- LLVMSupport
+ )
+
+ add_dependencies(lldDriver DriverOptionsTableGen)
+Index: llvm-toolchain-snapshot_4.0~svn290969/lld/lib/ReaderWriter/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_4.0~svn290969.orig/lld/lib/ReaderWriter/CMakeLists.txt
++++ llvm-toolchain-snapshot_4.0~svn290969/lld/lib/ReaderWriter/CMakeLists.txt
+@@ -11,9 +11,11 @@
+ ADDITIONAL_HEADER_DIRS
+ ${LLD_INCLUDE_DIR}/lld/ReaderWriter
+
++ LINK_COMPONENTS
++ Object
++ Support
++
+ LINK_LIBS
+ lldCore
+ lldYAML
+- LLVMObject
+- LLVMSupport
+ )
+Index: llvm-toolchain-snapshot_4.0~svn290969/lld/lib/ReaderWriter/MachO/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_4.0~svn290969.orig/lld/lib/ReaderWriter/MachO/CMakeLists.txt
++++ llvm-toolchain-snapshot_4.0~svn290969/lld/lib/ReaderWriter/MachO/CMakeLists.txt
+@@ -18,13 +18,16 @@
+ StubsPass.cpp
+ TLVPass.cpp
+ WriterMachO.cpp
++
++ LINK_COMPONENTS
++ DebugInfoDWARF
++ Object
++ Support
++ Demangle
++
+ LINK_LIBS
+ lldCore
+ lldYAML
+- LLVMDebugInfoDWARF
+- LLVMObject
+- LLVMSupport
+- LLVMDemangle
+ ${PTHREAD_LIB}
+ )
+
+Index: llvm-toolchain-snapshot_4.0~svn290969/lld/lib/ReaderWriter/YAML/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_4.0~svn290969.orig/lld/lib/ReaderWriter/YAML/CMakeLists.txt
++++ llvm-toolchain-snapshot_4.0~svn290969/lld/lib/ReaderWriter/YAML/CMakeLists.txt
+@@ -1,6 +1,9 @@
+ add_lld_library(lldYAML
+ ReaderWriterYAML.cpp
++
++ LINK_COMPONENTS
++ Support
++
+ LINK_LIBS
+ lldCore
+- LLVMSupport
+ )
+Index: llvm-toolchain-snapshot_4.0~svn290969/lld/tools/lld/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_4.0~svn290969.orig/lld/tools/lld/CMakeLists.txt
++++ llvm-toolchain-snapshot_4.0~svn290969/lld/tools/lld/CMakeLists.txt
+@@ -1,12 +1,15 @@
++set(LLVM_LINK_COMPONENTS
++ Support
++ )
++
+ add_lld_tool(lld
+ lld.cpp
+ )
+
+ target_link_libraries(lld
+ lldDriver
+ lldCOFF
+ lldELF
+- LLVMSupport
+ )
+
+ install(TARGETS lld
diff --git a/debian/patches/lldb-addversion-suffix-to-llvm-server-exec.patch b/debian/patches/lldb-addversion-suffix-to-llvm-server-exec.patch
new file mode 100644
index 0000000..9cb1c43
--- /dev/null
+++ b/debian/patches/lldb-addversion-suffix-to-llvm-server-exec.patch
@@ -0,0 +1,35 @@
+lldb-server exec users always /usr/bin/lldb-server. Server is required
+for any debugging with lldb which makes it unusable unless default version
+package has been installed. Small changes to code and debian/rules allows
+a workaround for lldb-server start up.
+
+To use this one needs to add cmake defination during configure. eg
+-DDEBIAN_VERSION_SUFFIX=-$(LLVM_VERSION)
+
+Better implementation would be to use /usr/share/llvm-$(VERSION)/bin but
+that change seems to require a big change to the path handling code
+which could then break something else.
+
+This probably should have upstream bug but I couldn't find any existing report.
+
+Index: llvm-toolchain-snapshot_5.0~svn293997/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293997.orig/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
++++ llvm-toolchain-snapshot_5.0~svn293997/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+@@ -32,6 +32,7 @@
+ #include "lldb/Utility/StreamString.h"
+ #include "llvm/ADT/SmallString.h"
+ #include "llvm/Support/ScopedPrinter.h"
++#include "llvm/Config/llvm-config.h"
+
+ // Project includes
+ #include "ProcessGDBRemoteLog.h"
+@@ -39,7 +40,7 @@
+ #if defined(__APPLE__)
+ #define DEBUGSERVER_BASENAME "debugserver"
+ #else
+-#define DEBUGSERVER_BASENAME "lldb-server"
++# define DEBUGSERVER_BASENAME "lldb-server-"LLVM_VERSION_STRING
+ #endif
+
+ #if defined(HAVE_LIBCOMPRESSION)
diff --git a/debian/patches/lldb-disable-swig-error.diff b/debian/patches/lldb-disable-swig-error.diff
new file mode 100644
index 0000000..a715805
--- /dev/null
+++ b/debian/patches/lldb-disable-swig-error.diff
@@ -0,0 +1,13 @@
+Index: llvm-toolchain-snapshot_5.0~svn306792/lldb/scripts/lldb.swig
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn306792.orig/lldb/scripts/lldb.swig
++++ llvm-toolchain-snapshot_5.0~svn306792/lldb/scripts/lldb.swig
+@@ -50,7 +50,7 @@ except ImportError:
+ %enddef
+ // These versions will not generate working python modules, so error out early.
+ #if SWIG_VERSION >= 0x030009 && SWIG_VERSION < 0x030011
+-#error Swig versions 3.0.9 and 3.0.10 are incompatible with lldb.
++#warning Swig versions 3.0.9 and 3.0.10 are incompatible with lldb.
+ #endif
+
+ // The name of the module to be created.
diff --git a/debian/patches/lldb-libname.diff b/debian/patches/lldb-libname.diff
new file mode 100644
index 0000000..617060e
--- /dev/null
+++ b/debian/patches/lldb-libname.diff
@@ -0,0 +1,15 @@
+---
+ lldb/scripts/Python/finishSwigPythonLLDB.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/lldb/scripts/Python/finishSwigPythonLLDB.py
++++ b/lldb/scripts/Python/finishSwigPythonLLDB.py
+@@ -443,7 +443,7 @@ def make_symlink_liblldb(
+ if eOSType == utilsOsType.EnumOsType.Darwin:
+ strLibFileExtn = ".dylib"
+ else:
+- strLibFileExtn = ".so"
++ strLibFileExtn = "-5.0.so"
+ strSrc = os.path.join(vstrLldbLibDir, "liblldb" + strLibFileExtn)
+
+ bOk, strErrMsg = make_symlink(
diff --git a/debian/patches/lldb-link-atomic-cmake.patch b/debian/patches/lldb-link-atomic-cmake.patch
new file mode 100644
index 0000000..1a40671
--- /dev/null
+++ b/debian/patches/lldb-link-atomic-cmake.patch
@@ -0,0 +1,26 @@
+Description: Link with -latomic when mips* processor is detected
+Author: Gianfranco Costamagna <locutusofborg@debian.org>
+Last-Update: 2016-07-27
+
+---
+ lldb/cmake/LLDBDependencies.cmake | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+Index: llvm-toolchain-5.0_5.0~svn311110/lldb/cmake/LLDBDependencies.cmake
+===================================================================
+--- llvm-toolchain-5.0_5.0~svn311110.orig/lldb/cmake/LLDBDependencies.cmake
++++ llvm-toolchain-5.0_5.0~svn311110/lldb/cmake/LLDBDependencies.cmake
+@@ -30,6 +30,13 @@ endif()
+
+ list(APPEND LLDB_SYSTEM_LIBS ${system_libs})
+
++if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "mips" OR
++ CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "mipsel" OR
++ CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "mips64el" OR
++ CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "powerpcspe")
++ list(APPEND LLDB_SYSTEM_LIBS atomic)
++endif()
++
+ if (LLVM_BUILD_STATIC)
+ if (NOT LLDB_DISABLE_PYTHON)
+ list(APPEND LLDB_SYSTEM_LIBS python2.7 util)
diff --git a/debian/patches/lldb-missing-install.diff b/debian/patches/lldb-missing-install.diff
new file mode 100644
index 0000000..d8a7b9a
--- /dev/null
+++ b/debian/patches/lldb-missing-install.diff
@@ -0,0 +1,22 @@
+Index: llvm-toolchain-snapshot_5.0~svn294583/lldb/tools/argdumper/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn294583.orig/lldb/tools/argdumper/CMakeLists.txt
++++ llvm-toolchain-snapshot_5.0~svn294583/lldb/tools/argdumper/CMakeLists.txt
+@@ -8,3 +8,5 @@ add_lldb_tool(lldb-argdumper INCLUDE_IN_
+ lldbUtility
+ )
+
++install(TARGETS lldb-argdumper
++ RUNTIME DESTINATION bin)
+Index: llvm-toolchain-snapshot_5.0~svn294583/lldb/tools/lldb-server/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn294583.orig/lldb/tools/lldb-server/CMakeLists.txt
++++ llvm-toolchain-snapshot_5.0~svn294583/lldb/tools/lldb-server/CMakeLists.txt
+@@ -79,3 +79,7 @@ add_lldb_tool(lldb-server INCLUDE_IN_FRA
+ )
+
+ target_link_libraries(lldb-server ${LLDB_SYSTEM_LIBS})
++
++install(TARGETS lldb-server
++ RUNTIME DESTINATION bin)
++
diff --git a/debian/patches/lldb-soname.diff b/debian/patches/lldb-soname.diff
new file mode 100644
index 0000000..e2267c1
--- /dev/null
+++ b/debian/patches/lldb-soname.diff
@@ -0,0 +1,43 @@
+---
+ lldb/source/API/CMakeLists.txt | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+Index: llvm-toolchain-snapshot_5.0~svn294583/lldb/source/API/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn294583.orig/lldb/source/API/CMakeLists.txt
++++ llvm-toolchain-snapshot_5.0~svn294583/lldb/source/API/CMakeLists.txt
+@@ -18,7 +18,12 @@ endif()
+
+ get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
+
+-add_lldb_library(liblldb SHARED
++set(output_name lldb)
++if (CMAKE_SYSTEM_NAME MATCHES "Windows")
++ set(output_name liblldb)
++endif()
++
++add_lldb_library(liblldb SHARED OUTPUT_NAME ${output_name} SONAME
+ SBAddress.cpp
+ SBAttachInfo.cpp
+ SBBlock.cpp
+@@ -116,7 +121,7 @@ target_link_libraries(liblldb PRIVATE
+
+ set_target_properties(liblldb
+ PROPERTIES
+- VERSION ${LLDB_VERSION}
++ VERSION 1
+ )
+
+ if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
+@@ -140,11 +145,6 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows"
+ if (MSVC AND NOT LLDB_DISABLE_PYTHON)
+ target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
+ endif()
+-else()
+- set_target_properties(liblldb
+- PROPERTIES
+- OUTPUT_NAME lldb
+- )
+ endif()
+
+ if (LLDB_WRAP_PYTHON)
diff --git a/debian/patches/mips-fpxx-enable.diff b/debian/patches/mips-fpxx-enable.diff
new file mode 100644
index 0000000..7a07a20
--- /dev/null
+++ b/debian/patches/mips-fpxx-enable.diff
@@ -0,0 +1,17 @@
+Index: llvm-toolchain-snapshot_5.0~svn297449/clang/lib/Driver/ToolChains/Arch/Mips.cpp
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn297449.orig/clang/lib/Driver/ToolChains/Arch/Mips.cpp
++++ llvm-toolchain-snapshot_5.0~svn297449/clang/lib/Driver/ToolChains/Arch/Mips.cpp
+@@ -368,10 +368,10 @@ bool mips::isFP64ADefault(const llvm::Tr
+
+ bool mips::isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName,
+ StringRef ABIName, mips::FloatABI FloatABI) {
+- if (Triple.getVendor() != llvm::Triple::ImaginationTechnologies &&
++/* if (Triple.getVendor() != llvm::Triple::ImaginationTechnologies &&
+ Triple.getVendor() != llvm::Triple::MipsTechnologies &&
+ !Triple.isAndroid())
+- return false;
++ return false;*/
+
+ if (ABIName != "32")
+ return false;
diff --git a/debian/patches/pthread-link.diff b/debian/patches/pthread-link.diff
new file mode 100644
index 0000000..d4d890b
--- /dev/null
+++ b/debian/patches/pthread-link.diff
@@ -0,0 +1,18 @@
+Index: llvm-toolchain-4.0-4.0~svn292009/clang/tools/libclang/CMakeLists.txt
+1;4601;0c===================================================================
+--- llvm-toolchain-4.0-4.0~svn292009.orig/clang/tools/libclang/CMakeLists.txt
++++ llvm-toolchain-4.0-4.0~svn292009/clang/tools/libclang/CMakeLists.txt
+@@ -56,6 +56,13 @@ endif ()
+ find_library(DL_LIBRARY_PATH dl)
+ if (DL_LIBRARY_PATH)
+ list(APPEND LIBS dl)
++
++endif()
++if (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.
++ list(APPEND LIBS ${PTHREAD_LIB})
+ endif()
+
+ option(LIBCLANG_BUILD_STATIC
diff --git a/debian/patches/python-clangpath.diff b/debian/patches/python-clangpath.diff
new file mode 100644
index 0000000..99ca33f
--- /dev/null
+++ b/debian/patches/python-clangpath.diff
@@ -0,0 +1,15 @@
+---
+ clang/bindings/python/clang/cindex.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/clang/bindings/python/clang/cindex.py
++++ b/clang/bindings/python/clang/cindex.py
+@@ -3851,7 +3851,7 @@ class Config:
+ elif name == 'Windows':
+ file = 'libclang.dll'
+ else:
+- file = 'libclang.so'
++ file = 'libclang-5.0.so'
+
+ if Config.library_path:
+ file = Config.library_path + '/' + file
diff --git a/debian/patches/removeduplicatedeclaration.diff b/debian/patches/removeduplicatedeclaration.diff
new file mode 100644
index 0000000..0a750d6
--- /dev/null
+++ b/debian/patches/removeduplicatedeclaration.diff
@@ -0,0 +1,40 @@
+---
+ clang/lib/Basic/Targets.cpp | 27 ---------------------------
+ 1 file changed, 27 deletions(-)
+
+--- a/clang/lib/Basic/Targets.cpp
++++ b/clang/lib/Basic/Targets.cpp
+@@ -4414,33 +4414,6 @@ protected:
+ Builder.defineMacro("__ELF__");
+ }
+
+- static bool shouldUseInlineAtomic(const llvm::Triple &T) {
+- // On linux, binaries targeting old cpus call functions in libgcc to
+- // perform atomic operations. The implementation in libgcc then calls into
+- // the kernel which on armv6 and newer uses ldrex and strex. The net result
+- // is that if we assume the kernel is at least as recent as the hardware,
+- // it is safe to use atomic instructions on armv6 and newer.
+- if (T.getOS() != llvm::Triple::Linux)
+- return false;
+- StringRef ArchName = T.getArchName();
+- if (T.getArch() == llvm::Triple::arm) {
+- if (!ArchName.startswith("armv"))
+- return false;
+- StringRef VersionStr = ArchName.substr(4);
+- unsigned Version;
+- if (VersionStr.getAsInteger(10, Version))
+- return false;
+- return Version >= 6;
+- }
+- assert(T.getArch() == llvm::Triple::thumb);
+- if (!ArchName.startswith("thumbv"))
+- return false;
+- StringRef VersionStr = ArchName.substr(6);
+- unsigned Version;
+- if (VersionStr.getAsInteger(10, Version))
+- return false;
+- return Version >= 7;
+- }
+
+ public:
+ RTEMSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
diff --git a/debian/patches/scan-build-clang-path.diff b/debian/patches/scan-build-clang-path.diff
new file mode 100644
index 0000000..dc59bf0
--- /dev/null
+++ b/debian/patches/scan-build-clang-path.diff
@@ -0,0 +1,15 @@
+---
+ clang/tools/scan-build/bin/scan-build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/clang/tools/scan-build/bin/scan-build
++++ b/clang/tools/scan-build/bin/scan-build
+@@ -1432,7 +1432,7 @@ sub FindClang {
+ if (!defined $Options{AnalyzerDiscoveryMethod}) {
+ $Clang = Cwd::realpath("$RealBin/bin/clang") if (-f "$RealBin/bin/clang");
+ if (!defined $Clang || ! -x $Clang) {
+- $Clang = Cwd::realpath("$RealBin/clang") if (-f "$RealBin/clang");
++ $Clang = Cwd::realpath("/usr/lib/llvm-5.0/bin/clang");
+ }
+ if (!defined $Clang || ! -x $Clang) {
+ return "error: Cannot find an executable 'clang' relative to" .
diff --git a/debian/patches/scan-build-py-default.diff b/debian/patches/scan-build-py-default.diff
new file mode 100644
index 0000000..431bffb
--- /dev/null
+++ b/debian/patches/scan-build-py-default.diff
@@ -0,0 +1,518 @@
+Index: llvm-toolchain-snapshot_3.9-svn269220/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain-branches/llvm-toolchain-snapshot_3.9-svn269220/clang/tools/scan-build-py/libscanbuild/analyze.py
+===================================================================
+--- llvm-toolchain-snapshot_3.9-svn269220.orig/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain-branches/llvm-toolchain-snapshot_3.9-svn269220/clang/tools/scan-build-py/libscanbuild/analyze.py
++++ /dev/null
+@@ -1,513 +0,0 @@
+-# -*- coding: utf-8 -*-
+-# The LLVM Compiler Infrastructure
+-#
+-# This file is distributed under the University of Illinois Open Source
+-# License. See LICENSE.TXT for details.
+-""" This module implements the 'scan-build' command API.
+-
+-To run the static analyzer against a build is done in multiple steps:
+-
+- -- Intercept: capture the compilation command during the build,
+- -- Analyze: run the analyzer against the captured commands,
+- -- Report: create a cover report from the analyzer outputs. """
+-
+-import sys
+-import re
+-import os
+-import os.path
+-import json
+-import argparse
+-import logging
+-import subprocess
+-import multiprocessing
+-from libscanbuild import initialize_logging, tempdir, command_entry_point
+-from libscanbuild.runner import run
+-from libscanbuild.intercept import capture
+-from libscanbuild.report import report_directory, document
+-from libscanbuild.clang import get_checkers
+-from libscanbuild.compilation import split_command
+-
+-__all__ = ['analyze_build_main', 'analyze_build_wrapper']
+-
+-COMPILER_WRAPPER_CC = 'analyze-cc'
+-COMPILER_WRAPPER_CXX = 'analyze-c++'
+-
+-
+-@command_entry_point
+-def analyze_build_main(bin_dir, from_build_command):
+- """ Entry point for 'analyze-build' and 'scan-build'. """
+-
+- parser = create_parser(from_build_command)
+- args = parser.parse_args()
+- validate(parser, args, from_build_command)
+-
+- # setup logging
+- initialize_logging(args.verbose)
+- logging.debug('Parsed arguments: %s', args)
+-
+- with report_directory(args.output, args.keep_empty) as target_dir:
+- if not from_build_command:
+- # run analyzer only and generate cover report
+- run_analyzer(args, target_dir)
+- number_of_bugs = document(args, target_dir, True)
+- return number_of_bugs if args.status_bugs else 0
+- elif args.intercept_first:
+- # run build command and capture compiler executions
+- exit_code = capture(args, bin_dir)
+- # next step to run the analyzer against the captured commands
+- if need_analyzer(args.build):
+- run_analyzer(args, target_dir)
+- # cover report generation and bug counting
+- number_of_bugs = document(args, target_dir, True)
+- # remove the compilation database when it was not requested
+- if os.path.exists(args.cdb):
+- os.unlink(args.cdb)
+- # set exit status as it was requested
+- return number_of_bugs if args.status_bugs else exit_code
+- else:
+- return exit_code
+- else:
+- # run the build command with compiler wrappers which
+- # execute the analyzer too. (interposition)
+- environment = setup_environment(args, target_dir, bin_dir)
+- logging.debug('run build in environment: %s', environment)
+- exit_code = subprocess.call(args.build, env=environment)
+- logging.debug('build finished with exit code: %d', exit_code)
+- # cover report generation and bug counting
+- number_of_bugs = document(args, target_dir, False)
+- # set exit status as it was requested
+- return number_of_bugs if args.status_bugs else exit_code
+-
+-
+-def need_analyzer(args):
+- """ Check the intent of the build command.
+-
+- When static analyzer run against project configure step, it should be
+- silent and no need to run the analyzer or generate report.
+-
+- To run `scan-build` against the configure step might be neccessary,
+- when compiler wrappers are used. That's the moment when build setup
+- check the compiler and capture the location for the build process. """
+-
+- return len(args) and not re.search('configure|autogen', args[0])
+-
+-
+-def run_analyzer(args, output_dir):
+- """ Runs the analyzer against the given compilation database. """
+-
+- def exclude(filename):
+- """ Return true when any excluded directory prefix the filename. """
+- return any(re.match(r'^' + directory, filename)
+- for directory in args.excludes)
+-
+- consts = {
+- 'clang': args.clang,
+- 'output_dir': output_dir,
+- 'output_format': args.output_format,
+- 'output_failures': args.output_failures,
+- 'direct_args': analyzer_params(args),
+- 'force_debug': args.force_debug
+- }
+-
+- logging.debug('run analyzer against compilation database')
+- with open(args.cdb, 'r') as handle:
+- generator = (dict(cmd, **consts)
+- for cmd in json.load(handle) if not exclude(cmd['file']))
+- # when verbose output requested execute sequentially
+- pool = multiprocessing.Pool(1 if args.verbose > 2 else None)
+- for current in pool.imap_unordered(run, generator):
+- if current is not None:
+- # display error message from the static analyzer
+- for line in current['error_output']:
+- logging.info(line.rstrip())
+- pool.close()
+- pool.join()
+-
+-
+-def setup_environment(args, destination, bin_dir):
+- """ Set up environment for build command to interpose compiler wrapper. """
+-
+- environment = dict(os.environ)
+- environment.update({
+- 'CC': os.path.join(bin_dir, COMPILER_WRAPPER_CC),
+- 'CXX': os.path.join(bin_dir, COMPILER_WRAPPER_CXX),
+- 'ANALYZE_BUILD_CC': args.cc,
+- 'ANALYZE_BUILD_CXX': args.cxx,
+- 'ANALYZE_BUILD_CLANG': args.clang if need_analyzer(args.build) else '',
+- 'ANALYZE_BUILD_VERBOSE': 'DEBUG',
+- 'ANALYZE_BUILD_REPORT_DIR': destination,
+- 'ANALYZE_BUILD_REPORT_FORMAT': args.output_format,
+- 'ANALYZE_BUILD_REPORT_FAILURES': 'yes' if args.output_failures else '',
+- 'ANALYZE_BUILD_PARAMETERS': ' '.join(analyzer_params(args)),
+- 'ANALYZE_BUILD_FORCE_DEBUG': 'yes' if args.force_debug else ''
+- })
+- return environment
+-
+-
+-def analyze_build_wrapper(cplusplus):
+- """ Entry point for `analyze-cc` and `analyze-c++` compiler wrappers. """
+-
+- # initialize wrapper logging
+- logging.basicConfig(format='analyze: %(levelname)s: %(message)s',
+- level=os.getenv('ANALYZE_BUILD_VERBOSE', 'INFO'))
+- # execute with real compiler
+- compiler = os.getenv('ANALYZE_BUILD_CXX', 'c++') if cplusplus \
+- else os.getenv('ANALYZE_BUILD_CC', 'cc')
+- compilation = [compiler] + sys.argv[1:]
+- logging.info('execute compiler: %s', compilation)
+- result = subprocess.call(compilation)
+- # exit when it fails, ...
+- if result or not os.getenv('ANALYZE_BUILD_CLANG'):
+- return result
+- # ... and run the analyzer if all went well.
+- try:
+- # check is it a compilation
+- compilation = split_command(sys.argv)
+- if compilation is None:
+- return result
+- # collect the needed parameters from environment, crash when missing
+- parameters = {
+- 'clang': os.getenv('ANALYZE_BUILD_CLANG'),
+- 'output_dir': os.getenv('ANALYZE_BUILD_REPORT_DIR'),
+- 'output_format': os.getenv('ANALYZE_BUILD_REPORT_FORMAT'),
+- 'output_failures': os.getenv('ANALYZE_BUILD_REPORT_FAILURES'),
+- 'direct_args': os.getenv('ANALYZE_BUILD_PARAMETERS',
+- '').split(' '),
+- 'force_debug': os.getenv('ANALYZE_BUILD_FORCE_DEBUG'),
+- 'directory': os.getcwd(),
+- 'command': [sys.argv[0], '-c'] + compilation.flags
+- }
+- # call static analyzer against the compilation
+- for source in compilation.files:
+- parameters.update({'file': source})
+- logging.debug('analyzer parameters %s', parameters)
+- current = run(parameters)
+- # display error message from the static analyzer
+- if current is not None:
+- for line in current['error_output']:
+- logging.info(line.rstrip())
+- except Exception:
+- logging.exception("run analyzer inside compiler wrapper failed.")
+- return result
+-
+-
+-def analyzer_params(args):
+- """ A group of command line arguments can mapped to command
+- line arguments of the analyzer. This method generates those. """
+-
+- def prefix_with(constant, pieces):
+- """ From a sequence create another sequence where every second element
+- is from the original sequence and the odd elements are the prefix.
+-
+- eg.: prefix_with(0, [1,2,3]) creates [0, 1, 0, 2, 0, 3] """
+-
+- return [elem for piece in pieces for elem in [constant, piece]]
+-
+- result = []
+-
+- if args.store_model:
+- result.append('-analyzer-store={0}'.format(args.store_model))
+- if args.constraints_model:
+- result.append('-analyzer-constraints={0}'.format(
+- args.constraints_model))
+- if args.internal_stats:
+- result.append('-analyzer-stats')
+- if args.analyze_headers:
+- result.append('-analyzer-opt-analyze-headers')
+- if args.stats:
+- result.append('-analyzer-checker=debug.Stats')
+- if args.maxloop:
+- result.extend(['-analyzer-max-loop', str(args.maxloop)])
+- if args.output_format:
+- result.append('-analyzer-output={0}'.format(args.output_format))
+- if args.analyzer_config:
+- result.append(args.analyzer_config)
+- if args.verbose >= 4:
+- result.append('-analyzer-display-progress')
+- if args.plugins:
+- result.extend(prefix_with('-load', args.plugins))
+- if args.enable_checker:
+- checkers = ','.join(args.enable_checker)
+- result.extend(['-analyzer-checker', checkers])
+- if args.disable_checker:
+- checkers = ','.join(args.disable_checker)
+- result.extend(['-analyzer-disable-checker', checkers])
+- if os.getenv('UBIVIZ'):
+- result.append('-analyzer-viz-egraph-ubigraph')
+-
+- return prefix_with('-Xclang', result)
+-
+-
+-def print_active_checkers(checkers):
+- """ Print active checkers to stdout. """
+-
+- for name in sorted(name for name, (_, active) in checkers.items()
+- if active):
+- print(name)
+-
+-
+-def print_checkers(checkers):
+- """ Print verbose checker help to stdout. """
+-
+- print('')
+- print('available checkers:')
+- print('')
+- for name in sorted(checkers.keys()):
+- description, active = checkers[name]
+- prefix = '+' if active else ' '
+- if len(name) > 30:
+- print(' {0} {1}'.format(prefix, name))
+- print(' ' * 35 + description)
+- else:
+- print(' {0} {1: <30} {2}'.format(prefix, name, description))
+- print('')
+- print('NOTE: "+" indicates that an analysis is enabled by default.')
+- print('')
+-
+-
+-def validate(parser, args, from_build_command):
+- """ Validation done by the parser itself, but semantic check still
+- needs to be done. This method is doing that. """
+-
+- if args.help_checkers_verbose:
+- print_checkers(get_checkers(args.clang, args.plugins))
+- parser.exit()
+- elif args.help_checkers:
+- print_active_checkers(get_checkers(args.clang, args.plugins))
+- parser.exit()
+-
+- if from_build_command and not args.build:
+- parser.error('missing build command')
+-
+-
+-def create_parser(from_build_command):
+- """ Command line argument parser factory method. """
+-
+- parser = argparse.ArgumentParser(
+- formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+-
+- parser.add_argument(
+- '--verbose', '-v',
+- action='count',
+- default=0,
+- help="""Enable verbose output from '%(prog)s'. A second and third
+- flag increases verbosity.""")
+- parser.add_argument(
+- '--override-compiler',
+- action='store_true',
+- help="""Always resort to the compiler wrapper even when better
+- interposition methods are available.""")
+- parser.add_argument(
+- '--intercept-first',
+- action='store_true',
+- help="""Run the build commands only, build a compilation database,
+- then run the static analyzer afterwards.
+- Generally speaking it has better coverage on build commands.
+- With '--override-compiler' it use compiler wrapper, but does
+- not run the analyzer till the build is finished. """)
+- parser.add_argument(
+- '--cdb',
+- metavar='<file>',
+- default="compile_commands.json",
+- help="""The JSON compilation database.""")
+-
+- parser.add_argument(
+- '--output', '-o',
+- metavar='<path>',
+- default=tempdir(),
+- help="""Specifies the output directory for analyzer reports.
+- Subdirectory will be created if default directory is targeted.
+- """)
+- parser.add_argument(
+- '--status-bugs',
+- action='store_true',
+- help="""By default, the exit status of '%(prog)s' is the same as the
+- executed build command. Specifying this option causes the exit
+- status of '%(prog)s' to be non zero if it found potential bugs
+- and zero otherwise.""")
+- parser.add_argument(
+- '--html-title',
+- metavar='<title>',
+- help="""Specify the title used on generated HTML pages.
+- If not specified, a default title will be used.""")
+- parser.add_argument(
+- '--analyze-headers',
+- action='store_true',
+- help="""Also analyze functions in #included files. By default, such
+- functions are skipped unless they are called by functions
+- within the main source file.""")
+- format_group = parser.add_mutually_exclusive_group()
+- format_group.add_argument(
+- '--plist', '-plist',
+- dest='output_format',
+- const='plist',
+- default='html',
+- action='store_const',
+- help="""This option outputs the results as a set of .plist files.""")
+- format_group.add_argument(
+- '--plist-html', '-plist-html',
+- dest='output_format',
+- const='plist-html',
+- default='html',
+- action='store_const',
+- help="""This option outputs the results as a set of .html and .plist
+- files.""")
+- # TODO: implement '-view '
+-
+- advanced = parser.add_argument_group('advanced options')
+- advanced.add_argument(
+- '--keep-empty',
+- action='store_true',
+- help="""Don't remove the build results directory even if no issues
+- were reported.""")
+- advanced.add_argument(
+- '--no-failure-reports', '-no-failure-reports',
+- dest='output_failures',
+- action='store_false',
+- help="""Do not create a 'failures' subdirectory that includes analyzer
+- crash reports and preprocessed source files.""")
+- advanced.add_argument(
+- '--stats', '-stats',
+- action='store_true',
+- help="""Generates visitation statistics for the project being analyzed.
+- """)
+- advanced.add_argument(
+- '--internal-stats',
+- action='store_true',
+- help="""Generate internal analyzer statistics.""")
+- advanced.add_argument(
+- '--maxloop', '-maxloop',
+- metavar='<loop count>',
+- type=int,
+- help="""Specifiy the number of times a block can be visited before
+- giving up. Increase for more comprehensive coverage at a cost
+- of speed.""")
+- advanced.add_argument(
+- '--store', '-store',
+- metavar='<model>',
+- dest='store_model',
+- choices=['region', 'basic'],
+- help="""Specify the store model used by the analyzer.
+- 'region' specifies a field- sensitive store model.
+- 'basic' which is far less precise but can more quickly
+- analyze code. 'basic' was the default store model for
+- checker-0.221 and earlier.""")
+- advanced.add_argument(
+- '--constraints', '-constraints',
+- metavar='<model>',
+- dest='constraints_model',
+- choices=['range', 'basic'],
+- help="""Specify the contraint engine used by the analyzer. Specifying
+- 'basic' uses a simpler, less powerful constraint model used by
+- checker-0.160 and earlier.""")
+- advanced.add_argument(
+- '--use-analyzer',
+- metavar='<path>',
+- dest='clang',
+- default='clang',
+- help="""'%(prog)s' uses the 'clang' executable relative to itself for
+- static analysis. One can override this behavior with this
+- option by using the 'clang' packaged with Xcode (on OS X) or
+- from the PATH.""")
+- advanced.add_argument(
+- '--use-cc',
+- metavar='<path>',
+- dest='cc',
+- default='cc',
+- help="""When '%(prog)s' analyzes a project by interposing a "fake
+- compiler", which executes a real compiler for compilation and
+- do other tasks (to run the static analyzer or just record the
+- compiler invocation). Because of this interposing, '%(prog)s'
+- does not know what compiler your project normally uses.
+- Instead, it simply overrides the CC environment variable, and
+- guesses your default compiler.
+-
+- If you need '%(prog)s' to use a specific compiler for
+- *compilation* then you can use this option to specify a path
+- to that compiler.""")
+- advanced.add_argument(
+- '--use-c++',
+- metavar='<path>',
+- dest='cxx',
+- default='c++',
+- help="""This is the same as "--use-cc" but for C++ code.""")
+- advanced.add_argument(
+- '--analyzer-config', '-analyzer-config',
+- metavar='<options>',
+- help="""Provide options to pass through to the analyzer's
+- -analyzer-config flag. Several options are separated with
+- comma: 'key1=val1,key2=val2'
+-
+- Available options:
+- stable-report-filename=true or false (default)
+-
+- Switch the page naming to:
+- report-<filename>-<function/method name>-<id>.html
+- instead of report-XXXXXX.html""")
+- advanced.add_argument(
+- '--exclude',
+- metavar='<directory>',
+- dest='excludes',
+- action='append',
+- default=[],
+- help="""Do not run static analyzer against files found in this
+- directory. (You can specify this option multiple times.)
+- Could be usefull when project contains 3rd party libraries.
+- The directory path shall be absolute path as file names in
+- the compilation database.""")
+- advanced.add_argument(
+- '--force-analyze-debug-code',
+- dest='force_debug',
+- action='store_true',
+- help="""Tells analyzer to enable assertions in code even if they were
+- disabled during compilation, enabling more precise results.""")
+-
+- plugins = parser.add_argument_group('checker options')
+- plugins.add_argument(
+- '--load-plugin', '-load-plugin',
+- metavar='<plugin library>',
+- dest='plugins',
+- action='append',
+- help="""Loading external checkers using the clang plugin interface.""")
+- plugins.add_argument(
+- '--enable-checker', '-enable-checker',
+- metavar='<checker name>',
+- action=AppendCommaSeparated,
+- help="""Enable specific checker.""")
+- plugins.add_argument(
+- '--disable-checker', '-disable-checker',
+- metavar='<checker name>',
+- action=AppendCommaSeparated,
+- help="""Disable specific checker.""")
+- plugins.add_argument(
+- '--help-checkers',
+- action='store_true',
+- help="""A default group of checkers is run unless explicitly disabled.
+- Exactly which checkers constitute the default group is a
+- function of the operating system in use. These can be printed
+- with this flag.""")
+- plugins.add_argument(
+- '--help-checkers-verbose',
+- action='store_true',
+- help="""Print all available checkers and mark the enabled ones.""")
+-
+- if from_build_command:
+- parser.add_argument(
+- dest='build',
+- nargs=argparse.REMAINDER,
+- help="""Command to run.""")
+-
+- return parser
+-
+-
+-class AppendCommaSeparated(argparse.Action):
+- """ argparse Action class to support multiple comma separated lists. """
+-
+- def __call__(self, __parser, namespace, values, __option_string):
+- # getattr(obj, attr, default) does not really returns default but none
+- if getattr(namespace, self.dest, None) is None:
+- setattr(namespace, self.dest, [])
+- # once it's fixed we can use as expected
+- actual = getattr(namespace, self.dest)
+- actual.extend(values.split(','))
+- setattr(namespace, self.dest, actual)
diff --git a/debian/patches/scan-view-fix-path.diff b/debian/patches/scan-view-fix-path.diff
new file mode 100644
index 0000000..a37e688
--- /dev/null
+++ b/debian/patches/scan-view-fix-path.diff
@@ -0,0 +1,13 @@
+Index: llvm-toolchain-snapshot_5.0~svn297449/clang/tools/scan-view/bin/scan-view
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn297449.orig/clang/tools/scan-view/bin/scan-view
++++ llvm-toolchain-snapshot_5.0~svn297449/clang/tools/scan-view/bin/scan-view
+@@ -61,7 +61,7 @@ def start_browser(port, options):
+
+ def run(port, options, root):
+ # Prefer to look relative to the installed binary
+- share = os.path.dirname(__file__) + "/../share/scan-view"
++ share = os.path.dirname(__file__) + "/../share/"
+ if not os.path.isdir(share):
+ # Otherwise look relative to the source
+ share = os.path.dirname(__file__) + "/../../scan-view/share"
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..58de66c
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,48 @@
+19-clang_debian_version.patch
+23-strlcpy_strlcat_warning_removed.diff
+27-fix_clang_stdint.diff
+26-set-correct-float-abi.diff
+0003-Debian-version-info-and-bugreport.patch
+scan-build-clang-path.diff
+declare_clear_cache.diff
+clang-format-version.diff
+unwind-chain-inclusion.diff
+hurd-pathmax.diff
+silent-gold-test.diff
+atomic_library_1.diff
+atomic_library_2.diff
+python-clangpath.diff
+removeduplicatedeclaration.diff
+fix-clang-path-and-build.diff
+#force-gcc-header-obj.diff
+do-not-fail-on-unexpected-pass.diff
+silent-more-tests.diff
+disable-display-PASS-UNSUPPORTED-XFAIL.diff
+fix-llvm-config-obj-src-root.patch
+0044-soname.diff
+lldb-soname.diff
+lldb-libname.diff
+hurd-EIEIO-undef.diff
+silent-MCJIIT-tests.diff
+clang-analyzer-force-version.diff
+install-scan-build-py.diff
+scan-view-fix-path.diff
+mips-fpxx-enable.diff
+fix-cmake-config-prefix.diff
+lldb-link-atomic-cmake.patch
+disable-source-interleave.diff
+silent-gold-utils.diff
+disable-llvm-symbolizer-test.diff
+#fix-lldb-server-build
+clang-tidy-run-bin.diff
+#bug-30342.diff
+fix-scan-view-path.diff
+#0011-SimplifyCFG-Hoisting-invalidates-metadata.patch
+clang-fix-cmpxchg8-detection-on-i386.patch
+lldb-addversion-suffix-to-llvm-server-exec.patch
+lldb-missing-install.diff
+silent-test-failing-codeverage.diff
+disable-path-test-failing.diff
+silent-amd-tet.diff
+disable-error-xray.diff
+lldb-disable-swig-error.diff
diff --git a/debian/patches/silent-MCJIIT-tests.diff b/debian/patches/silent-MCJIIT-tests.diff
new file mode 100644
index 0000000..6ed20d4
--- /dev/null
+++ b/debian/patches/silent-MCJIIT-tests.diff
@@ -0,0 +1,178 @@
+---
+ test/BugPoint/crash-narrowfunctiontest.ll | 1 -
+ test/BugPoint/remove_arguments_test.ll | 1 -
+ test/ExecutionEngine/MCJIT/cross-module-sm-pic-a.ll | 2 +-
+ test/ExecutionEngine/MCJIT/eh-lg-pic.ll | 2 +-
+ test/ExecutionEngine/MCJIT/multi-module-sm-pic-a.ll | 2 +-
+ test/ExecutionEngine/MCJIT/stubs-sm-pic.ll | 2 +-
+ test/ExecutionEngine/MCJIT/test-global-init-nonzero-sm-pic.ll | 2 +-
+ test/ExecutionEngine/MCJIT/test-ptr-reloc-sm-pic.ll | 2 +-
+ test/ExecutionEngine/OrcMCJIT/cross-module-sm-pic-a.ll | 2 +-
+ test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll | 2 +-
+ test/ExecutionEngine/OrcMCJIT/multi-module-sm-pic-a.ll | 2 +-
+ test/ExecutionEngine/OrcMCJIT/remote/test-global-init-nonzero-sm-pic.ll | 2 +-
+ test/ExecutionEngine/OrcMCJIT/remote/test-ptr-reloc-sm-pic.ll | 2 +-
+ test/ExecutionEngine/OrcMCJIT/stubs-sm-pic.ll | 2 +-
+ test/ExecutionEngine/OrcMCJIT/test-global-init-nonzero-sm-pic.ll | 2 +-
+ test/ExecutionEngine/OrcMCJIT/test-ptr-reloc-sm-pic.ll | 2 +-
+ test/Feature/load_module.ll | 1 -
+ 17 files changed, 14 insertions(+), 17 deletions(-)
+
+--- a/test/BugPoint/crash-narrowfunctiontest.ll
++++ b/test/BugPoint/crash-narrowfunctiontest.ll
+@@ -2,7 +2,6 @@
+ ;
+ ; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -silence-passes > /dev/null
+ ; REQUIRES: loadable_module
+-; XFAIL: *
+
+ define i32 @foo() { ret i32 1 }
+
+--- a/test/BugPoint/remove_arguments_test.ll
++++ b/test/BugPoint/remove_arguments_test.ll
+@@ -1,7 +1,6 @@
+ ; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -silence-passes
+ ; RUN: llvm-dis %t-reduced-simplified.bc -o - | FileCheck %s
+ ; REQUIRES: loadable_module
+-; XFAIL: *
+
+ ; Test to make sure that arguments are removed from the function if they are
+ ; unnecessary. And clean up any types that frees up too.
+--- a/test/ExecutionEngine/MCJIT/cross-module-sm-pic-a.ll
++++ b/test/ExecutionEngine/MCJIT/cross-module-sm-pic-a.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -extra-module=%p/Inputs/cross-module-b.ll -relocation-model=pic -code-model=small %s > /dev/null
+-; XFAIL: mips-, mipsel-, i686, i386
++; XFAIL: *
+
+ declare i32 @FB()
+
+--- a/test/ExecutionEngine/MCJIT/eh-lg-pic.ll
++++ b/test/ExecutionEngine/MCJIT/eh-lg-pic.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -relocation-model=pic -code-model=large %s
+-; XFAIL: cygwin, win32, mingw, mips-, mipsel-, i686, i386, aarch64, arm
++; XFAIL: *
+ declare i8* @__cxa_allocate_exception(i64)
+ declare void @__cxa_throw(i8*, i8*, i8*)
+ declare i32 @__gxx_personality_v0(...)
+--- a/test/ExecutionEngine/MCJIT/multi-module-sm-pic-a.ll
++++ b/test/ExecutionEngine/MCJIT/multi-module-sm-pic-a.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -relocation-model=pic -code-model=small %s > /dev/null
+-; XFAIL: mips-, mipsel-, i686, i386
++; XFAIL: *
+
+ declare i32 @FB()
+
+--- a/test/ExecutionEngine/MCJIT/stubs-sm-pic.ll
++++ b/test/ExecutionEngine/MCJIT/stubs-sm-pic.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -disable-lazy-compilation=false -relocation-model=pic -code-model=small %s
+-; XFAIL: mips-, mipsel-, i686, i386, aarch64, arm
++; XFAIL: mips-, mipsel-, i686, i386, aarch64, arm, x86_64
+
+ define i32 @main() nounwind {
+ entry:
+--- a/test/ExecutionEngine/MCJIT/test-global-init-nonzero-sm-pic.ll
++++ b/test/ExecutionEngine/MCJIT/test-global-init-nonzero-sm-pic.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -relocation-model=pic -code-model=small %s > /dev/null
+-; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386
++; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386, x86_64
+
+ @count = global i32 1, align 4
+
+--- a/test/ExecutionEngine/MCJIT/test-ptr-reloc-sm-pic.ll
++++ b/test/ExecutionEngine/MCJIT/test-ptr-reloc-sm-pic.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -O0 -relocation-model=pic -code-model=small %s
+-; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386
++; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386, x86_64
+
+ @.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1
+ @ptr = global i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), align 4
+--- a/test/ExecutionEngine/OrcMCJIT/cross-module-sm-pic-a.ll
++++ b/test/ExecutionEngine/OrcMCJIT/cross-module-sm-pic-a.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/cross-module-b.ll -relocation-model=pic -code-model=small %s > /dev/null
+-; XFAIL: mips-, mipsel-, i686, i386
++; XFAIL: *
+
+ declare i32 @FB()
+
+--- a/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll
++++ b/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -jit-kind=orc-mcjit -relocation-model=pic -code-model=large %s
+-; XFAIL: cygwin, win32, mingw, mips-, mipsel-, i686, i386, aarch64, arm
++; XFAIL: *
+ declare i8* @__cxa_allocate_exception(i64)
+ declare void @__cxa_throw(i8*, i8*, i8*)
+ declare i32 @__gxx_personality_v0(...)
+--- a/test/ExecutionEngine/OrcMCJIT/multi-module-sm-pic-a.ll
++++ b/test/ExecutionEngine/OrcMCJIT/multi-module-sm-pic-a.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -relocation-model=pic -code-model=small %s > /dev/null
+-; XFAIL: mips-, mipsel-, i686, i386
++; XFAIL: *
+
+ declare i32 @FB()
+
+--- a/test/ExecutionEngine/OrcMCJIT/remote/test-global-init-nonzero-sm-pic.ll
++++ b/test/ExecutionEngine/OrcMCJIT/remote/test-global-init-nonzero-sm-pic.ll
+@@ -1,6 +1,6 @@
+ ; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext \
+ ; RUN: -relocation-model=pic -code-model=small %s > /dev/null
+-; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386, mingw32, win32
++; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386, mingw32, win32, x86_64
+ ; UNSUPPORTED: powerpc64-unknown-linux-gnu
+ ; Remove UNSUPPORTED for powerpc64-unknown-linux-gnu if problem caused by r266663 is fixed
+
+--- a/test/ExecutionEngine/OrcMCJIT/remote/test-ptr-reloc-sm-pic.ll
++++ b/test/ExecutionEngine/OrcMCJIT/remote/test-ptr-reloc-sm-pic.ll
+@@ -1,6 +1,6 @@
+ ; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext \
+ ; RUN: -O0 -relocation-model=pic -code-model=small %s
+-; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386, mingw32, win32
++; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386, mingw32, win32, x86_64
+ ; UNSUPPORTED: powerpc64-unknown-linux-gnu
+ ; Remove UNSUPPORTED for powerpc64-unknown-linux-gnu if problem caused by r266663 is fixed
+
+--- a/test/ExecutionEngine/OrcMCJIT/stubs-sm-pic.ll
++++ b/test/ExecutionEngine/OrcMCJIT/stubs-sm-pic.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -jit-kind=orc-mcjit -disable-lazy-compilation=false -relocation-model=pic -code-model=small %s
+-; XFAIL: mips-, mipsel-, i686, i386, aarch64, arm
++; XFAIL: mips-, mipsel-, i686, i386, aarch64, arm, x86_64
+
+ define i32 @main() nounwind {
+ entry:
+--- a/test/ExecutionEngine/OrcMCJIT/test-global-init-nonzero-sm-pic.ll
++++ b/test/ExecutionEngine/OrcMCJIT/test-global-init-nonzero-sm-pic.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -jit-kind=orc-mcjit -relocation-model=pic -code-model=small %s > /dev/null
+-; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386
++; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386, x86_64
+
+ @count = global i32 1, align 4
+
+--- a/test/ExecutionEngine/OrcMCJIT/test-ptr-reloc-sm-pic.ll
++++ b/test/ExecutionEngine/OrcMCJIT/test-ptr-reloc-sm-pic.ll
+@@ -1,5 +1,5 @@
+ ; RUN: %lli -jit-kind=orc-mcjit -O0 -relocation-model=pic -code-model=small %s
+-; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386
++; XFAIL: mips-, mipsel-, aarch64, arm, i686, i386, x86_64
+
+ @.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1
+ @ptr = global i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), align 4
+--- a/test/Feature/load_module.ll
++++ b/test/Feature/load_module.ll
+@@ -3,7 +3,6 @@
+ ; RUN: -disable-output 2>&1 | grep Hello
+ ; REQUIRES: loadable_module
+ ; FIXME: On Cygming, it might fail without building LLVMHello manually.
+-; XFAIL: *
+
+ @junk = global i32 0
+
diff --git a/debian/patches/silent-amd-tet.diff b/debian/patches/silent-amd-tet.diff
new file mode 100644
index 0000000..dd2f0e6
--- /dev/null
+++ b/debian/patches/silent-amd-tet.diff
@@ -0,0 +1,132 @@
+Index: llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-from-llvm-ir-full.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn299411.orig/test/CodeGen/AMDGPU/code-object-metadata-from-llvm-ir-full.ll
++++ llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-from-llvm-ir-full.ll
+@@ -4,6 +4,7 @@
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -amdgpu-dump-comd -amdgpu-verify-comd -filetype=obj -o - < %s 2>&1 | FileCheck --check-prefix=PARSER %s
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx800 -amdgpu-dump-comd -amdgpu-verify-comd -filetype=obj -o - < %s 2>&1 | FileCheck --check-prefix=PARSER %s
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -amdgpu-dump-comd -amdgpu-verify-comd -filetype=obj -o - < %s 2>&1 | FileCheck --check-prefix=PARSER %s
++; XFAIL: *
+
+ %struct.A = type { i8, float }
+ %opencl.image1d_t = type opaque
+Index: llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-invalid-ocl-version-1.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn299411.orig/test/CodeGen/AMDGPU/code-object-metadata-invalid-ocl-version-1.ll
++++ llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-invalid-ocl-version-1.ll
+@@ -1,4 +1,5 @@
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -filetype=obj -o - < %s | llvm-readobj -amdgpu-code-object-metadata | FileCheck %s
++; XFAIL: *
+
+ ; Make sure llc does not crash for invalid opencl version metadata.
+
+Index: llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-invalid-ocl-version-2.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn299411.orig/test/CodeGen/AMDGPU/code-object-metadata-invalid-ocl-version-2.ll
++++ llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-invalid-ocl-version-2.ll
+@@ -1,4 +1,5 @@
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -filetype=obj -o - < %s | llvm-readobj -amdgpu-code-object-metadata | FileCheck %s
++; XFAIL: *
+
+ ; Make sure llc does not crash for invalid opencl version metadata.
+
+Index: llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-invalid-ocl-version-3.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn299411.orig/test/CodeGen/AMDGPU/code-object-metadata-invalid-ocl-version-3.ll
++++ llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-invalid-ocl-version-3.ll
+@@ -1,4 +1,5 @@
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -filetype=obj -o - < %s | llvm-readobj -amdgpu-code-object-metadata | FileCheck %s
++; XFAIL: *
+
+ ; Make sure llc does not crash for invalid opencl version metadata.
+
+Index: llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-kernel-code-props.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn299411.orig/test/CodeGen/AMDGPU/code-object-metadata-kernel-code-props.ll
++++ llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-kernel-code-props.ll
+@@ -1,6 +1,7 @@
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -filetype=obj -o - < %s | llvm-readobj -amdgpu-code-object-metadata -elf-output-style=GNU -notes | FileCheck --check-prefix=CHECK --check-prefix=GFX700 --check-prefix=NOTES %s
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx800 -filetype=obj -o - < %s | llvm-readobj -amdgpu-code-object-metadata -elf-output-style=GNU -notes | FileCheck --check-prefix=CHECK --check-prefix=GFX800 --check-prefix=NOTES %s
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj -o - < %s | llvm-readobj -amdgpu-code-object-metadata -elf-output-style=GNU -notes | FileCheck --check-prefix=CHECK --check-prefix=GFX900 --check-prefix=NOTES %s
++; XFAIL: *
+
+ ; CHECK: ---
+ ; CHECK: Version: [ 1, 0 ]
+Index: llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-kernel-debug-props.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn299411.orig/test/CodeGen/AMDGPU/code-object-metadata-kernel-debug-props.ll
++++ llvm-toolchain-snapshot_5.0~svn299411/test/CodeGen/AMDGPU/code-object-metadata-kernel-debug-props.ll
+@@ -1,6 +1,7 @@
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -filetype=obj -o - < %s | llvm-readobj -amdgpu-code-object-metadata -elf-output-style=GNU -notes | FileCheck --check-prefix=CHECK --check-prefix=GFX700 --check-prefix=NOTES %s
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx800 -filetype=obj -o - < %s | llvm-readobj -amdgpu-code-object-metadata -elf-output-style=GNU -notes | FileCheck --check-prefix=CHECK --check-prefix=GFX800 --check-prefix=NOTES %s
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj -o - < %s | llvm-readobj -amdgpu-code-object-metadata -elf-output-style=GNU -notes | FileCheck --check-prefix=CHECK --check-prefix=GFX900 --check-prefix=NOTES %s
++; XFAIL: *
+
+ declare void @llvm.dbg.declare(metadata, metadata, metadata)
+
+Index: llvm-toolchain-snapshot_5.0~svn299411/test/MC/AMDGPU/code-object-metadata-kernel-args.s
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn299411.orig/test/MC/AMDGPU/code-object-metadata-kernel-args.s
++++ llvm-toolchain-snapshot_5.0~svn299411/test/MC/AMDGPU/code-object-metadata-kernel-args.s
+@@ -1,6 +1,7 @@
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s
++// XFAIL: *
+
+ // CHECK: .amdgpu_code_object_metadata
+ // CHECK: Version: [ 1, 0 ]
+Index: llvm-toolchain-snapshot_5.0~svn299411/test/MC/AMDGPU/code-object-metadata-kernel-attrs.s
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn299411.orig/test/MC/AMDGPU/code-object-metadata-kernel-attrs.s
++++ llvm-toolchain-snapshot_5.0~svn299411/test/MC/AMDGPU/code-object-metadata-kernel-attrs.s
+@@ -1,6 +1,7 @@
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s
++// XFAIL: *
+
+ // CHECK: .amdgpu_code_object_metadata
+ // CHECK: Version: [ 1, 0 ]
+Index: llvm-toolchain-snapshot_5.0~svn299411/test/MC/AMDGPU/code-object-metadata-kernel-code-props.s
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn299411.orig/test/MC/AMDGPU/code-object-metadata-kernel-code-props.s
++++ llvm-toolchain-snapshot_5.0~svn299411/test/MC/AMDGPU/code-object-metadata-kernel-code-props.s
+@@ -1,6 +1,7 @@
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s
++// FAIL: *
+
+ // CHECK: .amdgpu_code_object_metadata
+ // CHECK: Version: [ 1, 0 ]
+Index: llvm-toolchain-snapshot_5.0~svn299411/test/MC/AMDGPU/code-object-metadata-kernel-debug-props.s
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn299411.orig/test/MC/AMDGPU/code-object-metadata-kernel-debug-props.s
++++ llvm-toolchain-snapshot_5.0~svn299411/test/MC/AMDGPU/code-object-metadata-kernel-debug-props.s
+@@ -1,6 +1,7 @@
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx700 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX700 %s
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx800 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX800 %s
+ // RUN: llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx900 -show-encoding %s | FileCheck --check-prefix=CHECK --check-prefix=GFX900 %s
++// XFAIL: *
+
+ // CHECK: .amdgpu_code_object_metadata
+ // CHECK: Version: [ 1, 0 ]
+@@ -23,4 +24,4 @@
+ ReservedFirstVGPR: 11
+ PrivateSegmentBufferSGPR: 0
+ WavefrontPrivateSegmentOffsetSGPR: 11
+-.end_amdgpu_code_object_metadata
+\ No newline at end of file
++.end_amdgpu_code_object_metadata
+Index: llvm-toolchain-snapshot_5.0~svn299411/test/MC/AMDGPU/hsa.s
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn299411.orig/test/MC/AMDGPU/hsa.s
++++ llvm-toolchain-snapshot_5.0~svn299411/test/MC/AMDGPU/hsa.s
+@@ -1,5 +1,6 @@
+ // RUN: llvm-mc -triple amdgcn--amdhsa -mcpu=kaveri -show-encoding %s | FileCheck %s --check-prefix=ASM
+ // RUN: llvm-mc -filetype=obj -triple amdgcn--amdhsa -mcpu=kaveri -show-encoding %s | llvm-readobj -symbols -s -sd | FileCheck %s --check-prefix=ELF
++// XFAIL: *
+
+ // ELF: Section {
+ // ELF: Name: .text
diff --git a/debian/patches/silent-amdgpu-test-failing.diff b/debian/patches/silent-amdgpu-test-failing.diff
new file mode 100644
index 0000000..1e138cb
--- /dev/null
+++ b/debian/patches/silent-amdgpu-test-failing.diff
@@ -0,0 +1,46 @@
+Index: llvm-toolchain-snapshot_5.0~svn292012/test/CodeGen/AMDGPU/invalid-opencl-version-metadata1.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn292012.orig/test/CodeGen/AMDGPU/invalid-opencl-version-metadata1.ll
++++ llvm-toolchain-snapshot_5.0~svn292012/test/CodeGen/AMDGPU/invalid-opencl-version-metadata1.ll
+@@ -2,5 +2,6 @@
+ ; check llc does not crash for invalid opencl version metadata
+
+ ; CHECK: { amd.MDVersion: [ 2, 0 ] }
++; XFAIL: *
+
+ !opencl.ocl.version = !{}
+Index: llvm-toolchain-snapshot_5.0~svn292012/test/CodeGen/AMDGPU/invalid-opencl-version-metadata2.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn292012.orig/test/CodeGen/AMDGPU/invalid-opencl-version-metadata2.ll
++++ llvm-toolchain-snapshot_5.0~svn292012/test/CodeGen/AMDGPU/invalid-opencl-version-metadata2.ll
+@@ -2,6 +2,7 @@
+ ; check llc does not crash for invalid opencl version metadata
+
+ ; CHECK: { amd.MDVersion: [ 2, 0 ] }
++; XFAIL: *
+
+ !opencl.ocl.version = !{!0}
+ !0 = !{}
+Index: llvm-toolchain-snapshot_5.0~svn292012/test/CodeGen/AMDGPU/invalid-opencl-version-metadata3.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn292012.orig/test/CodeGen/AMDGPU/invalid-opencl-version-metadata3.ll
++++ llvm-toolchain-snapshot_5.0~svn292012/test/CodeGen/AMDGPU/invalid-opencl-version-metadata3.ll
+@@ -2,6 +2,7 @@
+ ; check llc does not crash for invalid opencl version metadata
+
+ ; CHECK: { amd.MDVersion: [ 2, 0 ] }
++; XFAIL: *
+
+ !opencl.ocl.version = !{!0}
+ !0 = !{i32 1}
+Index: llvm-toolchain-snapshot_5.0~svn292012/test/CodeGen/AMDGPU/runtime-metadata.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn292012.orig/test/CodeGen/AMDGPU/runtime-metadata.ll
++++ llvm-toolchain-snapshot_5.0~svn292012/test/CodeGen/AMDGPU/runtime-metadata.ll
+@@ -1,5 +1,6 @@
+ ; RUN: llc -mtriple=amdgcn--amdhsa -filetype=obj -o - < %s | llvm-readobj -amdgpu-runtime-metadata | FileCheck %s
+ ; RUN: llc -mtriple=amdgcn--amdhsa -filetype=obj -amdgpu-dump-rtmd -amdgpu-check-rtmd-parser %s -o - 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=PARSER %s
++; XFAIL: *
+
+ %struct.A = type { i8, float }
+ %opencl.image1d_t = type opaque
diff --git a/debian/patches/silent-gold-test.diff b/debian/patches/silent-gold-test.diff
new file mode 100644
index 0000000..fe6828d
--- /dev/null
+++ b/debian/patches/silent-gold-test.diff
@@ -0,0 +1,26 @@
+Description: fails on debian unstable amd64
+ Command Output (stderr):
+ --
+ /build/llvm-toolchain-snapshot-4.0~svn279916/test/tools/gold/X86/start-lib-common.ll:22:10: error: expected string not found in input
+ ; CHECK: @x = common global i32 0, align 8
+ ^
+ <stdin>:1:1: note: scanning from here
+ ; ModuleID = '/build/llvm-toolchain-snapshot-4.0~svn279916/build-llvm/test/tools/gold/X86/Output/start-lib-common.ll.tmp3.o'
+ ^
+ <stdin>:4:1: note: possible intended match here
+ @x = common global i32 0, align 4
+ ^
+
+
+Index: llvm-toolchain-snapshot_4.0~svn289826/test/tools/gold/X86/start-lib-common.ll
+===================================================================
+--- llvm-toolchain-snapshot_4.0~svn289826.orig/test/tools/gold/X86/start-lib-common.ll
++++ llvm-toolchain-snapshot_4.0~svn289826/test/tools/gold/X86/start-lib-common.ll
+@@ -9,6 +9,7 @@
+ ; RUN: -shared %t1.o --start-lib %t2.o --end-lib -o %t3.o
+ ; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
++; XFAIL: *
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ @x = common global i32 0, align 4
+
diff --git a/debian/patches/silent-gold-utils.diff b/debian/patches/silent-gold-utils.diff
new file mode 100644
index 0000000..aee1218
--- /dev/null
+++ b/debian/patches/silent-gold-utils.diff
@@ -0,0 +1,190 @@
+---
+ test/tools/gold/X86/common_thinlto.ll | 1 +
+ test/tools/gold/X86/emit-llvm.ll | 2 ++
+ test/tools/gold/X86/parallel.ll | 1 +
+ test/tools/gold/X86/pr19901_thinlto.ll | 1 +
+ test/tools/gold/X86/slp-vectorize.ll | 1 +
+ test/tools/gold/X86/strip_names.ll | 1 +
+ test/tools/gold/X86/thinlto.ll | 2 ++
+ test/tools/gold/X86/thinlto_archive.ll | 1 +
+ test/tools/gold/X86/thinlto_internalize.ll | 2 ++
+ test/tools/gold/X86/thinlto_linkonceresolution.ll | 2 ++
+ test/tools/gold/X86/thinlto_weak_resolution.ll | 3 ++-
+ test/tools/gold/X86/type-merge2.ll | 2 +-
+ test/tools/gold/X86/vectorize.ll | 1 +
+ test/tools/gold/X86/visibility.ll | 1 +
+ 14 files changed, 19 insertions(+), 2 deletions(-)
+
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/common_thinlto.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/common_thinlto.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/common_thinlto.ll
+@@ -17,6 +17,7 @@
+
+ ; RUN: llvm-nm %t3 | FileCheck %s --check-prefix=NM
+ ; NM: bar
++; XFAIL: *
+
+ source_filename = "common1.c"
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/emit-llvm.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/emit-llvm.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/emit-llvm.ll
+@@ -21,6 +21,8 @@
+ ; RUN: not test -a %t4.o
+
+ ; NM: T f3
++; XFAIL: *
++
+
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/parallel.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/parallel.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/parallel.ll
+@@ -5,6 +5,7 @@
+ ; RUN: llvm-dis %t.1.5.precodegen.bc -o - | FileCheck --check-prefix=CHECK-BC1 %s
+ ; RUN: llvm-nm %t.o | FileCheck --check-prefix=CHECK0 %s
+ ; RUN: llvm-nm %t.o1 | FileCheck --check-prefix=CHECK1 %s
++; XFAIL: *
+
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/pr19901_thinlto.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/pr19901_thinlto.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/pr19901_thinlto.ll
+@@ -4,6 +4,7 @@
+ ; RUN: --plugin-opt=thinlto \
+ ; RUN: -shared -m elf_x86_64 -o %t.so %t2.o %t.o
+ ; RUN: llvm-readobj -t %t.so | FileCheck %s
++; XFAIL: i686, i386
+
+ ; CHECK: Symbol {
+ ; CHECK: Name: f
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/slp-vectorize.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/slp-vectorize.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/slp-vectorize.ll
+@@ -7,6 +7,7 @@
+
+ ; test that the vectorizer is run.
+ ; CHECK: fadd <4 x float>
++; XFAIL: *
+
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/strip_names.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/strip_names.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/strip_names.ll
+@@ -25,6 +25,7 @@
+ ; NONAME: %2 = load i32, i32* @GlobalValueName
+ ; NONAME: %3 = add i32 %0, %2
+ ; NONAME: ret i32 %3
++; XFAIL: *
+
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/thinlto.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/thinlto.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/thinlto.ll
+@@ -126,6 +126,8 @@
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+
++; XFAIL: i686, i386
++
+ declare void @g(...)
+
+ define void @f() {
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/thinlto_archive.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/thinlto_archive.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/thinlto_archive.ll
+@@ -15,6 +15,7 @@
+ ; RUN: --plugin-opt=jobs=1 \
+ ; RUN: -shared %t.o %t.a -o %t4 2>&1 | FileCheck %s
+ ; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
++; XFAIL: i686, i386
+
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/thinlto_internalize.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/thinlto_internalize.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/thinlto_internalize.ll
+@@ -14,6 +14,8 @@
+ ; h() should be internalized after promotion, and eliminated after inlining
+ ; CHECK-NOT: @h.llvm.
+
++; XFAIL: i686, i386
++
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+ define i32 @g() {
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/thinlto_linkonceresolution.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/thinlto_linkonceresolution.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/thinlto_linkonceresolution.ll
+@@ -23,6 +23,8 @@
+ ; OPT-NOT: @f()
+ ; OPT2: define weak_odr hidden void @f()
+
++; XFAIL: i686, i386
++
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+ define i32 @g() {
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/thinlto_weak_resolution.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/thinlto_weak_resolution.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/thinlto_weak_resolution.ll
+@@ -9,6 +9,7 @@
+ ; RUN: --plugin-opt=save-temps \
+ ; RUN: -shared \
+ ; RUN: -o %t3.o %t.o %t2.o
++; XFAIL: i686, i386
+
+ ; RUN: llvm-nm %t3.o | FileCheck %s
+ ; CHECK: weakfunc
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/type-merge2.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/type-merge2.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/type-merge2.ll
+@@ -6,6 +6,8 @@
+ ; RUN: -shared %t.o %t2.o -o %t3.o
+ ; RUN: llvm-dis %t3.o.0.2.internalize.bc -o - | FileCheck %s
+
++; XFAIL: *
++
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/vectorize.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/vectorize.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/vectorize.ll
+@@ -7,6 +7,7 @@
+
+ ; test that the vectorizer is run.
+ ; CHECK: fadd <4 x float>
++; XFAIL: *
+
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-unknown-linux-gnu"
+Index: llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/visibility.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn293158.orig/test/tools/gold/X86/visibility.ll
++++ llvm-toolchain-snapshot_5.0~svn293158/test/tools/gold/X86/visibility.ll
+@@ -16,6 +16,7 @@
+ ; CHECK-NEXT: Other [
+ ; CHECK-NEXT: STV_PROTECTED
+ ; CHECK-NEXT: ]
++; XFAIL: *
+
+ ; IR: define void @foo
+
diff --git a/debian/patches/silent-more-tests.diff b/debian/patches/silent-more-tests.diff
new file mode 100644
index 0000000..56724b7
--- /dev/null
+++ b/debian/patches/silent-more-tests.diff
@@ -0,0 +1,52 @@
+# Comment the tests for the code coverage (fails otherwise)
+
+
+---
+ test/BugPoint/crash-narrowfunctiontest.ll | 1 +
+ test/BugPoint/metadata.ll | 3 ++-
+ test/BugPoint/remove_arguments_test.ll | 1 +
+ test/Feature/load_module.ll | 1 +
+ 4 files changed, 5 insertions(+), 1 deletion(-)
+
+--- a/test/BugPoint/crash-narrowfunctiontest.ll
++++ b/test/BugPoint/crash-narrowfunctiontest.ll
+@@ -2,6 +2,7 @@
+ ;
+ ; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -silence-passes > /dev/null
+ ; REQUIRES: loadable_module
++; XFAIL: *
+
+ define i32 @foo() { ret i32 1 }
+
+--- a/test/BugPoint/metadata.ll
++++ b/test/BugPoint/metadata.ll
+@@ -7,7 +7,8 @@
+ ;
+ ; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t-notype -bugpoint-crashcalls -silence-passes -disable-namedmd-remove -disable-strip-debuginfo > /dev/null
+ ; RUN: llvm-dis %t-notype-reduced-simplified.bc -o - | FileCheck %s --check-prefix=NOTYPE
+-;
++; XFAIL: *
++
+ ; Bugpoint should keep the call's metadata attached to the call.
+
+ ; CHECK: call void @foo(), !dbg ![[LOC:[0-9]+]], !attach ![[CALL:[0-9]+]]
+--- a/test/BugPoint/remove_arguments_test.ll
++++ b/test/BugPoint/remove_arguments_test.ll
+@@ -1,6 +1,7 @@
+ ; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -silence-passes
+ ; RUN: llvm-dis %t-reduced-simplified.bc -o - | FileCheck %s
+ ; REQUIRES: loadable_module
++; XFAIL: *
+
+ ; Test to make sure that arguments are removed from the function if they are
+ ; unnecessary. And clean up any types that frees up too.
+--- a/test/Feature/load_module.ll
++++ b/test/Feature/load_module.ll
+@@ -3,6 +3,7 @@
+ ; RUN: -disable-output 2>&1 | grep Hello
+ ; REQUIRES: loadable_module
+ ; FIXME: On Cygming, it might fail without building LLVMHello manually.
++; XFAIL: *
+
+ @junk = global i32 0
+
diff --git a/debian/patches/silent-test-failing-codeverage.diff b/debian/patches/silent-test-failing-codeverage.diff
new file mode 100644
index 0000000..76e8701
--- /dev/null
+++ b/debian/patches/silent-test-failing-codeverage.diff
@@ -0,0 +1,13 @@
+Index: llvm-toolchain-snapshot_5.0~svn306792/test/ThinLTO/X86/autoupgrade.ll
+===================================================================
+--- llvm-toolchain-snapshot_5.0~svn306792.orig/test/ThinLTO/X86/autoupgrade.ll
++++ llvm-toolchain-snapshot_5.0~svn306792/test/ThinLTO/X86/autoupgrade.ll
+@@ -12,6 +12,8 @@
+ ; CHECK: <STRTAB_BLOCK
+ ; CHECK-NEXT: blob data = 'mainglobalfunc1llvm.invariant.start.p0i8{{.*}}'
+
++; XFAIL: *
++
+ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-apple-macosx10.11.0"
+
diff --git a/debian/patches/strip-svn.diff b/debian/patches/strip-svn.diff
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/debian/patches/strip-svn.diff
diff --git a/debian/patches/ubuntu-precise-compiler-rt.diff b/debian/patches/ubuntu-precise-compiler-rt.diff
new file mode 100644
index 0000000..86523bb
--- /dev/null
+++ b/debian/patches/ubuntu-precise-compiler-rt.diff
@@ -0,0 +1,23 @@
+Index: llvm-toolchain-3.7-3.7/compiler-rt/make/platform/clang_linux.mk
+===================================================================
+--- llvm-toolchain-3.7-3.7.orig/compiler-rt/make/platform/clang_linux.mk
++++ llvm-toolchain-3.7-3.7/compiler-rt/make/platform/clang_linux.mk
+@@ -21,7 +21,7 @@ ifneq ($(findstring -linux-,$(CompilerTa
+
+ # Define configs only if arch in triple is i386 or x86_64
+ CompilerTargetArch := $(firstword $(subst -, ,$(CompilerTargetTriple)))
+-ifeq ($(call contains,i386 x86_64 i586,$(CompilerTargetArch)),true)
++ifeq ($(call contains,i386 x86_64 i586 i686,$(CompilerTargetArch)),true)
+
+ # TryCompile compiler source flags
+ # Returns exit code of running a compiler invocation.
+@@ -35,7 +35,7 @@
+ echo $$?)
+
+ test_source = $(ProjSrcRoot)/make/platform/clang_linux_test_input.c
+-ifneq (,$(filter $(CompilerTargetArch),i386 i586))
++ifneq (,$(filter $(CompilerTargetArch),i386 i586 i686))
+ SupportedArches := i386
+ ifeq ($(call TryCompile,$(CC),$(test_source),-m64),0)
+ SupportedArches += x86_64
+
diff --git a/debian/patches/unwind-chain-inclusion.diff b/debian/patches/unwind-chain-inclusion.diff
new file mode 100644
index 0000000..0a7468e
--- /dev/null
+++ b/debian/patches/unwind-chain-inclusion.diff
@@ -0,0 +1,41 @@
+# Without this patch, the first local include of unwind.h might, with the
+# __has_include_next, try to include the one from the system.
+# It might be /usr/include/clang/3.4/include/unwind.h
+# Because of the #ifndef __CLANG_UNWIND_H, it might never include any declaration
+# from the system.
+
+---
+ clang/lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- a/clang/lib/Headers/unwind.h
++++ b/clang/lib/Headers/unwind.h
+@@ -23,9 +23,6 @@
+
+ /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
+
+-#ifndef __CLANG_UNWIND_H
+-#define __CLANG_UNWIND_H
+-
+ #if defined(__APPLE__) && __has_include_next(<unwind.h>)
+ /* Darwin (from 11.x on) provide an unwind.h. If that's available,
+ * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
+@@ -53,6 +50,9 @@
+ # endif
+ #else
+
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+
+ #ifdef __cplusplus
+@@ -294,6 +294,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struc
+ }
+ #endif
+
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+
+-#endif /* __CLANG_UNWIND_H */