Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] llvm: Update to 11.0.0
@ 2020-11-09  0:46 Snektron
  2020-11-09  1:05 ` [PR PATCH] [Updated] " Snektron
                   ` (32 more replies)
  0 siblings, 33 replies; 34+ messages in thread
From: Snektron @ 2020-11-09  0:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]

There is a new pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 62482 bytes --]

From 9fd98e4e5728f3066e965aaa6a2d2858f116f537 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:10:10 +0100
Subject: [PATCH 1/5] New package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm/template                         |   8 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 740 insertions(+), 17 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..1ff8aaa239c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 uncoditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -213,9 +213,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -893,6 +893,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
+   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
+ endif()
+ 
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if(NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++  llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..ec291544474
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="Robin Voetter <robin@voetter.nl>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From d59d98ffb86234ccaae615ffa8043a8a1d9cdfed Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 2/5] Rebuild llvm10 standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 2037323b06ee49a440f0151060a675a6ef3ba051 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 3/5] llvm-libunwind: Update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 80c9ef8b3dda9acaa30f9e6033e7ddfb53f90272 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 4/5] libcxxabi: Update to 11.0.0

---
 srcpkgs/libcxxabi/template | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..8237bc4901e 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -27,10 +27,8 @@ esac
 
 post_extract() {
 	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From 40886497fe72dd4cfd96d5ff9ce57b3f1e764063 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 5/5] libcxx: Update to 11.0.0

---
 srcpkgs/libcxx/template | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..a449cc43dcf 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,28 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +30,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+    # Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
@ 2020-11-09  1:05 ` Snektron
  2020-11-09  1:33 ` [PR REVIEW] [WIP] " fosslinux
                   ` (31 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09  1:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1224 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 62479 bytes --]

From 9fd98e4e5728f3066e965aaa6a2d2858f116f537 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:10:10 +0100
Subject: [PATCH 1/5] New package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm/template                         |   8 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 740 insertions(+), 17 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..1ff8aaa239c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 uncoditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -213,9 +213,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -893,6 +893,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
+   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
+ endif()
+ 
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if(NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++  llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..ec291544474
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="Robin Voetter <robin@voetter.nl>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From d59d98ffb86234ccaae615ffa8043a8a1d9cdfed Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 2/5] Rebuild llvm10 standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 2037323b06ee49a440f0151060a675a6ef3ba051 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 3/5] llvm-libunwind: Update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 80c9ef8b3dda9acaa30f9e6033e7ddfb53f90272 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 4/5] libcxxabi: Update to 11.0.0

---
 srcpkgs/libcxxabi/template | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..8237bc4901e 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -27,10 +27,8 @@ esac
 
 post_extract() {
 	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From 42ffd1253c829d2642d2c7eaf7f2f56bba8b736a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 5/5] libcxx: Update to 11.0.0

---
 srcpkgs/libcxx/template | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..2dfc71c4df8 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,28 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +30,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR REVIEW] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
  2020-11-09  1:05 ` [PR PATCH] [Updated] " Snektron
@ 2020-11-09  1:33 ` fosslinux
  2020-11-09  1:33 ` fosslinux
                   ` (30 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: fosslinux @ 2020-11-09  1:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

New review comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#discussion_r519509160

Comment:
Put quote on previous line

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR REVIEW] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
  2020-11-09  1:05 ` [PR PATCH] [Updated] " Snektron
  2020-11-09  1:33 ` [PR REVIEW] [WIP] " fosslinux
@ 2020-11-09  1:33 ` fosslinux
  2020-11-09  1:33 ` fosslinux
                   ` (29 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: fosslinux @ 2020-11-09  1:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

New review comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#discussion_r519509402

Comment:
Get rid of the comment too

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR REVIEW] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (2 preceding siblings ...)
  2020-11-09  1:33 ` fosslinux
@ 2020-11-09  1:33 ` fosslinux
  2020-11-09  1:33 ` fosslinux
                   ` (28 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: fosslinux @ 2020-11-09  1:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 164 bytes --]

New review comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#discussion_r519509594

Comment:
unconditionally

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR REVIEW] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (3 preceding siblings ...)
  2020-11-09  1:33 ` fosslinux
@ 2020-11-09  1:33 ` fosslinux
  2020-11-09  1:33 ` fosslinux
                   ` (27 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: fosslinux @ 2020-11-09  1:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

New review comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#discussion_r519509240

Comment:
Remind myself to check whether this is correct

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR REVIEW] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (4 preceding siblings ...)
  2020-11-09  1:33 ` fosslinux
@ 2020-11-09  1:33 ` fosslinux
  2020-11-09  1:34 ` fosslinux
                   ` (26 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: fosslinux @ 2020-11-09  1:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

New review comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#discussion_r519510160

Comment:
Maybe `llvm-003-ppc-secureplt.patch` would be a better name

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (5 preceding siblings ...)
  2020-11-09  1:33 ` fosslinux
@ 2020-11-09  1:34 ` fosslinux
  2020-11-09  1:57 ` [PR REVIEW] " Snektron
                   ` (25 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: fosslinux @ 2020-11-09  1:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#issuecomment-723705315

Comment:
Also lowercase `update` rather than `Update` is the convention but dosen't really matter. The llvm10 commit should be `llvm10: rebuild standalone.`.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR REVIEW] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (6 preceding siblings ...)
  2020-11-09  1:34 ` fosslinux
@ 2020-11-09  1:57 ` Snektron
  2020-11-09  1:58 ` [PR PATCH] [Updated] " Snektron
                   ` (24 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09  1:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

New review comment by Snektron on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#discussion_r519515403

Comment:
The line which this sed expression is supposed to change does no longer exist in the relevant file. What should i put here?

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (7 preceding siblings ...)
  2020-11-09  1:57 ` [PR REVIEW] " Snektron
@ 2020-11-09  1:58 ` Snektron
  2020-11-09  2:39 ` Snektron
                   ` (23 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09  1:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 69139 bytes --]

From 9fd98e4e5728f3066e965aaa6a2d2858f116f537 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:10:10 +0100
Subject: [PATCH 01/13] New package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm/template                         |   8 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 740 insertions(+), 17 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..1ff8aaa239c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 uncoditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -213,9 +213,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -893,6 +893,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
+   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
+ endif()
+ 
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if(NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++  llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..ec291544474
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="Robin Voetter <robin@voetter.nl>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From d59d98ffb86234ccaae615ffa8043a8a1d9cdfed Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 02/13] Rebuild llvm10 standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 2037323b06ee49a440f0151060a675a6ef3ba051 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 03/13] llvm-libunwind: Update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 80c9ef8b3dda9acaa30f9e6033e7ddfb53f90272 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 04/13] libcxxabi: Update to 11.0.0

---
 srcpkgs/libcxxabi/template | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..8237bc4901e 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -27,10 +27,8 @@ esac
 
 post_extract() {
 	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From 42ffd1253c829d2642d2c7eaf7f2f56bba8b736a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 05/13] libcxx: Update to 11.0.0

---
 srcpkgs/libcxx/template | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..2dfc71c4df8 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,28 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +30,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From 53990a1ca05dda9463f32d842f8fee2085fcbb3e Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:14:07 +0100
Subject: [PATCH 06/13] llvm11: change maintainer to q66

---
 srcpkgs/llvm11/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
index ec291544474..78937672a47 100644
--- a/srcpkgs/llvm11/template
+++ b/srcpkgs/llvm11/template
@@ -17,7 +17,7 @@ makedepends="python3-devel zlib-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel libatomic-devel"
 depends="libllvm11"
 short_desc="Low Level Virtual Machine"
-maintainer="Robin Voetter <robin@voetter.nl>"
+maintainer="q66 <daniel@octaforce.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
 distfiles="

From a432dbefc83575bda23ee67efecccfab580ebd53 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 07/13] mesa: bump revision

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From bbc7da077453ea28888109b8a95dccc4ae567579 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 08/13] shiboken2: bump revision

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 0cb1ddecee79ab05a9a95b26118bff2eae4a2758 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 09/13] gnome-builder: bump revision

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From a89003bc4c2a2fcd474adae3f27758f551748283 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 10/13] juCi++: bump revision

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From d62f74f746c98575df866d6c81ff6f76d271711c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:52:21 +0100
Subject: [PATCH 11/13] libcxx: fix style

---
 srcpkgs/libcxx/template | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 2dfc71c4df8..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -17,8 +17,7 @@ homepage="https://libcxx.llvm.org"
 distfiles="
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
-"
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
 checksum="
  6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
  58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15

From a04f151148d80048743d085768524914052add69 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:54:43 +0100
Subject: [PATCH 12/13] llvm11: spelling

---
 .../llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
index 1ff8aaa239c..e5b454c5db9 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -1,4 +1,4 @@
-This patches LLVM to use ELFv2 on ppc64 uncoditionally unless overridden. We
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
 need this because unlike most distros we use ELFv2 for both glibc and musl
 on big endian ppc64.
 

From 3cff9991a58919c6bba0138a6757488a5724802a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:55:37 +0100
Subject: [PATCH 13/13] llvm11: make patch name more descriptive

---
 .../files/patches/llvm/llvm-003-ppc-secureplt.patch   | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch

diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (8 preceding siblings ...)
  2020-11-09  1:58 ` [PR PATCH] [Updated] " Snektron
@ 2020-11-09  2:39 ` Snektron
  2020-11-09  3:02 ` [PR REVIEW] " fosslinux
                   ` (22 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09  2:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 71150 bytes --]

From 9fd98e4e5728f3066e965aaa6a2d2858f116f537 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:10:10 +0100
Subject: [PATCH 01/16] New package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm/template                         |   8 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 740 insertions(+), 17 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..1ff8aaa239c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 uncoditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -213,9 +213,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -893,6 +893,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
+   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
+ endif()
+ 
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if(NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++  llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..ec291544474
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="Robin Voetter <robin@voetter.nl>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From d59d98ffb86234ccaae615ffa8043a8a1d9cdfed Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 02/16] Rebuild llvm10 standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 2037323b06ee49a440f0151060a675a6ef3ba051 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 03/16] llvm-libunwind: Update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 80c9ef8b3dda9acaa30f9e6033e7ddfb53f90272 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 04/16] libcxxabi: Update to 11.0.0

---
 srcpkgs/libcxxabi/template | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..8237bc4901e 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -27,10 +27,8 @@ esac
 
 post_extract() {
 	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From 42ffd1253c829d2642d2c7eaf7f2f56bba8b736a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 05/16] libcxx: Update to 11.0.0

---
 srcpkgs/libcxx/template | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..2dfc71c4df8 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,28 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +30,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From 53990a1ca05dda9463f32d842f8fee2085fcbb3e Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:14:07 +0100
Subject: [PATCH 06/16] llvm11: change maintainer to q66

---
 srcpkgs/llvm11/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
index ec291544474..78937672a47 100644
--- a/srcpkgs/llvm11/template
+++ b/srcpkgs/llvm11/template
@@ -17,7 +17,7 @@ makedepends="python3-devel zlib-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel libatomic-devel"
 depends="libllvm11"
 short_desc="Low Level Virtual Machine"
-maintainer="Robin Voetter <robin@voetter.nl>"
+maintainer="q66 <daniel@octaforce.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
 distfiles="

From a432dbefc83575bda23ee67efecccfab580ebd53 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 07/16] mesa: bump revision

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From bbc7da077453ea28888109b8a95dccc4ae567579 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 08/16] shiboken2: bump revision

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 0cb1ddecee79ab05a9a95b26118bff2eae4a2758 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 09/16] gnome-builder: bump revision

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From a89003bc4c2a2fcd474adae3f27758f551748283 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 10/16] juCi++: bump revision

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From d62f74f746c98575df866d6c81ff6f76d271711c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:52:21 +0100
Subject: [PATCH 11/16] libcxx: fix style

---
 srcpkgs/libcxx/template | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 2dfc71c4df8..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -17,8 +17,7 @@ homepage="https://libcxx.llvm.org"
 distfiles="
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
-"
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
 checksum="
  6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
  58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15

From a04f151148d80048743d085768524914052add69 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:54:43 +0100
Subject: [PATCH 12/16] llvm11: spelling

---
 .../llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
index 1ff8aaa239c..e5b454c5db9 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -1,4 +1,4 @@
-This patches LLVM to use ELFv2 on ppc64 uncoditionally unless overridden. We
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
 need this because unlike most distros we use ELFv2 for both glibc and musl
 on big endian ppc64.
 

From 3cff9991a58919c6bba0138a6757488a5724802a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:55:37 +0100
Subject: [PATCH 13/16] llvm11: make patch name more descriptive

---
 .../files/patches/llvm/llvm-003-ppc-secureplt.patch   | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch

diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)

From c259b369b2d89d37e99b89f2926e120da03871a4 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 14/16] qt5: bump revision

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From 135c4b6de32381eb166973028cb5746ca4ff2e7d Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 15/16] qtcreator: bump revision

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From b195e579d60dd36ade19e8ed75997e825078be5f Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:39:47 +0100
Subject: [PATCH 16/16] libcxxabi: remove old comment

---
 srcpkgs/libcxxabi/template | 1 -
 1 file changed, 1 deletion(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 8237bc4901e..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -26,7 +26,6 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
 	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
 	mv ../libcxx-${version}.src ../libcxx
 }

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR REVIEW] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (9 preceding siblings ...)
  2020-11-09  2:39 ` Snektron
@ 2020-11-09  3:02 ` fosslinux
  2020-11-09  7:42 ` fosslinux
                   ` (21 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: fosslinux @ 2020-11-09  3:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 204 bytes --]

New review comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#discussion_r519528942

Comment:
Nothing probably, I'm just looking for anything similar

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (10 preceding siblings ...)
  2020-11-09  3:02 ` [PR REVIEW] " fosslinux
@ 2020-11-09  7:42 ` fosslinux
  2020-11-09  7:42 ` fosslinux
                   ` (20 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: fosslinux @ 2020-11-09  7:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 296 bytes --]

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#issuecomment-723828400

Comment:
Rather than `bump revision` a better commit message would be `rebuild for llvm11`. Also, before this is merged, all the commits will need to be squashed.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (11 preceding siblings ...)
  2020-11-09  7:42 ` fosslinux
@ 2020-11-09  7:42 ` fosslinux
  2020-11-09 12:11 ` [PR PATCH] [Updated] " Snektron
                   ` (19 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: fosslinux @ 2020-11-09  7:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#issuecomment-723828400

Comment:
Rather than `bump revision` a better commit message would be `rebuild for llvm11`. Also, before this is merged, all the commits for each package will need to be squashed.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (12 preceding siblings ...)
  2020-11-09  7:42 ` fosslinux
@ 2020-11-09 12:11 ` Snektron
  2020-11-09 12:59 ` Snektron
                   ` (18 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 12:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 70967 bytes --]

From bbdadfcaac5b2f984000d792df1f413311261a8c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:10:10 +0100
Subject: [PATCH 01/15] New package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm/template                         |   8 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 .../patches/llvm/llvm-003-secureplt.patch     |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 28 files changed, 751 insertions(+), 17 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..e5b454c5db9
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -213,9 +213,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -893,6 +893,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
+   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
+ endif()
+ 
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if(NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++  llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From c9ef6fbc64bd8552c5805b40ac0af46c5da84004 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 02/15] Rebuild llvm10 standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 325c9e63d6a3bdaa70569ad89eb984a4e967221d Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 03/15] llvm-libunwind: Update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 4fe0893c886e9b3cd63ca5d9062ab0c893607501 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 04/15] libcxxabi: Update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From a67038b0c8f2c98ffdf4f2307db00d84d90eee9e Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 05/15] libcxx: Update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From f17c0fb249a0de957e27fc5ca6e9547a3cb3327b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 06/15] mesa: bump revision

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From 2162c4b31e46981bc658027f7fede8900e5c2c81 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 07/15] shiboken2: bump revision

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 14698b8cd325b4219df1a4ecd88e23a0373a3654 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 08/15] gnome-builder: bump revision

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 18b7d207b076b6bde679a300dc27b446f363c42c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 09/15] juCi++: bump revision

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From d0ec1d024bde2d44b45fb065486321dcc77050b6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 10/15] qt5: bump revision

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From 051704469b93bb7d9852ca8f25c0826910aad3b2 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 11/15] qtcreator: bump revision

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From af5db0d20eb380a8bdac23f5749e69b9ba5b111b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 12/15] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From 16b9a11a592ab11d7a20360b0e34d0ccb000a894 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 13/15] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From 44105415234f8d5c911a959a197ffa14f3628c88 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 14/15] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From d1a86a8aba485227ac8b9cafafff8cb25acb9a19 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 15/15] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index bebfa0f4c61..7346474a7cd 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20190823.6
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (13 preceding siblings ...)
  2020-11-09 12:11 ` [PR PATCH] [Updated] " Snektron
@ 2020-11-09 12:59 ` Snektron
  2020-11-09 13:01 ` Snektron
                   ` (17 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 12:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 70578 bytes --]

From 67a605fc98058de41b1f26dd296ae3857aa71134 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:10:10 +0100
Subject: [PATCH 01/16] New package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm/template                         |   8 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 740 insertions(+), 17 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 84ab31059d56a2a31b021e856904744bb050af6e Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 02/16] Rebuild llvm10 standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From a29c030853afda47ef135502503d4e6d5ecf53e7 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 03/16] llvm-libunwind: Update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 00cecb51f06079ffbf26a8e3096b30560830c23c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 04/16] libcxxabi: Update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From 6a55e019a57ecfdcf94278a7f44cf1bfa00a196b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 05/16] libcxx: Update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From 2810f6166acdbaad9e70e0f38bc6e66c9a942fd5 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 06/16] mesa: bump revision

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From 597125f121689208eb51149977d7942932e0888e Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 07/16] shiboken2: bump revision

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 63194a9547b5b9502e3da5b05750259f87902b9a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 08/16] gnome-builder: bump revision

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From dce1197a1e90f74344cba196e8c6104cc6eed365 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 09/16] juCi++: bump revision

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From 36fc2446ad598d614160d5bc4404d0abb271fc52 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 10/16] qt5: bump revision

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From a7bc79e34b1d04250d1e41bb09be1f603818fdec Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 11/16] qtcreator: bump revision

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 07d899cd0db84bbaac44fa66f91fdb38892833d6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 12/16] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From 558672c411659be0ece4eb2a68abe8c991c99c17 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 13/16] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From d0c1cf73d9d2742105a9082f5b097c36c9d15876 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 14/16] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From 12a9a5af8dfdcd16102fa12bc30acc7a633daa60 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 15/16] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index bebfa0f4c61..7346474a7cd 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20190823.6
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From eeae27bb2f45f76f907b7379529a09b54b7ed9a8 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 16/16] isp: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (14 preceding siblings ...)
  2020-11-09 12:59 ` Snektron
@ 2020-11-09 13:01 ` Snektron
  2020-11-09 13:03 ` Snektron
                   ` (16 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 13:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 70608 bytes --]

From 67a605fc98058de41b1f26dd296ae3857aa71134 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:10:10 +0100
Subject: [PATCH 01/16] New package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm/template                         |   8 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 740 insertions(+), 17 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 84ab31059d56a2a31b021e856904744bb050af6e Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 02/16] Rebuild llvm10 standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From a29c030853afda47ef135502503d4e6d5ecf53e7 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 03/16] llvm-libunwind: Update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 00cecb51f06079ffbf26a8e3096b30560830c23c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 04/16] libcxxabi: Update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From 6a55e019a57ecfdcf94278a7f44cf1bfa00a196b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 05/16] libcxx: Update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From 8e4380eab1aa632f9d6a2296b1698317a9b68211 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 06/16] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From eb124ba102330f63436c29eef3f0b08298405451 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 07/16] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From c144524bbf0fc84f0b18e3f006c28140fedf669a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 08/16] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 7d438f1c16432467ea893a54569a6d7d2450a637 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 09/16] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From b1ad7d7fcdf4140707453fd3188709571de9eecc Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 10/16] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From 0093bcd827c512a0450fb31a5186554e01775378 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 11/16] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 16c9a3876ac87e723957822f08e48e0ce4e13bcf Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 12/16] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From b2110e2706eddae0c2e3ff6080b535823da3ea06 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 13/16] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From 85a8368a3d350f9f230fbb77584d96d1527bb763 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 14/16] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From 8e989efadfcdcb2305b1e643279de1f52081c8f6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 15/16] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index bebfa0f4c61..7346474a7cd 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20190823.6
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From f482a3619eddad30e5fa79e54094739997dd7099 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 16/16] isp: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (15 preceding siblings ...)
  2020-11-09 13:01 ` Snektron
@ 2020-11-09 13:03 ` Snektron
  2020-11-09 14:20 ` Snektron
                   ` (15 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 13:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 70609 bytes --]

From 67a605fc98058de41b1f26dd296ae3857aa71134 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:10:10 +0100
Subject: [PATCH 01/16] New package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm/template                         |   8 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 740 insertions(+), 17 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 84ab31059d56a2a31b021e856904744bb050af6e Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 02/16] Rebuild llvm10 standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From a29c030853afda47ef135502503d4e6d5ecf53e7 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 03/16] llvm-libunwind: Update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 00cecb51f06079ffbf26a8e3096b30560830c23c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 04/16] libcxxabi: Update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From 6a55e019a57ecfdcf94278a7f44cf1bfa00a196b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 05/16] libcxx: Update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From 8e4380eab1aa632f9d6a2296b1698317a9b68211 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 06/16] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From eb124ba102330f63436c29eef3f0b08298405451 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 07/16] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From c144524bbf0fc84f0b18e3f006c28140fedf669a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 08/16] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 7d438f1c16432467ea893a54569a6d7d2450a637 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 09/16] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From b1ad7d7fcdf4140707453fd3188709571de9eecc Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 10/16] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From 0093bcd827c512a0450fb31a5186554e01775378 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 11/16] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 16c9a3876ac87e723957822f08e48e0ce4e13bcf Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 12/16] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From b2110e2706eddae0c2e3ff6080b535823da3ea06 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 13/16] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From 85a8368a3d350f9f230fbb77584d96d1527bb763 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 14/16] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From 8e989efadfcdcb2305b1e643279de1f52081c8f6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 15/16] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index bebfa0f4c61..7346474a7cd 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20190823.6
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From 81b4b4bae6c3beb966fc8a8fd9bb75d5ebf74bf3 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 16/16] ispc: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (16 preceding siblings ...)
  2020-11-09 13:03 ` Snektron
@ 2020-11-09 14:20 ` Snektron
  2020-11-09 16:46 ` Snektron
                   ` (14 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 14:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 102302 bytes --]

From 67a605fc98058de41b1f26dd296ae3857aa71134 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:10:10 +0100
Subject: [PATCH 01/19] New package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm/template                         |   8 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 740 insertions(+), 17 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 84ab31059d56a2a31b021e856904744bb050af6e Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 02/19] Rebuild llvm10 standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From a29c030853afda47ef135502503d4e6d5ecf53e7 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 03/19] llvm-libunwind: Update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 00cecb51f06079ffbf26a8e3096b30560830c23c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 04/19] libcxxabi: Update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From 6a55e019a57ecfdcf94278a7f44cf1bfa00a196b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 05/19] libcxx: Update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From 8e4380eab1aa632f9d6a2296b1698317a9b68211 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 06/19] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From eb124ba102330f63436c29eef3f0b08298405451 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 07/19] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From c144524bbf0fc84f0b18e3f006c28140fedf669a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 08/19] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 7d438f1c16432467ea893a54569a6d7d2450a637 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 09/19] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From b1ad7d7fcdf4140707453fd3188709571de9eecc Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 10/19] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From 0093bcd827c512a0450fb31a5186554e01775378 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 11/19] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 16c9a3876ac87e723957822f08e48e0ce4e13bcf Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 12/19] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From b2110e2706eddae0c2e3ff6080b535823da3ea06 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 13/19] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From 85a8368a3d350f9f230fbb77584d96d1527bb763 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 14/19] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From 8e989efadfcdcb2305b1e643279de1f52081c8f6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 15/19] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index bebfa0f4c61..7346474a7cd 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20190823.6
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From 81b4b4bae6c3beb966fc8a8fd9bb75d5ebf74bf3 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 16/19] ispc: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

From 5def8c43d47ddb06a623d1a972032481b48f7905 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:24:20 +0100
Subject: [PATCH 17/19] zig: update to 0.7.0

---
 srcpkgs/zig/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index e34d6471728..727a675383a 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,16 +1,16 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.6.0
-revision=2
+version=0.7.0
+revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
-makedepends="clang llvm10 lld-devel"
+makedepends="clang llvm11 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="MIT"
 homepage="https://ziglang.org/"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204
+checksum=0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83
 nopie=yes
 nocross=yes
 

From 523798f8e54348a2d3338bbefdeac902ca90d6c6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:41:53 +0100
Subject: [PATCH 18/19] clazy: rebuild for llvm11

---
 .../files/clazy-001-llvm11-stringref.patch    | 343 ++++++++++++++++++
 .../files/clazy-002-llvm11-stringref.patch    |  28 ++
 srcpkgs/clazy/template                        |   8 +-
 3 files changed, 378 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch

diff --git a/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..48049fa594a
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
@@ -0,0 +1,343 @@
+From 30d6a2b64f5a05722fdc5d8e3754dbf13425cd62 Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Thu, 4 Jun 2020 17:10:21 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+Also included header file clang/Basic/FileManager.h in src/MiniDumper
+because without this header, class clang::FileEntry in incomplete class
+---
+ src/FixItExporter.cpp                                 | 5 +++--
+ src/MiniAstDumper.cpp                                 | 1 +
+ src/Utils.cpp                                         | 2 +-
+ src/checkbase.cpp                                     | 2 +-
+ src/checks/detachingbase.cpp                          | 2 +-
+ src/checks/level0/qenums.cpp                          | 2 +-
+ src/checks/level0/qt-macros.cpp                       | 4 ++--
+ src/checks/level0/unused-non-trivial-variable.cpp     | 2 +-
+ src/checks/level1/detaching-temporary.cpp             | 2 +-
+ src/checks/level1/non-pod-global-static.cpp           | 2 +-
+ src/checks/level1/qproperty-without-notify.cpp        | 2 +-
+ src/checks/level2/missing-typeinfo.cpp                | 2 +-
+ src/checks/level2/old-style-connect.cpp               | 6 +++---
+ src/checks/level2/rule-of-three.cpp                   | 2 +-
+ src/checks/manuallevel/ifndef-define-typo.cpp         | 6 +++---
+ src/checks/manuallevel/qproperty-type-mismatch.cpp    | 2 +-
+ src/checks/manuallevel/qrequiredresult-candidates.cpp | 2 +-
+ src/checks/manuallevel/qt-keywords.cpp                | 4 ++--
+ src/checks/manuallevel/reserve-candidates.cpp         | 3 ++-
+ 19 files changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/src/FixItExporter.cpp b/src/FixItExporter.cpp
+index f3af2e54..44240cf5 100644
+--- a/src/FixItExporter.cpp
++++ b/src/FixItExporter.cpp
+@@ -68,7 +68,7 @@ void FixItExporter::BeginSourceFile(const LangOptions &LangOpts, const Preproces
+ 
+     const auto id = SourceMgr.getMainFileID();
+     const auto entry = SourceMgr.getFileEntryForID(id);
+-    getTuDiag().MainSourceFile = entry->getName();
++    getTuDiag().MainSourceFile = static_cast<std::string>(entry->getName());
+ }
+ 
+ bool FixItExporter::IncludeInDiagnosticCounts() const
+@@ -89,7 +89,8 @@ tooling::Diagnostic FixItExporter::ConvertDiagnostic(const Diagnostic &Info)
+     // TODO: This returns an empty string: DiagEngine->getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
+     // HACK: capture it at the end of the message: Message text [check-name]
+ 
+-    std::string checkName = DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
++    std::string checkName =
++        static_cast<std::string>(DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID()));
+     std::string messageText;
+ 
+     if (checkName.empty()) {
+diff --git a/src/MiniAstDumper.cpp b/src/MiniAstDumper.cpp
+index 47661749..6124e6e8 100644
+--- a/src/MiniAstDumper.cpp
++++ b/src/MiniAstDumper.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <clang/Frontend/CompilerInstance.h>
+ #include <clang/Frontend/FrontendPluginRegistry.h>
++#include <clang/Basic/FileManager.h>
+ 
+ using namespace clang;
+ using namespace std;
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index 001ced98..b0812fe3 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -878,7 +878,7 @@ string Utils::filenameForLoc(SourceLocation loc, const clang::SourceManager &sm)
+     if (loc.isMacroID())
+         loc = sm.getExpansionLoc(loc);
+ 
+-    const string filename = sm.getFilename(loc);
++    const string filename = static_cast<std::string>(sm.getFilename(loc));
+     auto splitted = clazy::splitString(filename, '/');
+     if (splitted.empty())
+         return {};
+diff --git a/src/checkbase.cpp b/src/checkbase.cpp
+index 8b40e19d..22a426cf 100644
+--- a/src/checkbase.cpp
++++ b/src/checkbase.cpp
+@@ -188,7 +188,7 @@ bool CheckBase::shouldIgnoreFile(SourceLocation loc) const
+     if (!loc.isValid())
+         return true;
+ 
+-    string filename = sm().getFilename(loc);
++    string filename = static_cast<std::string>(sm().getFilename(loc));
+ 
+     return clazy::any_of(m_filesToIgnore, [filename](const std::string &ignored) {
+         return clazy::contains(filename, ignored);
+diff --git a/src/checks/detachingbase.cpp b/src/checks/detachingbase.cpp
+index 70311f42..1b094ee7 100644
+--- a/src/checks/detachingbase.cpp
++++ b/src/checks/detachingbase.cpp
+@@ -57,7 +57,7 @@ bool DetachingBase::isDetachingMethod(CXXMethodDecl *method, DetachingMethodType
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = detachingMethodType == DetachingMethod ? clazy::detachingMethods()
+                                                                                                                      : clazy::detachingMethodsWithConstCounterParts();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     if (it != methodsByType.cend()) {
+         const auto &methods = it->second;
+         if (clazy::contains(methods, clazy::name(method)))
+diff --git a/src/checks/level0/qenums.cpp b/src/checks/level0/qenums.cpp
+index 00075b5c..db8910f2 100644
+--- a/src/checks/level0/qenums.cpp
++++ b/src/checks/level0/qenums.cpp
+@@ -59,7 +59,7 @@ void QEnums::VisitMacroExpands(const Token &MacroNameTok, const SourceRange &ran
+         // We simply check if :: is present because it's very cumbersome to to check for different classes when dealing with the pre-processor
+ 
+         CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+-        string text = Lexer::getSourceText(crange, sm(), lo());
++        string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+         if (clazy::contains(text, "::"))
+             return;
+     }
+diff --git a/src/checks/level0/qt-macros.cpp b/src/checks/level0/qt-macros.cpp
+index d3a587cb..ab8e9f52 100644
+--- a/src/checks/level0/qt-macros.cpp
++++ b/src/checks/level0/qt-macros.cpp
+@@ -44,7 +44,7 @@ void QtMacros::VisitMacroDefined(const Token &MacroNameTok)
+         return;
+ 
+     IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
+-    if (ii && clazy::startsWith(ii->getName(), "Q_OS_"))
++    if (ii && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_"))
+         m_OSMacroExists = true;
+ }
+ 
+@@ -58,7 +58,7 @@ void QtMacros::checkIfDef(const Token &macroNameTok, SourceLocation Loc)
+     if (preProcessorVisitor && preProcessorVisitor->qtVersion() < 51204 && ii->getName() == "Q_OS_WINDOWS") {
+         // Q_OS_WINDOWS was introduced in 5.12.4
+         emitWarning(Loc, "Q_OS_WINDOWS was only introduced in Qt 5.12.4, use Q_OS_WIN instead");
+-    } else if (!m_OSMacroExists && clazy::startsWith(ii->getName(), "Q_OS_")) {
++    } else if (!m_OSMacroExists && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_")) {
+         emitWarning(Loc, "Include qglobal.h before testing Q_OS_ macros");
+     }
+ }
+diff --git a/src/checks/level0/unused-non-trivial-variable.cpp b/src/checks/level0/unused-non-trivial-variable.cpp
+index 4e4b8303..93815f27 100644
+--- a/src/checks/level0/unused-non-trivial-variable.cpp
++++ b/src/checks/level0/unused-non-trivial-variable.cpp
+@@ -91,7 +91,7 @@ bool UnusedNonTrivialVariable::isUninterestingType(const CXXRecordDecl *record)
+     static const vector<StringRef> blacklistedTemplates = { "QScopedPointer", "QSetValueOnDestroy", "QScopedValueRollback" };
+     StringRef className = clazy::name(record);
+     for (StringRef templateName : blacklistedTemplates) {
+-        if (clazy::startsWith(className, templateName))
++        if (clazy::startsWith(static_cast<std::string>(className), static_cast<std::string>(templateName)))
+             return true;
+     }
+ 
+diff --git a/src/checks/level1/detaching-temporary.cpp b/src/checks/level1/detaching-temporary.cpp
+index fedfc81c..60c75532 100644
+--- a/src/checks/level1/detaching-temporary.cpp
++++ b/src/checks/level1/detaching-temporary.cpp
+@@ -140,7 +140,7 @@ void DetachingTemporary::VisitStmt(clang::Stmt *stm)
+     StringRef className = clazy::name(classDecl);
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = clazy::detachingMethods();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     auto it2 = m_writeMethodsByType.find(className);
+ 
+     std::vector<StringRef> allowedFunctions;
+diff --git a/src/checks/level1/non-pod-global-static.cpp b/src/checks/level1/non-pod-global-static.cpp
+index 5879bff8..433b5c5f 100644
+--- a/src/checks/level1/non-pod-global-static.cpp
++++ b/src/checks/level1/non-pod-global-static.cpp
+@@ -74,7 +74,7 @@ void NonPodGlobalStatic::VisitStmt(clang::Stmt *stm)
+     const SourceLocation declStart = clazy::getLocStart(varDecl);
+ 
+     if (declStart.isMacroID()) {
+-        auto macroName = Lexer::getImmediateMacroName(declStart, sm(), lo());
++        auto macroName = static_cast<std::string>(Lexer::getImmediateMacroName(declStart, sm(), lo()));
+         if (clazy::startsWithAny(macroName, { "Q_IMPORT_PLUGIN", "Q_CONSTRUCTOR_FUNCTION", "Q_DESTRUCTOR_FUNCTION"})) // Don't warn on these
+             return;
+     }
+diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp
+index e1d6db4a..3af9fee2 100644
+--- a/src/checks/level1/qproperty-without-notify.cpp
++++ b/src/checks/level1/qproperty-without-notify.cpp
+@@ -69,7 +69,7 @@ void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok,
+         return;
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/level2/missing-typeinfo.cpp b/src/checks/level2/missing-typeinfo.cpp
+index 98df2cd4..03b44e06 100644
+--- a/src/checks/level2/missing-typeinfo.cpp
++++ b/src/checks/level2/missing-typeinfo.cpp
+@@ -74,7 +74,7 @@ void MissingTypeInfo::VisitDecl(clang::Decl *decl)
+         if (sm().isInSystemHeader(clazy::getLocStart(record)))
+             return;
+ 
+-        std::string typeName = clazy::name(record);
++        std::string typeName = static_cast<std::string>(clazy::name(record));
+         if (typeName == "QPair") // QPair doesn't use Q_DECLARE_TYPEINFO, but rather a explicit QTypeInfo.
+             return;
+ 
+diff --git a/src/checks/level2/old-style-connect.cpp b/src/checks/level2/old-style-connect.cpp
+index 0fe68c13..396cb703 100644
+--- a/src/checks/level2/old-style-connect.cpp
++++ b/src/checks/level2/old-style-connect.cpp
+@@ -274,7 +274,7 @@ void OldStyleConnect::VisitMacroExpands(const Token &macroNameTok, const SourceR
+         return;
+ 
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(Q_PRIVATE_SLOT\s*\((.*)\s*,\s*.*\s+(.*)\(.*)");
+     smatch match;
+@@ -293,7 +293,7 @@ string OldStyleConnect::signalOrSlotNameFromMacro(SourceLocation macroLoc)
+     CharSourceRange expansionRange = clazy::getImmediateExpansionRange(macroLoc, sm());
+     SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(\s*(SIGNAL|SLOT)\s*\(\s*(.+)\s*\(.*)");
+ 
+@@ -315,7 +315,7 @@ bool OldStyleConnect::isSignalOrSlot(SourceLocation loc, string &macroName) cons
+     if (!loc.isMacroID() || loc.isInvalid())
+         return false;
+ 
+-    macroName = Lexer::getImmediateMacroName(loc, sm(), lo());
++    macroName = static_cast<std::string>(Lexer::getImmediateMacroName(loc, sm(), lo()));
+     return macroName == "SIGNAL" || macroName == "SLOT";
+ }
+ 
+diff --git a/src/checks/level2/rule-of-three.cpp b/src/checks/level2/rule-of-three.cpp
+index 8db55d53..7583fcc5 100644
+--- a/src/checks/level2/rule-of-three.cpp
++++ b/src/checks/level2/rule-of-three.cpp
+@@ -140,7 +140,7 @@ void RuleOfThree::VisitDecl(clang::Decl *decl)
+ 
+     const string className = record->getNameAsString();
+     const string classQualifiedName = record->getQualifiedNameAsString();
+-    const string filename = sm().getFilename(recordStart);
++    const string filename = static_cast<std::string>(sm().getFilename(recordStart));
+     if (clazy::endsWith(className, "Private") && clazy::endsWithAny(filename, { ".cpp", ".cxx", "_p.h" }))
+         return; // Lots of RAII classes fall into this category. And even Private (d-pointer) classes, warning in that case would just be noise
+ 
+diff --git a/src/checks/manuallevel/ifndef-define-typo.cpp b/src/checks/manuallevel/ifndef-define-typo.cpp
+index edb6cdf4..e9c50a45 100644
+--- a/src/checks/manuallevel/ifndef-define-typo.cpp
++++ b/src/checks/manuallevel/ifndef-define-typo.cpp
+@@ -44,7 +44,7 @@ void IfndefDefineTypo::VisitMacroDefined(const Token &macroNameTok)
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -53,7 +53,7 @@ void IfndefDefineTypo::VisitDefined(const Token &macroNameTok, const SourceRange
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -66,7 +66,7 @@ void IfndefDefineTypo::VisitIfdef(SourceLocation, const Token &)
+ void IfndefDefineTypo::VisitIfndef(SourceLocation, const Token &macroNameTok)
+ {
+     if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo())
+-        m_lastIfndef = ii->getName();
++        m_lastIfndef = static_cast<std::string>(ii->getName());
+ }
+ 
+ void IfndefDefineTypo::VisitIf(SourceLocation, SourceRange, PPCallbacks::ConditionValueKind)
+diff --git a/src/checks/manuallevel/qproperty-type-mismatch.cpp b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+index f91159cb..952d9f1d 100644
+--- a/src/checks/manuallevel/qproperty-type-mismatch.cpp
++++ b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+@@ -237,7 +237,7 @@ void QPropertyTypeMismatch::VisitMacroExpands(const clang::Token &MacroNameTok,
+ 
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (!text.empty() && text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/manuallevel/qrequiredresult-candidates.cpp b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+index 912dbaa0..6375bd7b 100644
+--- a/src/checks/manuallevel/qrequiredresult-candidates.cpp
++++ b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+@@ -65,7 +65,7 @@ void QRequiredResultCandidates::VisitDecl(clang::Decl *decl)
+ 
+ 
+     if (returnClass == classDecl) {
+-        const std::string methodName = clazy::name(method);
++        const std::string methodName = static_cast<std::string>(clazy::name(method));
+         if (methodName.empty()) // fixes assert
+             return;
+ 
+diff --git a/src/checks/manuallevel/qt-keywords.cpp b/src/checks/manuallevel/qt-keywords.cpp
+index e792e95a..b60752c9 100644
+--- a/src/checks/manuallevel/qt-keywords.cpp
++++ b/src/checks/manuallevel/qt-keywords.cpp
+@@ -59,12 +59,12 @@ void QtKeywords::VisitMacroExpands(const Token &macroNameTok, const SourceRange
+     }
+ 
+     static const vector<StringRef> keywords = { "foreach", "signals", "slots", "emit" };
+-    std::string name = ii->getName();
++    std::string name = static_cast<std::string>(ii->getName());
+     if (!clazy::contains(keywords, name))
+         return;
+ 
+     // Make sure the macro is Qt's. It must be defined in Qt's headers, not 3rdparty
+-    std::string qtheader = sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc()));
++    std::string qtheader = static_cast<std::string>(sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc())));
+     if (!clazy::endsWith(qtheader, "qglobal.h") && !clazy::endsWith(qtheader, "qobjectdefs.h"))
+         return;
+ 
+diff --git a/src/checks/manuallevel/reserve-candidates.cpp b/src/checks/manuallevel/reserve-candidates.cpp
+index 389cac5a..92e4491c 100644
+--- a/src/checks/manuallevel/reserve-candidates.cpp
++++ b/src/checks/manuallevel/reserve-candidates.cpp
+@@ -78,7 +78,8 @@ static bool isCandidateMethod(CXXMethodDecl *methodDecl)
+     if (!classDecl)
+         return false;
+ 
+-    if (!clazy::equalsAny(clazy::name(methodDecl), { "append", "push_back", "push", "operator<<", "operator+=" }))
++    if (!clazy::equalsAny(static_cast<std::string>(clazy::name(methodDecl)),
++                 { "append", "push_back", "push", "operator<<", "operator+=" }))
+         return false;
+ 
+     if (!clazy::isAReserveClass(classDecl))
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
new file mode 100644
index 00000000000..28cbb60b091
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
@@ -0,0 +1,28 @@
+From 25aa102cc49def9573ffbed88155589cd60a2e8f Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Fri, 5 Jun 2020 16:52:53 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10 (clazy-standalone)
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+---
+ src/checks/manuallevel/jnisignatures.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/checks/manuallevel/jnisignatures.cpp b/src/checks/manuallevel/jnisignatures.cpp
+index 81e61d48..5d4fe203 100644
+--- a/src/checks/manuallevel/jnisignatures.cpp
++++ b/src/checks/manuallevel/jnisignatures.cpp
+@@ -103,7 +103,7 @@ void JniSignatures::checkFunctionCall(Stmt *stm)
+         return;
+     }
+ 
+-    const std::string name = clazy::name(funDecl);
++    const std::string name = static_cast<std::string>(clazy::name(funDecl));
+ 
+     if (name == "callObjectMethod" || name == "callMethod") {
+         checkArgAt(callExpr, 0, methodNameRegex, "Invalid method name");
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 4d8557be669..5af2b918e14 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.7
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"
@@ -12,3 +12,9 @@ homepage="https://cgit.kde.org/clazy.git/about/"
 distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
 checksum=754da5815f769dd6b72a040a2430525c93f294eb7769c78271603df9614f1b21
 nocross="Clang cannot be installed as makedep"
+
+post_extract() {
+	for i in ${FILESDIR}/clazy-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}

From ee58dcfde57e850ae764c6a456433efa36d94e35 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 15:19:37 +0100
Subject: [PATCH 19/19] include-what-you-use: rebuild for llvm11

---
 ...de-what-you-use-001-llvm11-stringref.patch | 146 ++++++++++++++++++
 ...ude-what-you-use-002-clang-astdumper.patch |  54 +++++++
 srcpkgs/include-what-you-use/template         |   8 +-
 3 files changed, 207 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch

diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..171dca28e34
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
@@ -0,0 +1,146 @@
+From 53487d209729d5781007dc0fd6076dc585cb3727 Mon Sep 17 00:00:00 2001
+From: Andrea Bocci <andrea.bocci@cern.ch>
+Date: Fri, 28 Feb 2020 17:45:03 +0100
+Subject: [PATCH] Add explicit conversion from llvm::StringRef to std::string
+
+llvm/llvm-project@777180a makes the llvm::StringRef conversion operator
+to std::string explicit.
+These changes add a call to the str() method to perform the conversion.
+
+Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
+---
+ iwyu_driver.cc       | 2 +-
+ iwyu_globals.cc      | 4 ++--
+ iwyu_lexer_utils.cc  | 2 +-
+ iwyu_location_util.h | 2 +-
+ iwyu_output.cc       | 2 +-
+ iwyu_path_util.cc    | 6 +++---
+ iwyu_preprocessor.cc | 4 ++--
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/iwyu_driver.cc b/iwyu_driver.cc
+index bd163144..42fea35b 100644
+--- a/iwyu_driver.cc
++++ b/iwyu_driver.cc
+@@ -79,7 +79,7 @@ std::string GetExecutablePath(const char *Argv0) {
+ }
+ 
+ const char *SaveStringInSet(std::set<std::string> &SavedStrings, StringRef S) {
+-  return SavedStrings.insert(S).first->c_str();
++  return SavedStrings.insert(S.str()).first->c_str();
+ }
+ 
+ void ExpandArgsFromBuf(const char *Arg,
+diff --git a/iwyu_globals.cc b/iwyu_globals.cc
+index 0f58b4dc..26998966 100644
+--- a/iwyu_globals.cc
++++ b/iwyu_globals.cc
+@@ -293,7 +293,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+   for (auto it = header_search->system_dir_begin();
+        it != header_search->system_dir_end(); ++it) {
+     if (const DirectoryEntry* entry = it->getDir()) {
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map[path] = HeaderSearchPath::kSystemPath;
+     }
+   }
+@@ -303,7 +303,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+       // search_dir_begin()/end() includes both system and user paths.
+       // If it's a system path, it's already in the map, so everything
+       // new is a user path.  The insert only 'takes' for new entries.
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map.insert(make_pair(path, HeaderSearchPath::kUserPath));
+     }
+   }
+diff --git a/iwyu_lexer_utils.cc b/iwyu_lexer_utils.cc
+index fcea2d28..648c9da8 100644
+--- a/iwyu_lexer_utils.cc
++++ b/iwyu_lexer_utils.cc
+@@ -70,7 +70,7 @@ SourceLocation GetLocationAfter(
+ string GetIncludeNameAsWritten(
+     SourceLocation include_loc,
+     const CharacterDataGetterInterface& data_getter) {
+-  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter);
++  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter).str();
+   if (data.empty())
+     return data;
+   string::size_type endpos = string::npos;
+diff --git a/iwyu_location_util.h b/iwyu_location_util.h
+index 3892a424..6f8cf81c 100644
+--- a/iwyu_location_util.h
++++ b/iwyu_location_util.h
+@@ -89,7 +89,7 @@ bool IsInScratchSpace(clang::SourceLocation loc);
+ 
+ inline string GetFilePath(const clang::FileEntry* file) {
+   return (IsBuiltinFile(file) ? "<built-in>" :
+-          NormalizeFilePath(file->getName()));
++          NormalizeFilePath(file->getName().str()));
+ }
+ 
+ //------------------------------------------------------------
+diff --git a/iwyu_output.cc b/iwyu_output.cc
+index ca145710..8666c26c 100644
+--- a/iwyu_output.cc
++++ b/iwyu_output.cc
+@@ -168,7 +168,7 @@ string GetKindName(const clang::TagDecl* tag_decl) {
+   if (const FakeNamedDecl* fake = FakeNamedDeclIfItIsOne(named_decl)) {
+     return fake->kind_name();
+   }
+-  return tag_decl->getKindName();
++  return tag_decl->getKindName().str();
+ }
+ 
+ string GetQualifiedNameAsString(const clang::NamedDecl* named_decl) {
+diff --git a/iwyu_path_util.cc b/iwyu_path_util.cc
+index ab4fc800..9987ea47 100644
+--- a/iwyu_path_util.cc
++++ b/iwyu_path_util.cc
+@@ -134,7 +134,7 @@ string NormalizeFilePath(const string& path) {
+   std::replace(normalized.begin(), normalized.end(), '\\', '/');
+ #endif
+ 
+-  return normalized.str();
++  return normalized.str().str();
+ }
+ 
+ string NormalizeDirPath(const string& path) {
+@@ -154,14 +154,14 @@ string MakeAbsolutePath(const string& path) {
+   std::error_code error = llvm::sys::fs::make_absolute(absolute_path);
+   CHECK_(!error);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string MakeAbsolutePath(const string& base_path, const string& relative_path) {
+   llvm::SmallString<128> absolute_path(base_path);
+   llvm::sys::path::append(absolute_path, relative_path);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string GetParentPath(const string& path) {
+diff --git a/iwyu_preprocessor.cc b/iwyu_preprocessor.cc
+index 58e78595..88b93144 100644
+--- a/iwyu_preprocessor.cc
++++ b/iwyu_preprocessor.cc
+@@ -313,7 +313,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+       break;
+     }
+     const string filename = GetSourceTextUntilEndOfLine(current_loc,
+-                                                        DefaultDataGetter());
++                                                        DefaultDataGetter()).str();
+     // Use "" or <> based on where the file lives.
+     string quoted_private_include;
+     if (IsSystemIncludeFile(GetFilePath(current_loc)))
+@@ -332,7 +332,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+     }
+ 
+     string after_text = GetSourceTextUntilEndOfLine(current_loc,
+-                                                    DefaultDataGetter());
++                                                    DefaultDataGetter()).str();
+     const string::size_type close_brace_pos = after_text.find('}');
+     if (close_brace_pos == string::npos) {
+       Warn(current_loc, "@headername directive missing a closing brace");
diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
new file mode 100644
index 00000000000..663a883fa91
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
@@ -0,0 +1,54 @@
+From 30549c6931972456d1e09ff5dbeecd258a8df72b Mon Sep 17 00:00:00 2001
+From: Kim Grasman <kim.grasman@gmail.com>
+Date: Thu, 9 Jul 2020 18:47:56 +0200
+Subject: [PATCH] Implement Stmt printing with ASTDumper
+
+The Clang API changed in commit 473fbc90d1fbf17e so that Stmt::dump
+takes an ASTContext instead of a SourceManager.
+
+Rather than wire a global ASTContext, reimplement PrintableStmt and
+PrintStmt to duplicate the most trivial implementations not requiring
+ASTContext.
+
+No functional change.
+---
+ iwyu_ast_util.cc | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/iwyu_ast_util.cc b/iwyu_ast_util.cc
+index d3d4dd1f..b19a11fb 100644
+--- a/iwyu_ast_util.cc
++++ b/iwyu_ast_util.cc
+@@ -25,6 +25,7 @@
+ #include "llvm/Support/Casting.h"
+ #include "llvm/Support/raw_ostream.h"
+ #include "clang/AST/ASTContext.h"
++#include "clang/AST/ASTDumper.h"
+ #include "clang/AST/CanonicalType.h"
+ #include "clang/AST/Decl.h"
+ #include "clang/AST/DeclBase.h"
+@@ -46,6 +47,7 @@ namespace clang {
+ class FileEntry;
+ }  // namespace clang
+ 
++using clang::ASTDumper;
+ using clang::BlockPointerType;
+ using clang::CXXConstructExpr;
+ using clang::CXXConstructorDecl;
+@@ -450,12 +452,14 @@ string PrintableDecl(const Decl* decl, bool terse/*=true*/) {
+ string PrintableStmt(const Stmt* stmt) {
+   std::string buffer;
+   raw_string_ostream ostream(buffer);
+-  stmt->dump(ostream, *GlobalSourceManager());
++  ASTDumper dumper(ostream, /*ShowColors=*/false);
++  dumper.Visit(stmt);
+   return ostream.str();
+ }
+ 
+ void PrintStmt(const Stmt* stmt) {
+-  stmt->dump(*GlobalSourceManager());  // This prints to errs().
++  ASTDumper dumper(llvm::errs(), /*ShowColors=*/false);
++  dumper.Visit(stmt);
+ }
+ 
+ string PrintableType(const Type* type) {
diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 22c9d09d091..3811309bdde 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.14
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
@@ -15,6 +15,12 @@ distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.
 checksum=43184397db57660c32e3298a6b1fd5ab82e808a1f5ab0591d6745f8d256200ef
 python_version=3
 
+post_extract() {
+	for i in ${FILESDIR}/include-what-you-use-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
+
 post_install() {
 	vlicense LICENSE.TXT
 }

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (17 preceding siblings ...)
  2020-11-09 14:20 ` Snektron
@ 2020-11-09 16:46 ` Snektron
  2020-11-09 16:56 ` q66
                   ` (13 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 16:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 115693 bytes --]

From 67a605fc98058de41b1f26dd296ae3857aa71134 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:10:10 +0100
Subject: [PATCH 01/20] New package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm/template                         |   8 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 740 insertions(+), 17 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 84ab31059d56a2a31b021e856904744bb050af6e Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 02/20] Rebuild llvm10 standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From a29c030853afda47ef135502503d4e6d5ecf53e7 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 03/20] llvm-libunwind: Update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 00cecb51f06079ffbf26a8e3096b30560830c23c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 04/20] libcxxabi: Update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From 6a55e019a57ecfdcf94278a7f44cf1bfa00a196b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 05/20] libcxx: Update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From 8e4380eab1aa632f9d6a2296b1698317a9b68211 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 06/20] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From eb124ba102330f63436c29eef3f0b08298405451 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 07/20] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From c144524bbf0fc84f0b18e3f006c28140fedf669a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 08/20] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 7d438f1c16432467ea893a54569a6d7d2450a637 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 09/20] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From b1ad7d7fcdf4140707453fd3188709571de9eecc Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 10/20] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From 0093bcd827c512a0450fb31a5186554e01775378 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 11/20] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 16c9a3876ac87e723957822f08e48e0ce4e13bcf Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 12/20] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From b2110e2706eddae0c2e3ff6080b535823da3ea06 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 13/20] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From 85a8368a3d350f9f230fbb77584d96d1527bb763 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 14/20] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From 8e989efadfcdcb2305b1e643279de1f52081c8f6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 15/20] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index bebfa0f4c61..7346474a7cd 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20190823.6
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From 81b4b4bae6c3beb966fc8a8fd9bb75d5ebf74bf3 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 16/20] ispc: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

From 5def8c43d47ddb06a623d1a972032481b48f7905 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:24:20 +0100
Subject: [PATCH 17/20] zig: update to 0.7.0

---
 srcpkgs/zig/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index e34d6471728..727a675383a 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,16 +1,16 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.6.0
-revision=2
+version=0.7.0
+revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
-makedepends="clang llvm10 lld-devel"
+makedepends="clang llvm11 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="MIT"
 homepage="https://ziglang.org/"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204
+checksum=0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83
 nopie=yes
 nocross=yes
 

From 523798f8e54348a2d3338bbefdeac902ca90d6c6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:41:53 +0100
Subject: [PATCH 18/20] clazy: rebuild for llvm11

---
 .../files/clazy-001-llvm11-stringref.patch    | 343 ++++++++++++++++++
 .../files/clazy-002-llvm11-stringref.patch    |  28 ++
 srcpkgs/clazy/template                        |   8 +-
 3 files changed, 378 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch

diff --git a/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..48049fa594a
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
@@ -0,0 +1,343 @@
+From 30d6a2b64f5a05722fdc5d8e3754dbf13425cd62 Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Thu, 4 Jun 2020 17:10:21 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+Also included header file clang/Basic/FileManager.h in src/MiniDumper
+because without this header, class clang::FileEntry in incomplete class
+---
+ src/FixItExporter.cpp                                 | 5 +++--
+ src/MiniAstDumper.cpp                                 | 1 +
+ src/Utils.cpp                                         | 2 +-
+ src/checkbase.cpp                                     | 2 +-
+ src/checks/detachingbase.cpp                          | 2 +-
+ src/checks/level0/qenums.cpp                          | 2 +-
+ src/checks/level0/qt-macros.cpp                       | 4 ++--
+ src/checks/level0/unused-non-trivial-variable.cpp     | 2 +-
+ src/checks/level1/detaching-temporary.cpp             | 2 +-
+ src/checks/level1/non-pod-global-static.cpp           | 2 +-
+ src/checks/level1/qproperty-without-notify.cpp        | 2 +-
+ src/checks/level2/missing-typeinfo.cpp                | 2 +-
+ src/checks/level2/old-style-connect.cpp               | 6 +++---
+ src/checks/level2/rule-of-three.cpp                   | 2 +-
+ src/checks/manuallevel/ifndef-define-typo.cpp         | 6 +++---
+ src/checks/manuallevel/qproperty-type-mismatch.cpp    | 2 +-
+ src/checks/manuallevel/qrequiredresult-candidates.cpp | 2 +-
+ src/checks/manuallevel/qt-keywords.cpp                | 4 ++--
+ src/checks/manuallevel/reserve-candidates.cpp         | 3 ++-
+ 19 files changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/src/FixItExporter.cpp b/src/FixItExporter.cpp
+index f3af2e54..44240cf5 100644
+--- a/src/FixItExporter.cpp
++++ b/src/FixItExporter.cpp
+@@ -68,7 +68,7 @@ void FixItExporter::BeginSourceFile(const LangOptions &LangOpts, const Preproces
+ 
+     const auto id = SourceMgr.getMainFileID();
+     const auto entry = SourceMgr.getFileEntryForID(id);
+-    getTuDiag().MainSourceFile = entry->getName();
++    getTuDiag().MainSourceFile = static_cast<std::string>(entry->getName());
+ }
+ 
+ bool FixItExporter::IncludeInDiagnosticCounts() const
+@@ -89,7 +89,8 @@ tooling::Diagnostic FixItExporter::ConvertDiagnostic(const Diagnostic &Info)
+     // TODO: This returns an empty string: DiagEngine->getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
+     // HACK: capture it at the end of the message: Message text [check-name]
+ 
+-    std::string checkName = DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
++    std::string checkName =
++        static_cast<std::string>(DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID()));
+     std::string messageText;
+ 
+     if (checkName.empty()) {
+diff --git a/src/MiniAstDumper.cpp b/src/MiniAstDumper.cpp
+index 47661749..6124e6e8 100644
+--- a/src/MiniAstDumper.cpp
++++ b/src/MiniAstDumper.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <clang/Frontend/CompilerInstance.h>
+ #include <clang/Frontend/FrontendPluginRegistry.h>
++#include <clang/Basic/FileManager.h>
+ 
+ using namespace clang;
+ using namespace std;
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index 001ced98..b0812fe3 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -878,7 +878,7 @@ string Utils::filenameForLoc(SourceLocation loc, const clang::SourceManager &sm)
+     if (loc.isMacroID())
+         loc = sm.getExpansionLoc(loc);
+ 
+-    const string filename = sm.getFilename(loc);
++    const string filename = static_cast<std::string>(sm.getFilename(loc));
+     auto splitted = clazy::splitString(filename, '/');
+     if (splitted.empty())
+         return {};
+diff --git a/src/checkbase.cpp b/src/checkbase.cpp
+index 8b40e19d..22a426cf 100644
+--- a/src/checkbase.cpp
++++ b/src/checkbase.cpp
+@@ -188,7 +188,7 @@ bool CheckBase::shouldIgnoreFile(SourceLocation loc) const
+     if (!loc.isValid())
+         return true;
+ 
+-    string filename = sm().getFilename(loc);
++    string filename = static_cast<std::string>(sm().getFilename(loc));
+ 
+     return clazy::any_of(m_filesToIgnore, [filename](const std::string &ignored) {
+         return clazy::contains(filename, ignored);
+diff --git a/src/checks/detachingbase.cpp b/src/checks/detachingbase.cpp
+index 70311f42..1b094ee7 100644
+--- a/src/checks/detachingbase.cpp
++++ b/src/checks/detachingbase.cpp
+@@ -57,7 +57,7 @@ bool DetachingBase::isDetachingMethod(CXXMethodDecl *method, DetachingMethodType
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = detachingMethodType == DetachingMethod ? clazy::detachingMethods()
+                                                                                                                      : clazy::detachingMethodsWithConstCounterParts();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     if (it != methodsByType.cend()) {
+         const auto &methods = it->second;
+         if (clazy::contains(methods, clazy::name(method)))
+diff --git a/src/checks/level0/qenums.cpp b/src/checks/level0/qenums.cpp
+index 00075b5c..db8910f2 100644
+--- a/src/checks/level0/qenums.cpp
++++ b/src/checks/level0/qenums.cpp
+@@ -59,7 +59,7 @@ void QEnums::VisitMacroExpands(const Token &MacroNameTok, const SourceRange &ran
+         // We simply check if :: is present because it's very cumbersome to to check for different classes when dealing with the pre-processor
+ 
+         CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+-        string text = Lexer::getSourceText(crange, sm(), lo());
++        string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+         if (clazy::contains(text, "::"))
+             return;
+     }
+diff --git a/src/checks/level0/qt-macros.cpp b/src/checks/level0/qt-macros.cpp
+index d3a587cb..ab8e9f52 100644
+--- a/src/checks/level0/qt-macros.cpp
++++ b/src/checks/level0/qt-macros.cpp
+@@ -44,7 +44,7 @@ void QtMacros::VisitMacroDefined(const Token &MacroNameTok)
+         return;
+ 
+     IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
+-    if (ii && clazy::startsWith(ii->getName(), "Q_OS_"))
++    if (ii && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_"))
+         m_OSMacroExists = true;
+ }
+ 
+@@ -58,7 +58,7 @@ void QtMacros::checkIfDef(const Token &macroNameTok, SourceLocation Loc)
+     if (preProcessorVisitor && preProcessorVisitor->qtVersion() < 51204 && ii->getName() == "Q_OS_WINDOWS") {
+         // Q_OS_WINDOWS was introduced in 5.12.4
+         emitWarning(Loc, "Q_OS_WINDOWS was only introduced in Qt 5.12.4, use Q_OS_WIN instead");
+-    } else if (!m_OSMacroExists && clazy::startsWith(ii->getName(), "Q_OS_")) {
++    } else if (!m_OSMacroExists && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_")) {
+         emitWarning(Loc, "Include qglobal.h before testing Q_OS_ macros");
+     }
+ }
+diff --git a/src/checks/level0/unused-non-trivial-variable.cpp b/src/checks/level0/unused-non-trivial-variable.cpp
+index 4e4b8303..93815f27 100644
+--- a/src/checks/level0/unused-non-trivial-variable.cpp
++++ b/src/checks/level0/unused-non-trivial-variable.cpp
+@@ -91,7 +91,7 @@ bool UnusedNonTrivialVariable::isUninterestingType(const CXXRecordDecl *record)
+     static const vector<StringRef> blacklistedTemplates = { "QScopedPointer", "QSetValueOnDestroy", "QScopedValueRollback" };
+     StringRef className = clazy::name(record);
+     for (StringRef templateName : blacklistedTemplates) {
+-        if (clazy::startsWith(className, templateName))
++        if (clazy::startsWith(static_cast<std::string>(className), static_cast<std::string>(templateName)))
+             return true;
+     }
+ 
+diff --git a/src/checks/level1/detaching-temporary.cpp b/src/checks/level1/detaching-temporary.cpp
+index fedfc81c..60c75532 100644
+--- a/src/checks/level1/detaching-temporary.cpp
++++ b/src/checks/level1/detaching-temporary.cpp
+@@ -140,7 +140,7 @@ void DetachingTemporary::VisitStmt(clang::Stmt *stm)
+     StringRef className = clazy::name(classDecl);
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = clazy::detachingMethods();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     auto it2 = m_writeMethodsByType.find(className);
+ 
+     std::vector<StringRef> allowedFunctions;
+diff --git a/src/checks/level1/non-pod-global-static.cpp b/src/checks/level1/non-pod-global-static.cpp
+index 5879bff8..433b5c5f 100644
+--- a/src/checks/level1/non-pod-global-static.cpp
++++ b/src/checks/level1/non-pod-global-static.cpp
+@@ -74,7 +74,7 @@ void NonPodGlobalStatic::VisitStmt(clang::Stmt *stm)
+     const SourceLocation declStart = clazy::getLocStart(varDecl);
+ 
+     if (declStart.isMacroID()) {
+-        auto macroName = Lexer::getImmediateMacroName(declStart, sm(), lo());
++        auto macroName = static_cast<std::string>(Lexer::getImmediateMacroName(declStart, sm(), lo()));
+         if (clazy::startsWithAny(macroName, { "Q_IMPORT_PLUGIN", "Q_CONSTRUCTOR_FUNCTION", "Q_DESTRUCTOR_FUNCTION"})) // Don't warn on these
+             return;
+     }
+diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp
+index e1d6db4a..3af9fee2 100644
+--- a/src/checks/level1/qproperty-without-notify.cpp
++++ b/src/checks/level1/qproperty-without-notify.cpp
+@@ -69,7 +69,7 @@ void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok,
+         return;
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/level2/missing-typeinfo.cpp b/src/checks/level2/missing-typeinfo.cpp
+index 98df2cd4..03b44e06 100644
+--- a/src/checks/level2/missing-typeinfo.cpp
++++ b/src/checks/level2/missing-typeinfo.cpp
+@@ -74,7 +74,7 @@ void MissingTypeInfo::VisitDecl(clang::Decl *decl)
+         if (sm().isInSystemHeader(clazy::getLocStart(record)))
+             return;
+ 
+-        std::string typeName = clazy::name(record);
++        std::string typeName = static_cast<std::string>(clazy::name(record));
+         if (typeName == "QPair") // QPair doesn't use Q_DECLARE_TYPEINFO, but rather a explicit QTypeInfo.
+             return;
+ 
+diff --git a/src/checks/level2/old-style-connect.cpp b/src/checks/level2/old-style-connect.cpp
+index 0fe68c13..396cb703 100644
+--- a/src/checks/level2/old-style-connect.cpp
++++ b/src/checks/level2/old-style-connect.cpp
+@@ -274,7 +274,7 @@ void OldStyleConnect::VisitMacroExpands(const Token &macroNameTok, const SourceR
+         return;
+ 
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(Q_PRIVATE_SLOT\s*\((.*)\s*,\s*.*\s+(.*)\(.*)");
+     smatch match;
+@@ -293,7 +293,7 @@ string OldStyleConnect::signalOrSlotNameFromMacro(SourceLocation macroLoc)
+     CharSourceRange expansionRange = clazy::getImmediateExpansionRange(macroLoc, sm());
+     SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(\s*(SIGNAL|SLOT)\s*\(\s*(.+)\s*\(.*)");
+ 
+@@ -315,7 +315,7 @@ bool OldStyleConnect::isSignalOrSlot(SourceLocation loc, string &macroName) cons
+     if (!loc.isMacroID() || loc.isInvalid())
+         return false;
+ 
+-    macroName = Lexer::getImmediateMacroName(loc, sm(), lo());
++    macroName = static_cast<std::string>(Lexer::getImmediateMacroName(loc, sm(), lo()));
+     return macroName == "SIGNAL" || macroName == "SLOT";
+ }
+ 
+diff --git a/src/checks/level2/rule-of-three.cpp b/src/checks/level2/rule-of-three.cpp
+index 8db55d53..7583fcc5 100644
+--- a/src/checks/level2/rule-of-three.cpp
++++ b/src/checks/level2/rule-of-three.cpp
+@@ -140,7 +140,7 @@ void RuleOfThree::VisitDecl(clang::Decl *decl)
+ 
+     const string className = record->getNameAsString();
+     const string classQualifiedName = record->getQualifiedNameAsString();
+-    const string filename = sm().getFilename(recordStart);
++    const string filename = static_cast<std::string>(sm().getFilename(recordStart));
+     if (clazy::endsWith(className, "Private") && clazy::endsWithAny(filename, { ".cpp", ".cxx", "_p.h" }))
+         return; // Lots of RAII classes fall into this category. And even Private (d-pointer) classes, warning in that case would just be noise
+ 
+diff --git a/src/checks/manuallevel/ifndef-define-typo.cpp b/src/checks/manuallevel/ifndef-define-typo.cpp
+index edb6cdf4..e9c50a45 100644
+--- a/src/checks/manuallevel/ifndef-define-typo.cpp
++++ b/src/checks/manuallevel/ifndef-define-typo.cpp
+@@ -44,7 +44,7 @@ void IfndefDefineTypo::VisitMacroDefined(const Token &macroNameTok)
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -53,7 +53,7 @@ void IfndefDefineTypo::VisitDefined(const Token &macroNameTok, const SourceRange
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -66,7 +66,7 @@ void IfndefDefineTypo::VisitIfdef(SourceLocation, const Token &)
+ void IfndefDefineTypo::VisitIfndef(SourceLocation, const Token &macroNameTok)
+ {
+     if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo())
+-        m_lastIfndef = ii->getName();
++        m_lastIfndef = static_cast<std::string>(ii->getName());
+ }
+ 
+ void IfndefDefineTypo::VisitIf(SourceLocation, SourceRange, PPCallbacks::ConditionValueKind)
+diff --git a/src/checks/manuallevel/qproperty-type-mismatch.cpp b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+index f91159cb..952d9f1d 100644
+--- a/src/checks/manuallevel/qproperty-type-mismatch.cpp
++++ b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+@@ -237,7 +237,7 @@ void QPropertyTypeMismatch::VisitMacroExpands(const clang::Token &MacroNameTok,
+ 
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (!text.empty() && text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/manuallevel/qrequiredresult-candidates.cpp b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+index 912dbaa0..6375bd7b 100644
+--- a/src/checks/manuallevel/qrequiredresult-candidates.cpp
++++ b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+@@ -65,7 +65,7 @@ void QRequiredResultCandidates::VisitDecl(clang::Decl *decl)
+ 
+ 
+     if (returnClass == classDecl) {
+-        const std::string methodName = clazy::name(method);
++        const std::string methodName = static_cast<std::string>(clazy::name(method));
+         if (methodName.empty()) // fixes assert
+             return;
+ 
+diff --git a/src/checks/manuallevel/qt-keywords.cpp b/src/checks/manuallevel/qt-keywords.cpp
+index e792e95a..b60752c9 100644
+--- a/src/checks/manuallevel/qt-keywords.cpp
++++ b/src/checks/manuallevel/qt-keywords.cpp
+@@ -59,12 +59,12 @@ void QtKeywords::VisitMacroExpands(const Token &macroNameTok, const SourceRange
+     }
+ 
+     static const vector<StringRef> keywords = { "foreach", "signals", "slots", "emit" };
+-    std::string name = ii->getName();
++    std::string name = static_cast<std::string>(ii->getName());
+     if (!clazy::contains(keywords, name))
+         return;
+ 
+     // Make sure the macro is Qt's. It must be defined in Qt's headers, not 3rdparty
+-    std::string qtheader = sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc()));
++    std::string qtheader = static_cast<std::string>(sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc())));
+     if (!clazy::endsWith(qtheader, "qglobal.h") && !clazy::endsWith(qtheader, "qobjectdefs.h"))
+         return;
+ 
+diff --git a/src/checks/manuallevel/reserve-candidates.cpp b/src/checks/manuallevel/reserve-candidates.cpp
+index 389cac5a..92e4491c 100644
+--- a/src/checks/manuallevel/reserve-candidates.cpp
++++ b/src/checks/manuallevel/reserve-candidates.cpp
+@@ -78,7 +78,8 @@ static bool isCandidateMethod(CXXMethodDecl *methodDecl)
+     if (!classDecl)
+         return false;
+ 
+-    if (!clazy::equalsAny(clazy::name(methodDecl), { "append", "push_back", "push", "operator<<", "operator+=" }))
++    if (!clazy::equalsAny(static_cast<std::string>(clazy::name(methodDecl)),
++                 { "append", "push_back", "push", "operator<<", "operator+=" }))
+         return false;
+ 
+     if (!clazy::isAReserveClass(classDecl))
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
new file mode 100644
index 00000000000..28cbb60b091
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
@@ -0,0 +1,28 @@
+From 25aa102cc49def9573ffbed88155589cd60a2e8f Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Fri, 5 Jun 2020 16:52:53 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10 (clazy-standalone)
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+---
+ src/checks/manuallevel/jnisignatures.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/checks/manuallevel/jnisignatures.cpp b/src/checks/manuallevel/jnisignatures.cpp
+index 81e61d48..5d4fe203 100644
+--- a/src/checks/manuallevel/jnisignatures.cpp
++++ b/src/checks/manuallevel/jnisignatures.cpp
+@@ -103,7 +103,7 @@ void JniSignatures::checkFunctionCall(Stmt *stm)
+         return;
+     }
+ 
+-    const std::string name = clazy::name(funDecl);
++    const std::string name = static_cast<std::string>(clazy::name(funDecl));
+ 
+     if (name == "callObjectMethod" || name == "callMethod") {
+         checkArgAt(callExpr, 0, methodNameRegex, "Invalid method name");
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 4d8557be669..5af2b918e14 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.7
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"
@@ -12,3 +12,9 @@ homepage="https://cgit.kde.org/clazy.git/about/"
 distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
 checksum=754da5815f769dd6b72a040a2430525c93f294eb7769c78271603df9614f1b21
 nocross="Clang cannot be installed as makedep"
+
+post_extract() {
+	for i in ${FILESDIR}/clazy-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}

From ee58dcfde57e850ae764c6a456433efa36d94e35 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 15:19:37 +0100
Subject: [PATCH 19/20] include-what-you-use: rebuild for llvm11

---
 ...de-what-you-use-001-llvm11-stringref.patch | 146 ++++++++++++++++++
 ...ude-what-you-use-002-clang-astdumper.patch |  54 +++++++
 srcpkgs/include-what-you-use/template         |   8 +-
 3 files changed, 207 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch

diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..171dca28e34
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
@@ -0,0 +1,146 @@
+From 53487d209729d5781007dc0fd6076dc585cb3727 Mon Sep 17 00:00:00 2001
+From: Andrea Bocci <andrea.bocci@cern.ch>
+Date: Fri, 28 Feb 2020 17:45:03 +0100
+Subject: [PATCH] Add explicit conversion from llvm::StringRef to std::string
+
+llvm/llvm-project@777180a makes the llvm::StringRef conversion operator
+to std::string explicit.
+These changes add a call to the str() method to perform the conversion.
+
+Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
+---
+ iwyu_driver.cc       | 2 +-
+ iwyu_globals.cc      | 4 ++--
+ iwyu_lexer_utils.cc  | 2 +-
+ iwyu_location_util.h | 2 +-
+ iwyu_output.cc       | 2 +-
+ iwyu_path_util.cc    | 6 +++---
+ iwyu_preprocessor.cc | 4 ++--
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/iwyu_driver.cc b/iwyu_driver.cc
+index bd163144..42fea35b 100644
+--- a/iwyu_driver.cc
++++ b/iwyu_driver.cc
+@@ -79,7 +79,7 @@ std::string GetExecutablePath(const char *Argv0) {
+ }
+ 
+ const char *SaveStringInSet(std::set<std::string> &SavedStrings, StringRef S) {
+-  return SavedStrings.insert(S).first->c_str();
++  return SavedStrings.insert(S.str()).first->c_str();
+ }
+ 
+ void ExpandArgsFromBuf(const char *Arg,
+diff --git a/iwyu_globals.cc b/iwyu_globals.cc
+index 0f58b4dc..26998966 100644
+--- a/iwyu_globals.cc
++++ b/iwyu_globals.cc
+@@ -293,7 +293,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+   for (auto it = header_search->system_dir_begin();
+        it != header_search->system_dir_end(); ++it) {
+     if (const DirectoryEntry* entry = it->getDir()) {
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map[path] = HeaderSearchPath::kSystemPath;
+     }
+   }
+@@ -303,7 +303,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+       // search_dir_begin()/end() includes both system and user paths.
+       // If it's a system path, it's already in the map, so everything
+       // new is a user path.  The insert only 'takes' for new entries.
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map.insert(make_pair(path, HeaderSearchPath::kUserPath));
+     }
+   }
+diff --git a/iwyu_lexer_utils.cc b/iwyu_lexer_utils.cc
+index fcea2d28..648c9da8 100644
+--- a/iwyu_lexer_utils.cc
++++ b/iwyu_lexer_utils.cc
+@@ -70,7 +70,7 @@ SourceLocation GetLocationAfter(
+ string GetIncludeNameAsWritten(
+     SourceLocation include_loc,
+     const CharacterDataGetterInterface& data_getter) {
+-  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter);
++  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter).str();
+   if (data.empty())
+     return data;
+   string::size_type endpos = string::npos;
+diff --git a/iwyu_location_util.h b/iwyu_location_util.h
+index 3892a424..6f8cf81c 100644
+--- a/iwyu_location_util.h
++++ b/iwyu_location_util.h
+@@ -89,7 +89,7 @@ bool IsInScratchSpace(clang::SourceLocation loc);
+ 
+ inline string GetFilePath(const clang::FileEntry* file) {
+   return (IsBuiltinFile(file) ? "<built-in>" :
+-          NormalizeFilePath(file->getName()));
++          NormalizeFilePath(file->getName().str()));
+ }
+ 
+ //------------------------------------------------------------
+diff --git a/iwyu_output.cc b/iwyu_output.cc
+index ca145710..8666c26c 100644
+--- a/iwyu_output.cc
++++ b/iwyu_output.cc
+@@ -168,7 +168,7 @@ string GetKindName(const clang::TagDecl* tag_decl) {
+   if (const FakeNamedDecl* fake = FakeNamedDeclIfItIsOne(named_decl)) {
+     return fake->kind_name();
+   }
+-  return tag_decl->getKindName();
++  return tag_decl->getKindName().str();
+ }
+ 
+ string GetQualifiedNameAsString(const clang::NamedDecl* named_decl) {
+diff --git a/iwyu_path_util.cc b/iwyu_path_util.cc
+index ab4fc800..9987ea47 100644
+--- a/iwyu_path_util.cc
++++ b/iwyu_path_util.cc
+@@ -134,7 +134,7 @@ string NormalizeFilePath(const string& path) {
+   std::replace(normalized.begin(), normalized.end(), '\\', '/');
+ #endif
+ 
+-  return normalized.str();
++  return normalized.str().str();
+ }
+ 
+ string NormalizeDirPath(const string& path) {
+@@ -154,14 +154,14 @@ string MakeAbsolutePath(const string& path) {
+   std::error_code error = llvm::sys::fs::make_absolute(absolute_path);
+   CHECK_(!error);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string MakeAbsolutePath(const string& base_path, const string& relative_path) {
+   llvm::SmallString<128> absolute_path(base_path);
+   llvm::sys::path::append(absolute_path, relative_path);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string GetParentPath(const string& path) {
+diff --git a/iwyu_preprocessor.cc b/iwyu_preprocessor.cc
+index 58e78595..88b93144 100644
+--- a/iwyu_preprocessor.cc
++++ b/iwyu_preprocessor.cc
+@@ -313,7 +313,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+       break;
+     }
+     const string filename = GetSourceTextUntilEndOfLine(current_loc,
+-                                                        DefaultDataGetter());
++                                                        DefaultDataGetter()).str();
+     // Use "" or <> based on where the file lives.
+     string quoted_private_include;
+     if (IsSystemIncludeFile(GetFilePath(current_loc)))
+@@ -332,7 +332,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+     }
+ 
+     string after_text = GetSourceTextUntilEndOfLine(current_loc,
+-                                                    DefaultDataGetter());
++                                                    DefaultDataGetter()).str();
+     const string::size_type close_brace_pos = after_text.find('}');
+     if (close_brace_pos == string::npos) {
+       Warn(current_loc, "@headername directive missing a closing brace");
diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
new file mode 100644
index 00000000000..663a883fa91
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
@@ -0,0 +1,54 @@
+From 30549c6931972456d1e09ff5dbeecd258a8df72b Mon Sep 17 00:00:00 2001
+From: Kim Grasman <kim.grasman@gmail.com>
+Date: Thu, 9 Jul 2020 18:47:56 +0200
+Subject: [PATCH] Implement Stmt printing with ASTDumper
+
+The Clang API changed in commit 473fbc90d1fbf17e so that Stmt::dump
+takes an ASTContext instead of a SourceManager.
+
+Rather than wire a global ASTContext, reimplement PrintableStmt and
+PrintStmt to duplicate the most trivial implementations not requiring
+ASTContext.
+
+No functional change.
+---
+ iwyu_ast_util.cc | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/iwyu_ast_util.cc b/iwyu_ast_util.cc
+index d3d4dd1f..b19a11fb 100644
+--- a/iwyu_ast_util.cc
++++ b/iwyu_ast_util.cc
+@@ -25,6 +25,7 @@
+ #include "llvm/Support/Casting.h"
+ #include "llvm/Support/raw_ostream.h"
+ #include "clang/AST/ASTContext.h"
++#include "clang/AST/ASTDumper.h"
+ #include "clang/AST/CanonicalType.h"
+ #include "clang/AST/Decl.h"
+ #include "clang/AST/DeclBase.h"
+@@ -46,6 +47,7 @@ namespace clang {
+ class FileEntry;
+ }  // namespace clang
+ 
++using clang::ASTDumper;
+ using clang::BlockPointerType;
+ using clang::CXXConstructExpr;
+ using clang::CXXConstructorDecl;
+@@ -450,12 +452,14 @@ string PrintableDecl(const Decl* decl, bool terse/*=true*/) {
+ string PrintableStmt(const Stmt* stmt) {
+   std::string buffer;
+   raw_string_ostream ostream(buffer);
+-  stmt->dump(ostream, *GlobalSourceManager());
++  ASTDumper dumper(ostream, /*ShowColors=*/false);
++  dumper.Visit(stmt);
+   return ostream.str();
+ }
+ 
+ void PrintStmt(const Stmt* stmt) {
+-  stmt->dump(*GlobalSourceManager());  // This prints to errs().
++  ASTDumper dumper(llvm::errs(), /*ShowColors=*/false);
++  dumper.Visit(stmt);
+ }
+ 
+ string PrintableType(const Type* type) {
diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 22c9d09d091..3811309bdde 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.14
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
@@ -15,6 +15,12 @@ distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.
 checksum=43184397db57660c32e3298a6b1fd5ab82e808a1f5ab0591d6745f8d256200ef
 python_version=3
 
+post_extract() {
+	for i in ${FILESDIR}/include-what-you-use-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
+
 post_install() {
 	vlicense LICENSE.TXT
 }

From a38f8cf121610612828d5c5a933bce5e378a55c1 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 16:17:54 +0100
Subject: [PATCH 20/20] bpftrace: update to 0.11.2

---
 ...trace-001-six-args-bpf_attach_uprobe.patch | 126 +++++++++++++++
 ...ace-002-seven-args-bpf_attach_uprobe.patch | 148 ++++++++++++++++++
 srcpkgs/bpftrace/template                     |  10 +-
 3 files changed, 282 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch

diff --git a/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..e2b1ad1351b
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
@@ -0,0 +1,126 @@
+From 52fb793c6423c19696e07cc14ad5f9182f7eca0e Mon Sep 17 00:00:00 2001
+From: Viktor Malik <viktor.malik@gmail.com>
+Date: Wed, 12 Aug 2020 09:45:29 +0200
+Subject: [PATCH] Feature-detect bpf_attach_kprobe signature
+
+The function has 6 parameters in current versions of BCC and 5
+parameters in older versions.
+
+This is detected in CMake using CHECK_CXX_SOURCE_COMPILES. For static
+compilation, we also need to retrieve and link static libbpf, libelf,
+and libz. This may cause libbpf, libelf and libz to be searched for
+twice, but it should be fine since CMake caches results.
+
+Fixes iovisor#1027.
+---
+ cmake/FindLibBcc.cmake | 24 ++++++++++++++++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 31 ++++++++++++++-----------------
+ tests/CMakeLists.txt   |  3 +++
+ 4 files changed, 44 insertions(+), 17 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 9d30b04bc..ec216271d 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -70,3 +70,27 @@ include (FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBcc "Please install the bcc library package, which is required. Depending on your distro, it may be called bpfcclib or bcclib (Ubuntu), bcc-devel (Fedora), or something else. If unavailable, install bcc from source (github.com/iovisor/bcc)."
+   LIBBCC_LIBRARIES
+   LIBBCC_INCLUDE_DIRS)
++
++# Check bpf_attach_kprobe signature
++if(${LIBBCC_FOUND})
++if(STATIC_LINKING)
++  # libbcc.a is not statically linked with libbpf.a, libelf.a, and libz.a.
++  # If we do a static bpftrace build, we must link them in.
++  find_package(LibBpf)
++  find_package(LibElf)
++  find_package(LibZ)
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_BPF_LIBRARY_STATIC} ${LIBBPF_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBZ_LIBRARIES})
++else()
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_LIBRARIES})
++endif()
++INCLUDE(CheckCXXSourceCompiles)
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_kprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++SET(CMAKE_REQUIRED_LIBRARIES)
++endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 647a23f1c..448a045fc 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -80,6 +80,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 587a11576..afad9ed18 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -754,26 +754,23 @@ void AttachedProbe::load_prog()
+   }
+ }
+ 
+-// XXX(mmarchini): bcc changed the signature of bpf_attach_kprobe, adding a new
+-// int parameter at the end. Since there's no reliable way to feature-detect
+-// this, we create a function pointer with the long signature and cast
+-// bpf_attach_kprobe to this function pointer. If we're on an older bcc
+-// version, bpf_attach_kprobe call will be augmented with an extra register
+-// being used for the last parameter, even though this register won't be used
+-// inside the function. Since the register won't be used this is kinda safe,
+-// although not ideal.
+-typedef int (*attach_probe_wrapper_signature)(int, enum bpf_probe_attach_type, const char*, const char*, uint64_t, int);
+-
+ void AttachedProbe::attach_kprobe(bool safe_mode)
+ {
+   resolve_offset_kprobe(safe_mode);
+-  int perf_event_fd = cast_signature<attach_probe_wrapper_signature>(
+-      &bpf_attach_kprobe)(progfd_,
+-                          attachtype(probe_.type),
+-                          eventname().c_str(),
+-                          probe_.attach_point.c_str(),
+-                          offset_,
+-                          0);
++#ifdef LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_,
++                                        0);
++#else
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_);
++#endif
+ 
+   if (perf_event_fd < 0) {
+     if (probe_.orig_name != probe_.name) {
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 3688b8487..84daeb2aa 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -102,6 +102,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace_test ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..2cc55c86555
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
@@ -0,0 +1,148 @@
+From c7dbab451484b96178da1a8c43330154ce4c9d7a Mon Sep 17 00:00:00 2001
+From: Daniel Xu <dxu@dxuuu.xyz>
+Date: Wed, 14 Oct 2020 17:09:46 -0700
+Subject: [PATCH] Detect 7 arg bpf_attach_uprobe() API
+
+The 7th arg allows us to specify the usdt semaphore location.
+---
+ cmake/FindLibBcc.cmake | 11 +++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 42 ++++++++++++++++++++++++++++++++++--------
+ src/main.cpp           |  6 ++++++
+ tests/CMakeLists.txt   |  3 +++
+ 5 files changed, 57 insertions(+), 8 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 4c09a8ca2..92cedab5e 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -7,6 +7,8 @@
+ #  LIBBCC_DEFINITIONS - Compiler switches required for using libbcc
+ #  LIBBCC_BPF_LIBRARY_STATIC - libbpf static library (for static compilation)
+ #  LIBBCC_LOADER_LIBRARY_STATIC - libbcc helper static library (for static compilation)
++#  LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++#  LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ #
+ # Note that the shared libbcc binary has libbpf and bcc_loader already compiled in but
+ # the static doesn't. So when creating a static build those have to be included too.
+@@ -94,6 +96,15 @@ int main(void) {
+   return 0;
+ }
+ " LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_uprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ SET(CMAKE_REQUIRED_INCLUDES)
+ endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 9162356e3..cef94d144 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -88,6 +88,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 93fbfa876..a5d8bc56d 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -698,12 +698,23 @@ void AttachedProbe::attach_uprobe(bool safe_mode)
+ {
+   resolve_offset_uprobe(safe_mode);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_,
+-                                        attachtype(probe_.type),
+-                                        eventname().c_str(),
+-                                        probe_.path.c_str(),
+-                                        offset_,
+-                                        probe_.pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+     throw std::runtime_error("Error attaching probe: " + probe_.name);
+@@ -812,8 +823,23 @@ void AttachedProbe::attach_usdt(int pid)
+ 
+   offset_ = resolve_offset(probe_.path, probe_.attach_point, probe_.loc);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_, attachtype(probe_.type),
+-      eventname().c_str(), probe_.path.c_str(), offset_, pid == 0 ? -1 : pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+   {
+diff --git a/src/main.cpp b/src/main.cpp
+index 48fcf5aa0..09f4d9677 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -162,6 +162,12 @@ static int info()
+             << "yes" << std::endl;
+ #else
+             << "no" << std::endl;
++#endif
++  std::cerr << "  bcc bpf_attach_uprobe refcount: "
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++            << "yes" << std::endl;
++#else
++            << "no" << std::endl;
+ #endif
+   std::cerr << "  libbpf: "
+ #ifdef HAVE_LIBBPF
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index ace5ff106..332eba2b5 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -116,6 +116,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index d8367fa5c03..44e6c174107 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,6 +1,6 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
-version=0.11.1
+version=0.11.2
 revision=1
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
@@ -12,7 +12,13 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="Apache-2.0"
 homepage="https://github.com/iovisor/bpftrace/"
 distfiles="https://github.com/iovisor/bpftrace/archive/v${version}.tar.gz"
-checksum=98efc9396451bc1a4f73378cec4755e07e7718cb5d698472606f5ffc2b9e48e8
+checksum=1f0fc30073547e3b285e1a373aa469bb18d3ba27f8c05f91016df0ca84f77f90
+
+post_extract() {
+	for i in ${FILESDIR}/bpftrace-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
 
 post_install() {
 	# clashes with bcc-tools

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (18 preceding siblings ...)
  2020-11-09 16:46 ` Snektron
@ 2020-11-09 16:56 ` q66
  2020-11-09 17:14 ` [PR PATCH] [Updated] " Snektron
                   ` (12 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: q66 @ 2020-11-09 16:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#issuecomment-724140100

Comment:
what? no, don't squash rebuild commits please

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (19 preceding siblings ...)
  2020-11-09 16:56 ` q66
@ 2020-11-09 17:14 ` Snektron
  2020-11-09 17:15 ` Snektron
                   ` (11 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 17:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 116892 bytes --]

From e67c1517818253c2aff3fd2dbd12322385c07ce5 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:10 +0100
Subject: [PATCH 01/21] new package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 ...h~b2110e270 (codelite: rebuild for llvm11) |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 747 insertions(+), 13 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11) b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
new file mode 100644
index 00000000000..5be8de4f068
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)	
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -153,7 +153,7 @@
+
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 43c1876f03a498af1bb80c8b99dba8d3b0165491 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:23 +0100
Subject: [PATCH 02/21] llvm: update to 11.0.0

---
 srcpkgs/llvm/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From f28297b79f355d473debf19d9a1677a71e4b0657 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 03/21] llvm10: rebuild standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 72777139908edeb1a070a8505089d7009a0d6489 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 04/21] llvm-libunwind: Update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 33a4070e0a75badb8b3dbeda25190ecc585d76be Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 05/21] libcxxabi: Update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From bdff253737caf5ceba8df9c5aa5fb209f8aebb05 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 06/21] libcxx: Update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From 883faca5b1fea292829a7f2a62c6fbcc8bff936d Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 07/21] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From 967f16e6073f5d1f60b95779f60343a4354b53a6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 08/21] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From f504081f701908a82566a91cba244c1fa07b174b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 09/21] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 210784e697f6c8156aaa4665e8bd92c730bf5a87 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 10/21] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From 92c1b26a058832d404228786e2bd81f2684d3f47 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 11/21] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From e073ba4143a3f12d6d7394b0f72a83412d860db6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 12/21] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 5eda4a4333f3828c7ffd3486b095d022cc5e6509 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 13/21] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From d1d7a2bc732ce9d50172079a0de27f1d5db7fc95 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 14/21] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From 95037196338720d697d44105c2f8e347dd78b265 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 15/21] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From 1d9478854b0f7165ad6166c0a08633e8c32eae50 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 16/21] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index bebfa0f4c61..7346474a7cd 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20190823.6
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From 82811c3a9b5db820d26c01083d166e02f19b1167 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 17/21] ispc: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

From 8f97c537f107c8958996eb26e59eeb03c57a7da9 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:24:20 +0100
Subject: [PATCH 18/21] zig: update to 0.7.0

---
 srcpkgs/zig/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index e34d6471728..727a675383a 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,16 +1,16 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.6.0
-revision=2
+version=0.7.0
+revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
-makedepends="clang llvm10 lld-devel"
+makedepends="clang llvm11 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="MIT"
 homepage="https://ziglang.org/"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204
+checksum=0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83
 nopie=yes
 nocross=yes
 

From 509326434524ee6cbabdeefb812e5112b23ae567 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:41:53 +0100
Subject: [PATCH 19/21] clazy: rebuild for llvm11

---
 .../files/clazy-001-llvm11-stringref.patch    | 343 ++++++++++++++++++
 .../files/clazy-002-llvm11-stringref.patch    |  28 ++
 srcpkgs/clazy/template                        |   8 +-
 3 files changed, 378 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch

diff --git a/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..48049fa594a
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
@@ -0,0 +1,343 @@
+From 30d6a2b64f5a05722fdc5d8e3754dbf13425cd62 Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Thu, 4 Jun 2020 17:10:21 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+Also included header file clang/Basic/FileManager.h in src/MiniDumper
+because without this header, class clang::FileEntry in incomplete class
+---
+ src/FixItExporter.cpp                                 | 5 +++--
+ src/MiniAstDumper.cpp                                 | 1 +
+ src/Utils.cpp                                         | 2 +-
+ src/checkbase.cpp                                     | 2 +-
+ src/checks/detachingbase.cpp                          | 2 +-
+ src/checks/level0/qenums.cpp                          | 2 +-
+ src/checks/level0/qt-macros.cpp                       | 4 ++--
+ src/checks/level0/unused-non-trivial-variable.cpp     | 2 +-
+ src/checks/level1/detaching-temporary.cpp             | 2 +-
+ src/checks/level1/non-pod-global-static.cpp           | 2 +-
+ src/checks/level1/qproperty-without-notify.cpp        | 2 +-
+ src/checks/level2/missing-typeinfo.cpp                | 2 +-
+ src/checks/level2/old-style-connect.cpp               | 6 +++---
+ src/checks/level2/rule-of-three.cpp                   | 2 +-
+ src/checks/manuallevel/ifndef-define-typo.cpp         | 6 +++---
+ src/checks/manuallevel/qproperty-type-mismatch.cpp    | 2 +-
+ src/checks/manuallevel/qrequiredresult-candidates.cpp | 2 +-
+ src/checks/manuallevel/qt-keywords.cpp                | 4 ++--
+ src/checks/manuallevel/reserve-candidates.cpp         | 3 ++-
+ 19 files changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/src/FixItExporter.cpp b/src/FixItExporter.cpp
+index f3af2e54..44240cf5 100644
+--- a/src/FixItExporter.cpp
++++ b/src/FixItExporter.cpp
+@@ -68,7 +68,7 @@ void FixItExporter::BeginSourceFile(const LangOptions &LangOpts, const Preproces
+ 
+     const auto id = SourceMgr.getMainFileID();
+     const auto entry = SourceMgr.getFileEntryForID(id);
+-    getTuDiag().MainSourceFile = entry->getName();
++    getTuDiag().MainSourceFile = static_cast<std::string>(entry->getName());
+ }
+ 
+ bool FixItExporter::IncludeInDiagnosticCounts() const
+@@ -89,7 +89,8 @@ tooling::Diagnostic FixItExporter::ConvertDiagnostic(const Diagnostic &Info)
+     // TODO: This returns an empty string: DiagEngine->getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
+     // HACK: capture it at the end of the message: Message text [check-name]
+ 
+-    std::string checkName = DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
++    std::string checkName =
++        static_cast<std::string>(DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID()));
+     std::string messageText;
+ 
+     if (checkName.empty()) {
+diff --git a/src/MiniAstDumper.cpp b/src/MiniAstDumper.cpp
+index 47661749..6124e6e8 100644
+--- a/src/MiniAstDumper.cpp
++++ b/src/MiniAstDumper.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <clang/Frontend/CompilerInstance.h>
+ #include <clang/Frontend/FrontendPluginRegistry.h>
++#include <clang/Basic/FileManager.h>
+ 
+ using namespace clang;
+ using namespace std;
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index 001ced98..b0812fe3 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -878,7 +878,7 @@ string Utils::filenameForLoc(SourceLocation loc, const clang::SourceManager &sm)
+     if (loc.isMacroID())
+         loc = sm.getExpansionLoc(loc);
+ 
+-    const string filename = sm.getFilename(loc);
++    const string filename = static_cast<std::string>(sm.getFilename(loc));
+     auto splitted = clazy::splitString(filename, '/');
+     if (splitted.empty())
+         return {};
+diff --git a/src/checkbase.cpp b/src/checkbase.cpp
+index 8b40e19d..22a426cf 100644
+--- a/src/checkbase.cpp
++++ b/src/checkbase.cpp
+@@ -188,7 +188,7 @@ bool CheckBase::shouldIgnoreFile(SourceLocation loc) const
+     if (!loc.isValid())
+         return true;
+ 
+-    string filename = sm().getFilename(loc);
++    string filename = static_cast<std::string>(sm().getFilename(loc));
+ 
+     return clazy::any_of(m_filesToIgnore, [filename](const std::string &ignored) {
+         return clazy::contains(filename, ignored);
+diff --git a/src/checks/detachingbase.cpp b/src/checks/detachingbase.cpp
+index 70311f42..1b094ee7 100644
+--- a/src/checks/detachingbase.cpp
++++ b/src/checks/detachingbase.cpp
+@@ -57,7 +57,7 @@ bool DetachingBase::isDetachingMethod(CXXMethodDecl *method, DetachingMethodType
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = detachingMethodType == DetachingMethod ? clazy::detachingMethods()
+                                                                                                                      : clazy::detachingMethodsWithConstCounterParts();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     if (it != methodsByType.cend()) {
+         const auto &methods = it->second;
+         if (clazy::contains(methods, clazy::name(method)))
+diff --git a/src/checks/level0/qenums.cpp b/src/checks/level0/qenums.cpp
+index 00075b5c..db8910f2 100644
+--- a/src/checks/level0/qenums.cpp
++++ b/src/checks/level0/qenums.cpp
+@@ -59,7 +59,7 @@ void QEnums::VisitMacroExpands(const Token &MacroNameTok, const SourceRange &ran
+         // We simply check if :: is present because it's very cumbersome to to check for different classes when dealing with the pre-processor
+ 
+         CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+-        string text = Lexer::getSourceText(crange, sm(), lo());
++        string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+         if (clazy::contains(text, "::"))
+             return;
+     }
+diff --git a/src/checks/level0/qt-macros.cpp b/src/checks/level0/qt-macros.cpp
+index d3a587cb..ab8e9f52 100644
+--- a/src/checks/level0/qt-macros.cpp
++++ b/src/checks/level0/qt-macros.cpp
+@@ -44,7 +44,7 @@ void QtMacros::VisitMacroDefined(const Token &MacroNameTok)
+         return;
+ 
+     IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
+-    if (ii && clazy::startsWith(ii->getName(), "Q_OS_"))
++    if (ii && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_"))
+         m_OSMacroExists = true;
+ }
+ 
+@@ -58,7 +58,7 @@ void QtMacros::checkIfDef(const Token &macroNameTok, SourceLocation Loc)
+     if (preProcessorVisitor && preProcessorVisitor->qtVersion() < 51204 && ii->getName() == "Q_OS_WINDOWS") {
+         // Q_OS_WINDOWS was introduced in 5.12.4
+         emitWarning(Loc, "Q_OS_WINDOWS was only introduced in Qt 5.12.4, use Q_OS_WIN instead");
+-    } else if (!m_OSMacroExists && clazy::startsWith(ii->getName(), "Q_OS_")) {
++    } else if (!m_OSMacroExists && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_")) {
+         emitWarning(Loc, "Include qglobal.h before testing Q_OS_ macros");
+     }
+ }
+diff --git a/src/checks/level0/unused-non-trivial-variable.cpp b/src/checks/level0/unused-non-trivial-variable.cpp
+index 4e4b8303..93815f27 100644
+--- a/src/checks/level0/unused-non-trivial-variable.cpp
++++ b/src/checks/level0/unused-non-trivial-variable.cpp
+@@ -91,7 +91,7 @@ bool UnusedNonTrivialVariable::isUninterestingType(const CXXRecordDecl *record)
+     static const vector<StringRef> blacklistedTemplates = { "QScopedPointer", "QSetValueOnDestroy", "QScopedValueRollback" };
+     StringRef className = clazy::name(record);
+     for (StringRef templateName : blacklistedTemplates) {
+-        if (clazy::startsWith(className, templateName))
++        if (clazy::startsWith(static_cast<std::string>(className), static_cast<std::string>(templateName)))
+             return true;
+     }
+ 
+diff --git a/src/checks/level1/detaching-temporary.cpp b/src/checks/level1/detaching-temporary.cpp
+index fedfc81c..60c75532 100644
+--- a/src/checks/level1/detaching-temporary.cpp
++++ b/src/checks/level1/detaching-temporary.cpp
+@@ -140,7 +140,7 @@ void DetachingTemporary::VisitStmt(clang::Stmt *stm)
+     StringRef className = clazy::name(classDecl);
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = clazy::detachingMethods();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     auto it2 = m_writeMethodsByType.find(className);
+ 
+     std::vector<StringRef> allowedFunctions;
+diff --git a/src/checks/level1/non-pod-global-static.cpp b/src/checks/level1/non-pod-global-static.cpp
+index 5879bff8..433b5c5f 100644
+--- a/src/checks/level1/non-pod-global-static.cpp
++++ b/src/checks/level1/non-pod-global-static.cpp
+@@ -74,7 +74,7 @@ void NonPodGlobalStatic::VisitStmt(clang::Stmt *stm)
+     const SourceLocation declStart = clazy::getLocStart(varDecl);
+ 
+     if (declStart.isMacroID()) {
+-        auto macroName = Lexer::getImmediateMacroName(declStart, sm(), lo());
++        auto macroName = static_cast<std::string>(Lexer::getImmediateMacroName(declStart, sm(), lo()));
+         if (clazy::startsWithAny(macroName, { "Q_IMPORT_PLUGIN", "Q_CONSTRUCTOR_FUNCTION", "Q_DESTRUCTOR_FUNCTION"})) // Don't warn on these
+             return;
+     }
+diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp
+index e1d6db4a..3af9fee2 100644
+--- a/src/checks/level1/qproperty-without-notify.cpp
++++ b/src/checks/level1/qproperty-without-notify.cpp
+@@ -69,7 +69,7 @@ void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok,
+         return;
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/level2/missing-typeinfo.cpp b/src/checks/level2/missing-typeinfo.cpp
+index 98df2cd4..03b44e06 100644
+--- a/src/checks/level2/missing-typeinfo.cpp
++++ b/src/checks/level2/missing-typeinfo.cpp
+@@ -74,7 +74,7 @@ void MissingTypeInfo::VisitDecl(clang::Decl *decl)
+         if (sm().isInSystemHeader(clazy::getLocStart(record)))
+             return;
+ 
+-        std::string typeName = clazy::name(record);
++        std::string typeName = static_cast<std::string>(clazy::name(record));
+         if (typeName == "QPair") // QPair doesn't use Q_DECLARE_TYPEINFO, but rather a explicit QTypeInfo.
+             return;
+ 
+diff --git a/src/checks/level2/old-style-connect.cpp b/src/checks/level2/old-style-connect.cpp
+index 0fe68c13..396cb703 100644
+--- a/src/checks/level2/old-style-connect.cpp
++++ b/src/checks/level2/old-style-connect.cpp
+@@ -274,7 +274,7 @@ void OldStyleConnect::VisitMacroExpands(const Token &macroNameTok, const SourceR
+         return;
+ 
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(Q_PRIVATE_SLOT\s*\((.*)\s*,\s*.*\s+(.*)\(.*)");
+     smatch match;
+@@ -293,7 +293,7 @@ string OldStyleConnect::signalOrSlotNameFromMacro(SourceLocation macroLoc)
+     CharSourceRange expansionRange = clazy::getImmediateExpansionRange(macroLoc, sm());
+     SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(\s*(SIGNAL|SLOT)\s*\(\s*(.+)\s*\(.*)");
+ 
+@@ -315,7 +315,7 @@ bool OldStyleConnect::isSignalOrSlot(SourceLocation loc, string &macroName) cons
+     if (!loc.isMacroID() || loc.isInvalid())
+         return false;
+ 
+-    macroName = Lexer::getImmediateMacroName(loc, sm(), lo());
++    macroName = static_cast<std::string>(Lexer::getImmediateMacroName(loc, sm(), lo()));
+     return macroName == "SIGNAL" || macroName == "SLOT";
+ }
+ 
+diff --git a/src/checks/level2/rule-of-three.cpp b/src/checks/level2/rule-of-three.cpp
+index 8db55d53..7583fcc5 100644
+--- a/src/checks/level2/rule-of-three.cpp
++++ b/src/checks/level2/rule-of-three.cpp
+@@ -140,7 +140,7 @@ void RuleOfThree::VisitDecl(clang::Decl *decl)
+ 
+     const string className = record->getNameAsString();
+     const string classQualifiedName = record->getQualifiedNameAsString();
+-    const string filename = sm().getFilename(recordStart);
++    const string filename = static_cast<std::string>(sm().getFilename(recordStart));
+     if (clazy::endsWith(className, "Private") && clazy::endsWithAny(filename, { ".cpp", ".cxx", "_p.h" }))
+         return; // Lots of RAII classes fall into this category. And even Private (d-pointer) classes, warning in that case would just be noise
+ 
+diff --git a/src/checks/manuallevel/ifndef-define-typo.cpp b/src/checks/manuallevel/ifndef-define-typo.cpp
+index edb6cdf4..e9c50a45 100644
+--- a/src/checks/manuallevel/ifndef-define-typo.cpp
++++ b/src/checks/manuallevel/ifndef-define-typo.cpp
+@@ -44,7 +44,7 @@ void IfndefDefineTypo::VisitMacroDefined(const Token &macroNameTok)
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -53,7 +53,7 @@ void IfndefDefineTypo::VisitDefined(const Token &macroNameTok, const SourceRange
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -66,7 +66,7 @@ void IfndefDefineTypo::VisitIfdef(SourceLocation, const Token &)
+ void IfndefDefineTypo::VisitIfndef(SourceLocation, const Token &macroNameTok)
+ {
+     if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo())
+-        m_lastIfndef = ii->getName();
++        m_lastIfndef = static_cast<std::string>(ii->getName());
+ }
+ 
+ void IfndefDefineTypo::VisitIf(SourceLocation, SourceRange, PPCallbacks::ConditionValueKind)
+diff --git a/src/checks/manuallevel/qproperty-type-mismatch.cpp b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+index f91159cb..952d9f1d 100644
+--- a/src/checks/manuallevel/qproperty-type-mismatch.cpp
++++ b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+@@ -237,7 +237,7 @@ void QPropertyTypeMismatch::VisitMacroExpands(const clang::Token &MacroNameTok,
+ 
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (!text.empty() && text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/manuallevel/qrequiredresult-candidates.cpp b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+index 912dbaa0..6375bd7b 100644
+--- a/src/checks/manuallevel/qrequiredresult-candidates.cpp
++++ b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+@@ -65,7 +65,7 @@ void QRequiredResultCandidates::VisitDecl(clang::Decl *decl)
+ 
+ 
+     if (returnClass == classDecl) {
+-        const std::string methodName = clazy::name(method);
++        const std::string methodName = static_cast<std::string>(clazy::name(method));
+         if (methodName.empty()) // fixes assert
+             return;
+ 
+diff --git a/src/checks/manuallevel/qt-keywords.cpp b/src/checks/manuallevel/qt-keywords.cpp
+index e792e95a..b60752c9 100644
+--- a/src/checks/manuallevel/qt-keywords.cpp
++++ b/src/checks/manuallevel/qt-keywords.cpp
+@@ -59,12 +59,12 @@ void QtKeywords::VisitMacroExpands(const Token &macroNameTok, const SourceRange
+     }
+ 
+     static const vector<StringRef> keywords = { "foreach", "signals", "slots", "emit" };
+-    std::string name = ii->getName();
++    std::string name = static_cast<std::string>(ii->getName());
+     if (!clazy::contains(keywords, name))
+         return;
+ 
+     // Make sure the macro is Qt's. It must be defined in Qt's headers, not 3rdparty
+-    std::string qtheader = sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc()));
++    std::string qtheader = static_cast<std::string>(sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc())));
+     if (!clazy::endsWith(qtheader, "qglobal.h") && !clazy::endsWith(qtheader, "qobjectdefs.h"))
+         return;
+ 
+diff --git a/src/checks/manuallevel/reserve-candidates.cpp b/src/checks/manuallevel/reserve-candidates.cpp
+index 389cac5a..92e4491c 100644
+--- a/src/checks/manuallevel/reserve-candidates.cpp
++++ b/src/checks/manuallevel/reserve-candidates.cpp
+@@ -78,7 +78,8 @@ static bool isCandidateMethod(CXXMethodDecl *methodDecl)
+     if (!classDecl)
+         return false;
+ 
+-    if (!clazy::equalsAny(clazy::name(methodDecl), { "append", "push_back", "push", "operator<<", "operator+=" }))
++    if (!clazy::equalsAny(static_cast<std::string>(clazy::name(methodDecl)),
++                 { "append", "push_back", "push", "operator<<", "operator+=" }))
+         return false;
+ 
+     if (!clazy::isAReserveClass(classDecl))
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
new file mode 100644
index 00000000000..28cbb60b091
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
@@ -0,0 +1,28 @@
+From 25aa102cc49def9573ffbed88155589cd60a2e8f Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Fri, 5 Jun 2020 16:52:53 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10 (clazy-standalone)
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+---
+ src/checks/manuallevel/jnisignatures.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/checks/manuallevel/jnisignatures.cpp b/src/checks/manuallevel/jnisignatures.cpp
+index 81e61d48..5d4fe203 100644
+--- a/src/checks/manuallevel/jnisignatures.cpp
++++ b/src/checks/manuallevel/jnisignatures.cpp
+@@ -103,7 +103,7 @@ void JniSignatures::checkFunctionCall(Stmt *stm)
+         return;
+     }
+ 
+-    const std::string name = clazy::name(funDecl);
++    const std::string name = static_cast<std::string>(clazy::name(funDecl));
+ 
+     if (name == "callObjectMethod" || name == "callMethod") {
+         checkArgAt(callExpr, 0, methodNameRegex, "Invalid method name");
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 4d8557be669..5af2b918e14 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.7
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"
@@ -12,3 +12,9 @@ homepage="https://cgit.kde.org/clazy.git/about/"
 distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
 checksum=754da5815f769dd6b72a040a2430525c93f294eb7769c78271603df9614f1b21
 nocross="Clang cannot be installed as makedep"
+
+post_extract() {
+	for i in ${FILESDIR}/clazy-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}

From 1524185ccd607ae6175e724bdd34878c54a3f2ec Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 15:19:37 +0100
Subject: [PATCH 20/21] include-what-you-use: rebuild for llvm11

---
 ...de-what-you-use-001-llvm11-stringref.patch | 146 ++++++++++++++++++
 ...ude-what-you-use-002-clang-astdumper.patch |  54 +++++++
 srcpkgs/include-what-you-use/template         |   8 +-
 3 files changed, 207 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch

diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..171dca28e34
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
@@ -0,0 +1,146 @@
+From 53487d209729d5781007dc0fd6076dc585cb3727 Mon Sep 17 00:00:00 2001
+From: Andrea Bocci <andrea.bocci@cern.ch>
+Date: Fri, 28 Feb 2020 17:45:03 +0100
+Subject: [PATCH] Add explicit conversion from llvm::StringRef to std::string
+
+llvm/llvm-project@777180a makes the llvm::StringRef conversion operator
+to std::string explicit.
+These changes add a call to the str() method to perform the conversion.
+
+Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
+---
+ iwyu_driver.cc       | 2 +-
+ iwyu_globals.cc      | 4 ++--
+ iwyu_lexer_utils.cc  | 2 +-
+ iwyu_location_util.h | 2 +-
+ iwyu_output.cc       | 2 +-
+ iwyu_path_util.cc    | 6 +++---
+ iwyu_preprocessor.cc | 4 ++--
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/iwyu_driver.cc b/iwyu_driver.cc
+index bd163144..42fea35b 100644
+--- a/iwyu_driver.cc
++++ b/iwyu_driver.cc
+@@ -79,7 +79,7 @@ std::string GetExecutablePath(const char *Argv0) {
+ }
+ 
+ const char *SaveStringInSet(std::set<std::string> &SavedStrings, StringRef S) {
+-  return SavedStrings.insert(S).first->c_str();
++  return SavedStrings.insert(S.str()).first->c_str();
+ }
+ 
+ void ExpandArgsFromBuf(const char *Arg,
+diff --git a/iwyu_globals.cc b/iwyu_globals.cc
+index 0f58b4dc..26998966 100644
+--- a/iwyu_globals.cc
++++ b/iwyu_globals.cc
+@@ -293,7 +293,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+   for (auto it = header_search->system_dir_begin();
+        it != header_search->system_dir_end(); ++it) {
+     if (const DirectoryEntry* entry = it->getDir()) {
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map[path] = HeaderSearchPath::kSystemPath;
+     }
+   }
+@@ -303,7 +303,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+       // search_dir_begin()/end() includes both system and user paths.
+       // If it's a system path, it's already in the map, so everything
+       // new is a user path.  The insert only 'takes' for new entries.
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map.insert(make_pair(path, HeaderSearchPath::kUserPath));
+     }
+   }
+diff --git a/iwyu_lexer_utils.cc b/iwyu_lexer_utils.cc
+index fcea2d28..648c9da8 100644
+--- a/iwyu_lexer_utils.cc
++++ b/iwyu_lexer_utils.cc
+@@ -70,7 +70,7 @@ SourceLocation GetLocationAfter(
+ string GetIncludeNameAsWritten(
+     SourceLocation include_loc,
+     const CharacterDataGetterInterface& data_getter) {
+-  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter);
++  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter).str();
+   if (data.empty())
+     return data;
+   string::size_type endpos = string::npos;
+diff --git a/iwyu_location_util.h b/iwyu_location_util.h
+index 3892a424..6f8cf81c 100644
+--- a/iwyu_location_util.h
++++ b/iwyu_location_util.h
+@@ -89,7 +89,7 @@ bool IsInScratchSpace(clang::SourceLocation loc);
+ 
+ inline string GetFilePath(const clang::FileEntry* file) {
+   return (IsBuiltinFile(file) ? "<built-in>" :
+-          NormalizeFilePath(file->getName()));
++          NormalizeFilePath(file->getName().str()));
+ }
+ 
+ //------------------------------------------------------------
+diff --git a/iwyu_output.cc b/iwyu_output.cc
+index ca145710..8666c26c 100644
+--- a/iwyu_output.cc
++++ b/iwyu_output.cc
+@@ -168,7 +168,7 @@ string GetKindName(const clang::TagDecl* tag_decl) {
+   if (const FakeNamedDecl* fake = FakeNamedDeclIfItIsOne(named_decl)) {
+     return fake->kind_name();
+   }
+-  return tag_decl->getKindName();
++  return tag_decl->getKindName().str();
+ }
+ 
+ string GetQualifiedNameAsString(const clang::NamedDecl* named_decl) {
+diff --git a/iwyu_path_util.cc b/iwyu_path_util.cc
+index ab4fc800..9987ea47 100644
+--- a/iwyu_path_util.cc
++++ b/iwyu_path_util.cc
+@@ -134,7 +134,7 @@ string NormalizeFilePath(const string& path) {
+   std::replace(normalized.begin(), normalized.end(), '\\', '/');
+ #endif
+ 
+-  return normalized.str();
++  return normalized.str().str();
+ }
+ 
+ string NormalizeDirPath(const string& path) {
+@@ -154,14 +154,14 @@ string MakeAbsolutePath(const string& path) {
+   std::error_code error = llvm::sys::fs::make_absolute(absolute_path);
+   CHECK_(!error);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string MakeAbsolutePath(const string& base_path, const string& relative_path) {
+   llvm::SmallString<128> absolute_path(base_path);
+   llvm::sys::path::append(absolute_path, relative_path);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string GetParentPath(const string& path) {
+diff --git a/iwyu_preprocessor.cc b/iwyu_preprocessor.cc
+index 58e78595..88b93144 100644
+--- a/iwyu_preprocessor.cc
++++ b/iwyu_preprocessor.cc
+@@ -313,7 +313,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+       break;
+     }
+     const string filename = GetSourceTextUntilEndOfLine(current_loc,
+-                                                        DefaultDataGetter());
++                                                        DefaultDataGetter()).str();
+     // Use "" or <> based on where the file lives.
+     string quoted_private_include;
+     if (IsSystemIncludeFile(GetFilePath(current_loc)))
+@@ -332,7 +332,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+     }
+ 
+     string after_text = GetSourceTextUntilEndOfLine(current_loc,
+-                                                    DefaultDataGetter());
++                                                    DefaultDataGetter()).str();
+     const string::size_type close_brace_pos = after_text.find('}');
+     if (close_brace_pos == string::npos) {
+       Warn(current_loc, "@headername directive missing a closing brace");
diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
new file mode 100644
index 00000000000..663a883fa91
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
@@ -0,0 +1,54 @@
+From 30549c6931972456d1e09ff5dbeecd258a8df72b Mon Sep 17 00:00:00 2001
+From: Kim Grasman <kim.grasman@gmail.com>
+Date: Thu, 9 Jul 2020 18:47:56 +0200
+Subject: [PATCH] Implement Stmt printing with ASTDumper
+
+The Clang API changed in commit 473fbc90d1fbf17e so that Stmt::dump
+takes an ASTContext instead of a SourceManager.
+
+Rather than wire a global ASTContext, reimplement PrintableStmt and
+PrintStmt to duplicate the most trivial implementations not requiring
+ASTContext.
+
+No functional change.
+---
+ iwyu_ast_util.cc | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/iwyu_ast_util.cc b/iwyu_ast_util.cc
+index d3d4dd1f..b19a11fb 100644
+--- a/iwyu_ast_util.cc
++++ b/iwyu_ast_util.cc
+@@ -25,6 +25,7 @@
+ #include "llvm/Support/Casting.h"
+ #include "llvm/Support/raw_ostream.h"
+ #include "clang/AST/ASTContext.h"
++#include "clang/AST/ASTDumper.h"
+ #include "clang/AST/CanonicalType.h"
+ #include "clang/AST/Decl.h"
+ #include "clang/AST/DeclBase.h"
+@@ -46,6 +47,7 @@ namespace clang {
+ class FileEntry;
+ }  // namespace clang
+ 
++using clang::ASTDumper;
+ using clang::BlockPointerType;
+ using clang::CXXConstructExpr;
+ using clang::CXXConstructorDecl;
+@@ -450,12 +452,14 @@ string PrintableDecl(const Decl* decl, bool terse/*=true*/) {
+ string PrintableStmt(const Stmt* stmt) {
+   std::string buffer;
+   raw_string_ostream ostream(buffer);
+-  stmt->dump(ostream, *GlobalSourceManager());
++  ASTDumper dumper(ostream, /*ShowColors=*/false);
++  dumper.Visit(stmt);
+   return ostream.str();
+ }
+ 
+ void PrintStmt(const Stmt* stmt) {
+-  stmt->dump(*GlobalSourceManager());  // This prints to errs().
++  ASTDumper dumper(llvm::errs(), /*ShowColors=*/false);
++  dumper.Visit(stmt);
+ }
+ 
+ string PrintableType(const Type* type) {
diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 22c9d09d091..3811309bdde 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.14
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
@@ -15,6 +15,12 @@ distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.
 checksum=43184397db57660c32e3298a6b1fd5ab82e808a1f5ab0591d6745f8d256200ef
 python_version=3
 
+post_extract() {
+	for i in ${FILESDIR}/include-what-you-use-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
+
 post_install() {
 	vlicense LICENSE.TXT
 }

From 952f4639ef9f9289111c34437bdc66f3dcf08896 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 16:17:54 +0100
Subject: [PATCH 21/21] bpftrace: update to 0.11.2

---
 ...trace-001-six-args-bpf_attach_uprobe.patch | 126 +++++++++++++++
 ...ace-002-seven-args-bpf_attach_uprobe.patch | 148 ++++++++++++++++++
 srcpkgs/bpftrace/template                     |  10 +-
 3 files changed, 282 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch

diff --git a/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..e2b1ad1351b
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
@@ -0,0 +1,126 @@
+From 52fb793c6423c19696e07cc14ad5f9182f7eca0e Mon Sep 17 00:00:00 2001
+From: Viktor Malik <viktor.malik@gmail.com>
+Date: Wed, 12 Aug 2020 09:45:29 +0200
+Subject: [PATCH] Feature-detect bpf_attach_kprobe signature
+
+The function has 6 parameters in current versions of BCC and 5
+parameters in older versions.
+
+This is detected in CMake using CHECK_CXX_SOURCE_COMPILES. For static
+compilation, we also need to retrieve and link static libbpf, libelf,
+and libz. This may cause libbpf, libelf and libz to be searched for
+twice, but it should be fine since CMake caches results.
+
+Fixes iovisor#1027.
+---
+ cmake/FindLibBcc.cmake | 24 ++++++++++++++++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 31 ++++++++++++++-----------------
+ tests/CMakeLists.txt   |  3 +++
+ 4 files changed, 44 insertions(+), 17 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 9d30b04bc..ec216271d 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -70,3 +70,27 @@ include (FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBcc "Please install the bcc library package, which is required. Depending on your distro, it may be called bpfcclib or bcclib (Ubuntu), bcc-devel (Fedora), or something else. If unavailable, install bcc from source (github.com/iovisor/bcc)."
+   LIBBCC_LIBRARIES
+   LIBBCC_INCLUDE_DIRS)
++
++# Check bpf_attach_kprobe signature
++if(${LIBBCC_FOUND})
++if(STATIC_LINKING)
++  # libbcc.a is not statically linked with libbpf.a, libelf.a, and libz.a.
++  # If we do a static bpftrace build, we must link them in.
++  find_package(LibBpf)
++  find_package(LibElf)
++  find_package(LibZ)
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_BPF_LIBRARY_STATIC} ${LIBBPF_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBZ_LIBRARIES})
++else()
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_LIBRARIES})
++endif()
++INCLUDE(CheckCXXSourceCompiles)
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_kprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++SET(CMAKE_REQUIRED_LIBRARIES)
++endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 647a23f1c..448a045fc 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -80,6 +80,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 587a11576..afad9ed18 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -754,26 +754,23 @@ void AttachedProbe::load_prog()
+   }
+ }
+ 
+-// XXX(mmarchini): bcc changed the signature of bpf_attach_kprobe, adding a new
+-// int parameter at the end. Since there's no reliable way to feature-detect
+-// this, we create a function pointer with the long signature and cast
+-// bpf_attach_kprobe to this function pointer. If we're on an older bcc
+-// version, bpf_attach_kprobe call will be augmented with an extra register
+-// being used for the last parameter, even though this register won't be used
+-// inside the function. Since the register won't be used this is kinda safe,
+-// although not ideal.
+-typedef int (*attach_probe_wrapper_signature)(int, enum bpf_probe_attach_type, const char*, const char*, uint64_t, int);
+-
+ void AttachedProbe::attach_kprobe(bool safe_mode)
+ {
+   resolve_offset_kprobe(safe_mode);
+-  int perf_event_fd = cast_signature<attach_probe_wrapper_signature>(
+-      &bpf_attach_kprobe)(progfd_,
+-                          attachtype(probe_.type),
+-                          eventname().c_str(),
+-                          probe_.attach_point.c_str(),
+-                          offset_,
+-                          0);
++#ifdef LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_,
++                                        0);
++#else
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_);
++#endif
+ 
+   if (perf_event_fd < 0) {
+     if (probe_.orig_name != probe_.name) {
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 3688b8487..84daeb2aa 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -102,6 +102,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace_test ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..2cc55c86555
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
@@ -0,0 +1,148 @@
+From c7dbab451484b96178da1a8c43330154ce4c9d7a Mon Sep 17 00:00:00 2001
+From: Daniel Xu <dxu@dxuuu.xyz>
+Date: Wed, 14 Oct 2020 17:09:46 -0700
+Subject: [PATCH] Detect 7 arg bpf_attach_uprobe() API
+
+The 7th arg allows us to specify the usdt semaphore location.
+---
+ cmake/FindLibBcc.cmake | 11 +++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 42 ++++++++++++++++++++++++++++++++++--------
+ src/main.cpp           |  6 ++++++
+ tests/CMakeLists.txt   |  3 +++
+ 5 files changed, 57 insertions(+), 8 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 4c09a8ca2..92cedab5e 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -7,6 +7,8 @@
+ #  LIBBCC_DEFINITIONS - Compiler switches required for using libbcc
+ #  LIBBCC_BPF_LIBRARY_STATIC - libbpf static library (for static compilation)
+ #  LIBBCC_LOADER_LIBRARY_STATIC - libbcc helper static library (for static compilation)
++#  LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++#  LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ #
+ # Note that the shared libbcc binary has libbpf and bcc_loader already compiled in but
+ # the static doesn't. So when creating a static build those have to be included too.
+@@ -94,6 +96,15 @@ int main(void) {
+   return 0;
+ }
+ " LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_uprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ SET(CMAKE_REQUIRED_INCLUDES)
+ endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 9162356e3..cef94d144 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -88,6 +88,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 93fbfa876..a5d8bc56d 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -698,12 +698,23 @@ void AttachedProbe::attach_uprobe(bool safe_mode)
+ {
+   resolve_offset_uprobe(safe_mode);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_,
+-                                        attachtype(probe_.type),
+-                                        eventname().c_str(),
+-                                        probe_.path.c_str(),
+-                                        offset_,
+-                                        probe_.pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+     throw std::runtime_error("Error attaching probe: " + probe_.name);
+@@ -812,8 +823,23 @@ void AttachedProbe::attach_usdt(int pid)
+ 
+   offset_ = resolve_offset(probe_.path, probe_.attach_point, probe_.loc);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_, attachtype(probe_.type),
+-      eventname().c_str(), probe_.path.c_str(), offset_, pid == 0 ? -1 : pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+   {
+diff --git a/src/main.cpp b/src/main.cpp
+index 48fcf5aa0..09f4d9677 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -162,6 +162,12 @@ static int info()
+             << "yes" << std::endl;
+ #else
+             << "no" << std::endl;
++#endif
++  std::cerr << "  bcc bpf_attach_uprobe refcount: "
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++            << "yes" << std::endl;
++#else
++            << "no" << std::endl;
+ #endif
+   std::cerr << "  libbpf: "
+ #ifdef HAVE_LIBBPF
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index ace5ff106..332eba2b5 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -116,6 +116,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index d8367fa5c03..44e6c174107 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,6 +1,6 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
-version=0.11.1
+version=0.11.2
 revision=1
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
@@ -12,7 +12,13 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="Apache-2.0"
 homepage="https://github.com/iovisor/bpftrace/"
 distfiles="https://github.com/iovisor/bpftrace/archive/v${version}.tar.gz"
-checksum=98efc9396451bc1a4f73378cec4755e07e7718cb5d698472606f5ffc2b9e48e8
+checksum=1f0fc30073547e3b285e1a373aa469bb18d3ba27f8c05f91016df0ca84f77f90
+
+post_extract() {
+	for i in ${FILESDIR}/bpftrace-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
 
 post_install() {
 	# clashes with bcc-tools

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (20 preceding siblings ...)
  2020-11-09 17:14 ` [PR PATCH] [Updated] " Snektron
@ 2020-11-09 17:15 ` Snektron
  2020-11-09 18:29 ` Snektron
                   ` (10 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 17:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 116892 bytes --]

From e67c1517818253c2aff3fd2dbd12322385c07ce5 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:10 +0100
Subject: [PATCH 01/21] new package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 ...h~b2110e270 (codelite: rebuild for llvm11) |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 747 insertions(+), 13 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11) b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
new file mode 100644
index 00000000000..5be8de4f068
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)	
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -153,7 +153,7 @@
+
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 43c1876f03a498af1bb80c8b99dba8d3b0165491 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:23 +0100
Subject: [PATCH 02/21] llvm: update to 11.0.0

---
 srcpkgs/llvm/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From f28297b79f355d473debf19d9a1677a71e4b0657 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 03/21] llvm10: rebuild standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 2c1f21ff8276ed924d7b6a6db3a3b30699edffbb Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 04/21] llvm-libunwind: update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 1e53f6c753e906d834959b76c6145ee734b6ef15 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 05/21] libcxxabi: update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From 3c4aec90946a3fd9572f1a37187ea39f2b260b7b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 06/21] libcxx: update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From c4f1a7ca7e4ca05a72c3c01c925eea2786f20d42 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 07/21] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From bda37391bf2cb0ca706cae9baedcaf61002a290f Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 08/21] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 0a7fa885fe52ae4c58f482b3047a3f0620f2bca6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 09/21] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 05efe4e577818f71190639ed110aec90287204fc Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 10/21] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From 770792f0427d5d23c9166caea88fead1d2c2a0a3 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 11/21] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From d086ba087c3b176906fc54506c31785d5a9a1c5d Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 12/21] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 3eeb1f0c871ab6392cafb7ef3f09a95a0bf45737 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 13/21] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From bd53d91ff5b275f6ced23054642e5409482ad7ad Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 14/21] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From b4e3c992ca73097fabd1545472abcd090d60967c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 15/21] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From 07f0c58366da77c52ca760c75abf34d730a3ce63 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 16/21] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index bebfa0f4c61..7346474a7cd 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20190823.6
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From bc266b303f6ee7243087905504fa8a8c2cd7ca07 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 17/21] ispc: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

From 85e5421a7c02bf705793a969b6d495f8d4c4f69d Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:24:20 +0100
Subject: [PATCH 18/21] zig: update to 0.7.0

---
 srcpkgs/zig/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index e34d6471728..727a675383a 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,16 +1,16 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.6.0
-revision=2
+version=0.7.0
+revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
-makedepends="clang llvm10 lld-devel"
+makedepends="clang llvm11 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="MIT"
 homepage="https://ziglang.org/"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204
+checksum=0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83
 nopie=yes
 nocross=yes
 

From a35382445bf8959f4085ab4aa3addec1e99c0c33 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:41:53 +0100
Subject: [PATCH 19/21] clazy: rebuild for llvm11

---
 .../files/clazy-001-llvm11-stringref.patch    | 343 ++++++++++++++++++
 .../files/clazy-002-llvm11-stringref.patch    |  28 ++
 srcpkgs/clazy/template                        |   8 +-
 3 files changed, 378 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch

diff --git a/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..48049fa594a
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
@@ -0,0 +1,343 @@
+From 30d6a2b64f5a05722fdc5d8e3754dbf13425cd62 Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Thu, 4 Jun 2020 17:10:21 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+Also included header file clang/Basic/FileManager.h in src/MiniDumper
+because without this header, class clang::FileEntry in incomplete class
+---
+ src/FixItExporter.cpp                                 | 5 +++--
+ src/MiniAstDumper.cpp                                 | 1 +
+ src/Utils.cpp                                         | 2 +-
+ src/checkbase.cpp                                     | 2 +-
+ src/checks/detachingbase.cpp                          | 2 +-
+ src/checks/level0/qenums.cpp                          | 2 +-
+ src/checks/level0/qt-macros.cpp                       | 4 ++--
+ src/checks/level0/unused-non-trivial-variable.cpp     | 2 +-
+ src/checks/level1/detaching-temporary.cpp             | 2 +-
+ src/checks/level1/non-pod-global-static.cpp           | 2 +-
+ src/checks/level1/qproperty-without-notify.cpp        | 2 +-
+ src/checks/level2/missing-typeinfo.cpp                | 2 +-
+ src/checks/level2/old-style-connect.cpp               | 6 +++---
+ src/checks/level2/rule-of-three.cpp                   | 2 +-
+ src/checks/manuallevel/ifndef-define-typo.cpp         | 6 +++---
+ src/checks/manuallevel/qproperty-type-mismatch.cpp    | 2 +-
+ src/checks/manuallevel/qrequiredresult-candidates.cpp | 2 +-
+ src/checks/manuallevel/qt-keywords.cpp                | 4 ++--
+ src/checks/manuallevel/reserve-candidates.cpp         | 3 ++-
+ 19 files changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/src/FixItExporter.cpp b/src/FixItExporter.cpp
+index f3af2e54..44240cf5 100644
+--- a/src/FixItExporter.cpp
++++ b/src/FixItExporter.cpp
+@@ -68,7 +68,7 @@ void FixItExporter::BeginSourceFile(const LangOptions &LangOpts, const Preproces
+ 
+     const auto id = SourceMgr.getMainFileID();
+     const auto entry = SourceMgr.getFileEntryForID(id);
+-    getTuDiag().MainSourceFile = entry->getName();
++    getTuDiag().MainSourceFile = static_cast<std::string>(entry->getName());
+ }
+ 
+ bool FixItExporter::IncludeInDiagnosticCounts() const
+@@ -89,7 +89,8 @@ tooling::Diagnostic FixItExporter::ConvertDiagnostic(const Diagnostic &Info)
+     // TODO: This returns an empty string: DiagEngine->getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
+     // HACK: capture it at the end of the message: Message text [check-name]
+ 
+-    std::string checkName = DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
++    std::string checkName =
++        static_cast<std::string>(DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID()));
+     std::string messageText;
+ 
+     if (checkName.empty()) {
+diff --git a/src/MiniAstDumper.cpp b/src/MiniAstDumper.cpp
+index 47661749..6124e6e8 100644
+--- a/src/MiniAstDumper.cpp
++++ b/src/MiniAstDumper.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <clang/Frontend/CompilerInstance.h>
+ #include <clang/Frontend/FrontendPluginRegistry.h>
++#include <clang/Basic/FileManager.h>
+ 
+ using namespace clang;
+ using namespace std;
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index 001ced98..b0812fe3 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -878,7 +878,7 @@ string Utils::filenameForLoc(SourceLocation loc, const clang::SourceManager &sm)
+     if (loc.isMacroID())
+         loc = sm.getExpansionLoc(loc);
+ 
+-    const string filename = sm.getFilename(loc);
++    const string filename = static_cast<std::string>(sm.getFilename(loc));
+     auto splitted = clazy::splitString(filename, '/');
+     if (splitted.empty())
+         return {};
+diff --git a/src/checkbase.cpp b/src/checkbase.cpp
+index 8b40e19d..22a426cf 100644
+--- a/src/checkbase.cpp
++++ b/src/checkbase.cpp
+@@ -188,7 +188,7 @@ bool CheckBase::shouldIgnoreFile(SourceLocation loc) const
+     if (!loc.isValid())
+         return true;
+ 
+-    string filename = sm().getFilename(loc);
++    string filename = static_cast<std::string>(sm().getFilename(loc));
+ 
+     return clazy::any_of(m_filesToIgnore, [filename](const std::string &ignored) {
+         return clazy::contains(filename, ignored);
+diff --git a/src/checks/detachingbase.cpp b/src/checks/detachingbase.cpp
+index 70311f42..1b094ee7 100644
+--- a/src/checks/detachingbase.cpp
++++ b/src/checks/detachingbase.cpp
+@@ -57,7 +57,7 @@ bool DetachingBase::isDetachingMethod(CXXMethodDecl *method, DetachingMethodType
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = detachingMethodType == DetachingMethod ? clazy::detachingMethods()
+                                                                                                                      : clazy::detachingMethodsWithConstCounterParts();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     if (it != methodsByType.cend()) {
+         const auto &methods = it->second;
+         if (clazy::contains(methods, clazy::name(method)))
+diff --git a/src/checks/level0/qenums.cpp b/src/checks/level0/qenums.cpp
+index 00075b5c..db8910f2 100644
+--- a/src/checks/level0/qenums.cpp
++++ b/src/checks/level0/qenums.cpp
+@@ -59,7 +59,7 @@ void QEnums::VisitMacroExpands(const Token &MacroNameTok, const SourceRange &ran
+         // We simply check if :: is present because it's very cumbersome to to check for different classes when dealing with the pre-processor
+ 
+         CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+-        string text = Lexer::getSourceText(crange, sm(), lo());
++        string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+         if (clazy::contains(text, "::"))
+             return;
+     }
+diff --git a/src/checks/level0/qt-macros.cpp b/src/checks/level0/qt-macros.cpp
+index d3a587cb..ab8e9f52 100644
+--- a/src/checks/level0/qt-macros.cpp
++++ b/src/checks/level0/qt-macros.cpp
+@@ -44,7 +44,7 @@ void QtMacros::VisitMacroDefined(const Token &MacroNameTok)
+         return;
+ 
+     IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
+-    if (ii && clazy::startsWith(ii->getName(), "Q_OS_"))
++    if (ii && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_"))
+         m_OSMacroExists = true;
+ }
+ 
+@@ -58,7 +58,7 @@ void QtMacros::checkIfDef(const Token &macroNameTok, SourceLocation Loc)
+     if (preProcessorVisitor && preProcessorVisitor->qtVersion() < 51204 && ii->getName() == "Q_OS_WINDOWS") {
+         // Q_OS_WINDOWS was introduced in 5.12.4
+         emitWarning(Loc, "Q_OS_WINDOWS was only introduced in Qt 5.12.4, use Q_OS_WIN instead");
+-    } else if (!m_OSMacroExists && clazy::startsWith(ii->getName(), "Q_OS_")) {
++    } else if (!m_OSMacroExists && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_")) {
+         emitWarning(Loc, "Include qglobal.h before testing Q_OS_ macros");
+     }
+ }
+diff --git a/src/checks/level0/unused-non-trivial-variable.cpp b/src/checks/level0/unused-non-trivial-variable.cpp
+index 4e4b8303..93815f27 100644
+--- a/src/checks/level0/unused-non-trivial-variable.cpp
++++ b/src/checks/level0/unused-non-trivial-variable.cpp
+@@ -91,7 +91,7 @@ bool UnusedNonTrivialVariable::isUninterestingType(const CXXRecordDecl *record)
+     static const vector<StringRef> blacklistedTemplates = { "QScopedPointer", "QSetValueOnDestroy", "QScopedValueRollback" };
+     StringRef className = clazy::name(record);
+     for (StringRef templateName : blacklistedTemplates) {
+-        if (clazy::startsWith(className, templateName))
++        if (clazy::startsWith(static_cast<std::string>(className), static_cast<std::string>(templateName)))
+             return true;
+     }
+ 
+diff --git a/src/checks/level1/detaching-temporary.cpp b/src/checks/level1/detaching-temporary.cpp
+index fedfc81c..60c75532 100644
+--- a/src/checks/level1/detaching-temporary.cpp
++++ b/src/checks/level1/detaching-temporary.cpp
+@@ -140,7 +140,7 @@ void DetachingTemporary::VisitStmt(clang::Stmt *stm)
+     StringRef className = clazy::name(classDecl);
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = clazy::detachingMethods();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     auto it2 = m_writeMethodsByType.find(className);
+ 
+     std::vector<StringRef> allowedFunctions;
+diff --git a/src/checks/level1/non-pod-global-static.cpp b/src/checks/level1/non-pod-global-static.cpp
+index 5879bff8..433b5c5f 100644
+--- a/src/checks/level1/non-pod-global-static.cpp
++++ b/src/checks/level1/non-pod-global-static.cpp
+@@ -74,7 +74,7 @@ void NonPodGlobalStatic::VisitStmt(clang::Stmt *stm)
+     const SourceLocation declStart = clazy::getLocStart(varDecl);
+ 
+     if (declStart.isMacroID()) {
+-        auto macroName = Lexer::getImmediateMacroName(declStart, sm(), lo());
++        auto macroName = static_cast<std::string>(Lexer::getImmediateMacroName(declStart, sm(), lo()));
+         if (clazy::startsWithAny(macroName, { "Q_IMPORT_PLUGIN", "Q_CONSTRUCTOR_FUNCTION", "Q_DESTRUCTOR_FUNCTION"})) // Don't warn on these
+             return;
+     }
+diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp
+index e1d6db4a..3af9fee2 100644
+--- a/src/checks/level1/qproperty-without-notify.cpp
++++ b/src/checks/level1/qproperty-without-notify.cpp
+@@ -69,7 +69,7 @@ void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok,
+         return;
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/level2/missing-typeinfo.cpp b/src/checks/level2/missing-typeinfo.cpp
+index 98df2cd4..03b44e06 100644
+--- a/src/checks/level2/missing-typeinfo.cpp
++++ b/src/checks/level2/missing-typeinfo.cpp
+@@ -74,7 +74,7 @@ void MissingTypeInfo::VisitDecl(clang::Decl *decl)
+         if (sm().isInSystemHeader(clazy::getLocStart(record)))
+             return;
+ 
+-        std::string typeName = clazy::name(record);
++        std::string typeName = static_cast<std::string>(clazy::name(record));
+         if (typeName == "QPair") // QPair doesn't use Q_DECLARE_TYPEINFO, but rather a explicit QTypeInfo.
+             return;
+ 
+diff --git a/src/checks/level2/old-style-connect.cpp b/src/checks/level2/old-style-connect.cpp
+index 0fe68c13..396cb703 100644
+--- a/src/checks/level2/old-style-connect.cpp
++++ b/src/checks/level2/old-style-connect.cpp
+@@ -274,7 +274,7 @@ void OldStyleConnect::VisitMacroExpands(const Token &macroNameTok, const SourceR
+         return;
+ 
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(Q_PRIVATE_SLOT\s*\((.*)\s*,\s*.*\s+(.*)\(.*)");
+     smatch match;
+@@ -293,7 +293,7 @@ string OldStyleConnect::signalOrSlotNameFromMacro(SourceLocation macroLoc)
+     CharSourceRange expansionRange = clazy::getImmediateExpansionRange(macroLoc, sm());
+     SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(\s*(SIGNAL|SLOT)\s*\(\s*(.+)\s*\(.*)");
+ 
+@@ -315,7 +315,7 @@ bool OldStyleConnect::isSignalOrSlot(SourceLocation loc, string &macroName) cons
+     if (!loc.isMacroID() || loc.isInvalid())
+         return false;
+ 
+-    macroName = Lexer::getImmediateMacroName(loc, sm(), lo());
++    macroName = static_cast<std::string>(Lexer::getImmediateMacroName(loc, sm(), lo()));
+     return macroName == "SIGNAL" || macroName == "SLOT";
+ }
+ 
+diff --git a/src/checks/level2/rule-of-three.cpp b/src/checks/level2/rule-of-three.cpp
+index 8db55d53..7583fcc5 100644
+--- a/src/checks/level2/rule-of-three.cpp
++++ b/src/checks/level2/rule-of-three.cpp
+@@ -140,7 +140,7 @@ void RuleOfThree::VisitDecl(clang::Decl *decl)
+ 
+     const string className = record->getNameAsString();
+     const string classQualifiedName = record->getQualifiedNameAsString();
+-    const string filename = sm().getFilename(recordStart);
++    const string filename = static_cast<std::string>(sm().getFilename(recordStart));
+     if (clazy::endsWith(className, "Private") && clazy::endsWithAny(filename, { ".cpp", ".cxx", "_p.h" }))
+         return; // Lots of RAII classes fall into this category. And even Private (d-pointer) classes, warning in that case would just be noise
+ 
+diff --git a/src/checks/manuallevel/ifndef-define-typo.cpp b/src/checks/manuallevel/ifndef-define-typo.cpp
+index edb6cdf4..e9c50a45 100644
+--- a/src/checks/manuallevel/ifndef-define-typo.cpp
++++ b/src/checks/manuallevel/ifndef-define-typo.cpp
+@@ -44,7 +44,7 @@ void IfndefDefineTypo::VisitMacroDefined(const Token &macroNameTok)
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -53,7 +53,7 @@ void IfndefDefineTypo::VisitDefined(const Token &macroNameTok, const SourceRange
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -66,7 +66,7 @@ void IfndefDefineTypo::VisitIfdef(SourceLocation, const Token &)
+ void IfndefDefineTypo::VisitIfndef(SourceLocation, const Token &macroNameTok)
+ {
+     if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo())
+-        m_lastIfndef = ii->getName();
++        m_lastIfndef = static_cast<std::string>(ii->getName());
+ }
+ 
+ void IfndefDefineTypo::VisitIf(SourceLocation, SourceRange, PPCallbacks::ConditionValueKind)
+diff --git a/src/checks/manuallevel/qproperty-type-mismatch.cpp b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+index f91159cb..952d9f1d 100644
+--- a/src/checks/manuallevel/qproperty-type-mismatch.cpp
++++ b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+@@ -237,7 +237,7 @@ void QPropertyTypeMismatch::VisitMacroExpands(const clang::Token &MacroNameTok,
+ 
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (!text.empty() && text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/manuallevel/qrequiredresult-candidates.cpp b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+index 912dbaa0..6375bd7b 100644
+--- a/src/checks/manuallevel/qrequiredresult-candidates.cpp
++++ b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+@@ -65,7 +65,7 @@ void QRequiredResultCandidates::VisitDecl(clang::Decl *decl)
+ 
+ 
+     if (returnClass == classDecl) {
+-        const std::string methodName = clazy::name(method);
++        const std::string methodName = static_cast<std::string>(clazy::name(method));
+         if (methodName.empty()) // fixes assert
+             return;
+ 
+diff --git a/src/checks/manuallevel/qt-keywords.cpp b/src/checks/manuallevel/qt-keywords.cpp
+index e792e95a..b60752c9 100644
+--- a/src/checks/manuallevel/qt-keywords.cpp
++++ b/src/checks/manuallevel/qt-keywords.cpp
+@@ -59,12 +59,12 @@ void QtKeywords::VisitMacroExpands(const Token &macroNameTok, const SourceRange
+     }
+ 
+     static const vector<StringRef> keywords = { "foreach", "signals", "slots", "emit" };
+-    std::string name = ii->getName();
++    std::string name = static_cast<std::string>(ii->getName());
+     if (!clazy::contains(keywords, name))
+         return;
+ 
+     // Make sure the macro is Qt's. It must be defined in Qt's headers, not 3rdparty
+-    std::string qtheader = sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc()));
++    std::string qtheader = static_cast<std::string>(sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc())));
+     if (!clazy::endsWith(qtheader, "qglobal.h") && !clazy::endsWith(qtheader, "qobjectdefs.h"))
+         return;
+ 
+diff --git a/src/checks/manuallevel/reserve-candidates.cpp b/src/checks/manuallevel/reserve-candidates.cpp
+index 389cac5a..92e4491c 100644
+--- a/src/checks/manuallevel/reserve-candidates.cpp
++++ b/src/checks/manuallevel/reserve-candidates.cpp
+@@ -78,7 +78,8 @@ static bool isCandidateMethod(CXXMethodDecl *methodDecl)
+     if (!classDecl)
+         return false;
+ 
+-    if (!clazy::equalsAny(clazy::name(methodDecl), { "append", "push_back", "push", "operator<<", "operator+=" }))
++    if (!clazy::equalsAny(static_cast<std::string>(clazy::name(methodDecl)),
++                 { "append", "push_back", "push", "operator<<", "operator+=" }))
+         return false;
+ 
+     if (!clazy::isAReserveClass(classDecl))
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
new file mode 100644
index 00000000000..28cbb60b091
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
@@ -0,0 +1,28 @@
+From 25aa102cc49def9573ffbed88155589cd60a2e8f Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Fri, 5 Jun 2020 16:52:53 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10 (clazy-standalone)
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+---
+ src/checks/manuallevel/jnisignatures.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/checks/manuallevel/jnisignatures.cpp b/src/checks/manuallevel/jnisignatures.cpp
+index 81e61d48..5d4fe203 100644
+--- a/src/checks/manuallevel/jnisignatures.cpp
++++ b/src/checks/manuallevel/jnisignatures.cpp
+@@ -103,7 +103,7 @@ void JniSignatures::checkFunctionCall(Stmt *stm)
+         return;
+     }
+ 
+-    const std::string name = clazy::name(funDecl);
++    const std::string name = static_cast<std::string>(clazy::name(funDecl));
+ 
+     if (name == "callObjectMethod" || name == "callMethod") {
+         checkArgAt(callExpr, 0, methodNameRegex, "Invalid method name");
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 4d8557be669..5af2b918e14 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.7
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"
@@ -12,3 +12,9 @@ homepage="https://cgit.kde.org/clazy.git/about/"
 distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
 checksum=754da5815f769dd6b72a040a2430525c93f294eb7769c78271603df9614f1b21
 nocross="Clang cannot be installed as makedep"
+
+post_extract() {
+	for i in ${FILESDIR}/clazy-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}

From bd6b62c52ce00724cd79bce2744a7229cda7f3fc Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 15:19:37 +0100
Subject: [PATCH 20/21] include-what-you-use: rebuild for llvm11

---
 ...de-what-you-use-001-llvm11-stringref.patch | 146 ++++++++++++++++++
 ...ude-what-you-use-002-clang-astdumper.patch |  54 +++++++
 srcpkgs/include-what-you-use/template         |   8 +-
 3 files changed, 207 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch

diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..171dca28e34
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
@@ -0,0 +1,146 @@
+From 53487d209729d5781007dc0fd6076dc585cb3727 Mon Sep 17 00:00:00 2001
+From: Andrea Bocci <andrea.bocci@cern.ch>
+Date: Fri, 28 Feb 2020 17:45:03 +0100
+Subject: [PATCH] Add explicit conversion from llvm::StringRef to std::string
+
+llvm/llvm-project@777180a makes the llvm::StringRef conversion operator
+to std::string explicit.
+These changes add a call to the str() method to perform the conversion.
+
+Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
+---
+ iwyu_driver.cc       | 2 +-
+ iwyu_globals.cc      | 4 ++--
+ iwyu_lexer_utils.cc  | 2 +-
+ iwyu_location_util.h | 2 +-
+ iwyu_output.cc       | 2 +-
+ iwyu_path_util.cc    | 6 +++---
+ iwyu_preprocessor.cc | 4 ++--
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/iwyu_driver.cc b/iwyu_driver.cc
+index bd163144..42fea35b 100644
+--- a/iwyu_driver.cc
++++ b/iwyu_driver.cc
+@@ -79,7 +79,7 @@ std::string GetExecutablePath(const char *Argv0) {
+ }
+ 
+ const char *SaveStringInSet(std::set<std::string> &SavedStrings, StringRef S) {
+-  return SavedStrings.insert(S).first->c_str();
++  return SavedStrings.insert(S.str()).first->c_str();
+ }
+ 
+ void ExpandArgsFromBuf(const char *Arg,
+diff --git a/iwyu_globals.cc b/iwyu_globals.cc
+index 0f58b4dc..26998966 100644
+--- a/iwyu_globals.cc
++++ b/iwyu_globals.cc
+@@ -293,7 +293,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+   for (auto it = header_search->system_dir_begin();
+        it != header_search->system_dir_end(); ++it) {
+     if (const DirectoryEntry* entry = it->getDir()) {
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map[path] = HeaderSearchPath::kSystemPath;
+     }
+   }
+@@ -303,7 +303,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+       // search_dir_begin()/end() includes both system and user paths.
+       // If it's a system path, it's already in the map, so everything
+       // new is a user path.  The insert only 'takes' for new entries.
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map.insert(make_pair(path, HeaderSearchPath::kUserPath));
+     }
+   }
+diff --git a/iwyu_lexer_utils.cc b/iwyu_lexer_utils.cc
+index fcea2d28..648c9da8 100644
+--- a/iwyu_lexer_utils.cc
++++ b/iwyu_lexer_utils.cc
+@@ -70,7 +70,7 @@ SourceLocation GetLocationAfter(
+ string GetIncludeNameAsWritten(
+     SourceLocation include_loc,
+     const CharacterDataGetterInterface& data_getter) {
+-  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter);
++  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter).str();
+   if (data.empty())
+     return data;
+   string::size_type endpos = string::npos;
+diff --git a/iwyu_location_util.h b/iwyu_location_util.h
+index 3892a424..6f8cf81c 100644
+--- a/iwyu_location_util.h
++++ b/iwyu_location_util.h
+@@ -89,7 +89,7 @@ bool IsInScratchSpace(clang::SourceLocation loc);
+ 
+ inline string GetFilePath(const clang::FileEntry* file) {
+   return (IsBuiltinFile(file) ? "<built-in>" :
+-          NormalizeFilePath(file->getName()));
++          NormalizeFilePath(file->getName().str()));
+ }
+ 
+ //------------------------------------------------------------
+diff --git a/iwyu_output.cc b/iwyu_output.cc
+index ca145710..8666c26c 100644
+--- a/iwyu_output.cc
++++ b/iwyu_output.cc
+@@ -168,7 +168,7 @@ string GetKindName(const clang::TagDecl* tag_decl) {
+   if (const FakeNamedDecl* fake = FakeNamedDeclIfItIsOne(named_decl)) {
+     return fake->kind_name();
+   }
+-  return tag_decl->getKindName();
++  return tag_decl->getKindName().str();
+ }
+ 
+ string GetQualifiedNameAsString(const clang::NamedDecl* named_decl) {
+diff --git a/iwyu_path_util.cc b/iwyu_path_util.cc
+index ab4fc800..9987ea47 100644
+--- a/iwyu_path_util.cc
++++ b/iwyu_path_util.cc
+@@ -134,7 +134,7 @@ string NormalizeFilePath(const string& path) {
+   std::replace(normalized.begin(), normalized.end(), '\\', '/');
+ #endif
+ 
+-  return normalized.str();
++  return normalized.str().str();
+ }
+ 
+ string NormalizeDirPath(const string& path) {
+@@ -154,14 +154,14 @@ string MakeAbsolutePath(const string& path) {
+   std::error_code error = llvm::sys::fs::make_absolute(absolute_path);
+   CHECK_(!error);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string MakeAbsolutePath(const string& base_path, const string& relative_path) {
+   llvm::SmallString<128> absolute_path(base_path);
+   llvm::sys::path::append(absolute_path, relative_path);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string GetParentPath(const string& path) {
+diff --git a/iwyu_preprocessor.cc b/iwyu_preprocessor.cc
+index 58e78595..88b93144 100644
+--- a/iwyu_preprocessor.cc
++++ b/iwyu_preprocessor.cc
+@@ -313,7 +313,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+       break;
+     }
+     const string filename = GetSourceTextUntilEndOfLine(current_loc,
+-                                                        DefaultDataGetter());
++                                                        DefaultDataGetter()).str();
+     // Use "" or <> based on where the file lives.
+     string quoted_private_include;
+     if (IsSystemIncludeFile(GetFilePath(current_loc)))
+@@ -332,7 +332,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+     }
+ 
+     string after_text = GetSourceTextUntilEndOfLine(current_loc,
+-                                                    DefaultDataGetter());
++                                                    DefaultDataGetter()).str();
+     const string::size_type close_brace_pos = after_text.find('}');
+     if (close_brace_pos == string::npos) {
+       Warn(current_loc, "@headername directive missing a closing brace");
diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
new file mode 100644
index 00000000000..663a883fa91
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
@@ -0,0 +1,54 @@
+From 30549c6931972456d1e09ff5dbeecd258a8df72b Mon Sep 17 00:00:00 2001
+From: Kim Grasman <kim.grasman@gmail.com>
+Date: Thu, 9 Jul 2020 18:47:56 +0200
+Subject: [PATCH] Implement Stmt printing with ASTDumper
+
+The Clang API changed in commit 473fbc90d1fbf17e so that Stmt::dump
+takes an ASTContext instead of a SourceManager.
+
+Rather than wire a global ASTContext, reimplement PrintableStmt and
+PrintStmt to duplicate the most trivial implementations not requiring
+ASTContext.
+
+No functional change.
+---
+ iwyu_ast_util.cc | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/iwyu_ast_util.cc b/iwyu_ast_util.cc
+index d3d4dd1f..b19a11fb 100644
+--- a/iwyu_ast_util.cc
++++ b/iwyu_ast_util.cc
+@@ -25,6 +25,7 @@
+ #include "llvm/Support/Casting.h"
+ #include "llvm/Support/raw_ostream.h"
+ #include "clang/AST/ASTContext.h"
++#include "clang/AST/ASTDumper.h"
+ #include "clang/AST/CanonicalType.h"
+ #include "clang/AST/Decl.h"
+ #include "clang/AST/DeclBase.h"
+@@ -46,6 +47,7 @@ namespace clang {
+ class FileEntry;
+ }  // namespace clang
+ 
++using clang::ASTDumper;
+ using clang::BlockPointerType;
+ using clang::CXXConstructExpr;
+ using clang::CXXConstructorDecl;
+@@ -450,12 +452,14 @@ string PrintableDecl(const Decl* decl, bool terse/*=true*/) {
+ string PrintableStmt(const Stmt* stmt) {
+   std::string buffer;
+   raw_string_ostream ostream(buffer);
+-  stmt->dump(ostream, *GlobalSourceManager());
++  ASTDumper dumper(ostream, /*ShowColors=*/false);
++  dumper.Visit(stmt);
+   return ostream.str();
+ }
+ 
+ void PrintStmt(const Stmt* stmt) {
+-  stmt->dump(*GlobalSourceManager());  // This prints to errs().
++  ASTDumper dumper(llvm::errs(), /*ShowColors=*/false);
++  dumper.Visit(stmt);
+ }
+ 
+ string PrintableType(const Type* type) {
diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 22c9d09d091..3811309bdde 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.14
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
@@ -15,6 +15,12 @@ distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.
 checksum=43184397db57660c32e3298a6b1fd5ab82e808a1f5ab0591d6745f8d256200ef
 python_version=3
 
+post_extract() {
+	for i in ${FILESDIR}/include-what-you-use-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
+
 post_install() {
 	vlicense LICENSE.TXT
 }

From 4e0480d6f411c63c9b96619bdb70bce303a0b48b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 16:17:54 +0100
Subject: [PATCH 21/21] bpftrace: update to 0.11.2

---
 ...trace-001-six-args-bpf_attach_uprobe.patch | 126 +++++++++++++++
 ...ace-002-seven-args-bpf_attach_uprobe.patch | 148 ++++++++++++++++++
 srcpkgs/bpftrace/template                     |  10 +-
 3 files changed, 282 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch

diff --git a/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..e2b1ad1351b
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
@@ -0,0 +1,126 @@
+From 52fb793c6423c19696e07cc14ad5f9182f7eca0e Mon Sep 17 00:00:00 2001
+From: Viktor Malik <viktor.malik@gmail.com>
+Date: Wed, 12 Aug 2020 09:45:29 +0200
+Subject: [PATCH] Feature-detect bpf_attach_kprobe signature
+
+The function has 6 parameters in current versions of BCC and 5
+parameters in older versions.
+
+This is detected in CMake using CHECK_CXX_SOURCE_COMPILES. For static
+compilation, we also need to retrieve and link static libbpf, libelf,
+and libz. This may cause libbpf, libelf and libz to be searched for
+twice, but it should be fine since CMake caches results.
+
+Fixes iovisor#1027.
+---
+ cmake/FindLibBcc.cmake | 24 ++++++++++++++++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 31 ++++++++++++++-----------------
+ tests/CMakeLists.txt   |  3 +++
+ 4 files changed, 44 insertions(+), 17 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 9d30b04bc..ec216271d 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -70,3 +70,27 @@ include (FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBcc "Please install the bcc library package, which is required. Depending on your distro, it may be called bpfcclib or bcclib (Ubuntu), bcc-devel (Fedora), or something else. If unavailable, install bcc from source (github.com/iovisor/bcc)."
+   LIBBCC_LIBRARIES
+   LIBBCC_INCLUDE_DIRS)
++
++# Check bpf_attach_kprobe signature
++if(${LIBBCC_FOUND})
++if(STATIC_LINKING)
++  # libbcc.a is not statically linked with libbpf.a, libelf.a, and libz.a.
++  # If we do a static bpftrace build, we must link them in.
++  find_package(LibBpf)
++  find_package(LibElf)
++  find_package(LibZ)
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_BPF_LIBRARY_STATIC} ${LIBBPF_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBZ_LIBRARIES})
++else()
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_LIBRARIES})
++endif()
++INCLUDE(CheckCXXSourceCompiles)
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_kprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++SET(CMAKE_REQUIRED_LIBRARIES)
++endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 647a23f1c..448a045fc 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -80,6 +80,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 587a11576..afad9ed18 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -754,26 +754,23 @@ void AttachedProbe::load_prog()
+   }
+ }
+ 
+-// XXX(mmarchini): bcc changed the signature of bpf_attach_kprobe, adding a new
+-// int parameter at the end. Since there's no reliable way to feature-detect
+-// this, we create a function pointer with the long signature and cast
+-// bpf_attach_kprobe to this function pointer. If we're on an older bcc
+-// version, bpf_attach_kprobe call will be augmented with an extra register
+-// being used for the last parameter, even though this register won't be used
+-// inside the function. Since the register won't be used this is kinda safe,
+-// although not ideal.
+-typedef int (*attach_probe_wrapper_signature)(int, enum bpf_probe_attach_type, const char*, const char*, uint64_t, int);
+-
+ void AttachedProbe::attach_kprobe(bool safe_mode)
+ {
+   resolve_offset_kprobe(safe_mode);
+-  int perf_event_fd = cast_signature<attach_probe_wrapper_signature>(
+-      &bpf_attach_kprobe)(progfd_,
+-                          attachtype(probe_.type),
+-                          eventname().c_str(),
+-                          probe_.attach_point.c_str(),
+-                          offset_,
+-                          0);
++#ifdef LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_,
++                                        0);
++#else
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_);
++#endif
+ 
+   if (perf_event_fd < 0) {
+     if (probe_.orig_name != probe_.name) {
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 3688b8487..84daeb2aa 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -102,6 +102,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace_test ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..2cc55c86555
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
@@ -0,0 +1,148 @@
+From c7dbab451484b96178da1a8c43330154ce4c9d7a Mon Sep 17 00:00:00 2001
+From: Daniel Xu <dxu@dxuuu.xyz>
+Date: Wed, 14 Oct 2020 17:09:46 -0700
+Subject: [PATCH] Detect 7 arg bpf_attach_uprobe() API
+
+The 7th arg allows us to specify the usdt semaphore location.
+---
+ cmake/FindLibBcc.cmake | 11 +++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 42 ++++++++++++++++++++++++++++++++++--------
+ src/main.cpp           |  6 ++++++
+ tests/CMakeLists.txt   |  3 +++
+ 5 files changed, 57 insertions(+), 8 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 4c09a8ca2..92cedab5e 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -7,6 +7,8 @@
+ #  LIBBCC_DEFINITIONS - Compiler switches required for using libbcc
+ #  LIBBCC_BPF_LIBRARY_STATIC - libbpf static library (for static compilation)
+ #  LIBBCC_LOADER_LIBRARY_STATIC - libbcc helper static library (for static compilation)
++#  LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++#  LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ #
+ # Note that the shared libbcc binary has libbpf and bcc_loader already compiled in but
+ # the static doesn't. So when creating a static build those have to be included too.
+@@ -94,6 +96,15 @@ int main(void) {
+   return 0;
+ }
+ " LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_uprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ SET(CMAKE_REQUIRED_INCLUDES)
+ endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 9162356e3..cef94d144 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -88,6 +88,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 93fbfa876..a5d8bc56d 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -698,12 +698,23 @@ void AttachedProbe::attach_uprobe(bool safe_mode)
+ {
+   resolve_offset_uprobe(safe_mode);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_,
+-                                        attachtype(probe_.type),
+-                                        eventname().c_str(),
+-                                        probe_.path.c_str(),
+-                                        offset_,
+-                                        probe_.pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+     throw std::runtime_error("Error attaching probe: " + probe_.name);
+@@ -812,8 +823,23 @@ void AttachedProbe::attach_usdt(int pid)
+ 
+   offset_ = resolve_offset(probe_.path, probe_.attach_point, probe_.loc);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_, attachtype(probe_.type),
+-      eventname().c_str(), probe_.path.c_str(), offset_, pid == 0 ? -1 : pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+   {
+diff --git a/src/main.cpp b/src/main.cpp
+index 48fcf5aa0..09f4d9677 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -162,6 +162,12 @@ static int info()
+             << "yes" << std::endl;
+ #else
+             << "no" << std::endl;
++#endif
++  std::cerr << "  bcc bpf_attach_uprobe refcount: "
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++            << "yes" << std::endl;
++#else
++            << "no" << std::endl;
+ #endif
+   std::cerr << "  libbpf: "
+ #ifdef HAVE_LIBBPF
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index ace5ff106..332eba2b5 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -116,6 +116,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index d8367fa5c03..44e6c174107 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,6 +1,6 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
-version=0.11.1
+version=0.11.2
 revision=1
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
@@ -12,7 +12,13 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="Apache-2.0"
 homepage="https://github.com/iovisor/bpftrace/"
 distfiles="https://github.com/iovisor/bpftrace/archive/v${version}.tar.gz"
-checksum=98efc9396451bc1a4f73378cec4755e07e7718cb5d698472606f5ffc2b9e48e8
+checksum=1f0fc30073547e3b285e1a373aa469bb18d3ba27f8c05f91016df0ca84f77f90
+
+post_extract() {
+	for i in ${FILESDIR}/bpftrace-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
 
 post_install() {
 	# clashes with bcc-tools

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (21 preceding siblings ...)
  2020-11-09 17:15 ` Snektron
@ 2020-11-09 18:29 ` Snektron
  2020-11-09 19:00 ` Snektron
                   ` (9 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 18:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 165891 bytes --]

From e67c1517818253c2aff3fd2dbd12322385c07ce5 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:10 +0100
Subject: [PATCH 01/22] new package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 ...h~b2110e270 (codelite: rebuild for llvm11) |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 747 insertions(+), 13 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index cba355c3bfa..7242e863a8c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11) b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
new file mode 100644
index 00000000000..5be8de4f068
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)	
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -153,7 +153,7 @@
+
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 43c1876f03a498af1bb80c8b99dba8d3b0165491 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:23 +0100
Subject: [PATCH 02/22] llvm: update to 11.0.0

---
 srcpkgs/llvm/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From f28297b79f355d473debf19d9a1677a71e4b0657 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 03/22] llvm10: rebuild standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 2c1f21ff8276ed924d7b6a6db3a3b30699edffbb Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 04/22] llvm-libunwind: update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 1e53f6c753e906d834959b76c6145ee734b6ef15 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 05/22] libcxxabi: update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From 3c4aec90946a3fd9572f1a37187ea39f2b260b7b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 06/22] libcxx: update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From c4f1a7ca7e4ca05a72c3c01c925eea2786f20d42 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 07/22] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From bda37391bf2cb0ca706cae9baedcaf61002a290f Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 08/22] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 0a7fa885fe52ae4c58f482b3047a3f0620f2bca6 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 09/22] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 05efe4e577818f71190639ed110aec90287204fc Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 10/22] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From 770792f0427d5d23c9166caea88fead1d2c2a0a3 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 11/22] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From d086ba087c3b176906fc54506c31785d5a9a1c5d Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 12/22] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 3eeb1f0c871ab6392cafb7ef3f09a95a0bf45737 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 13/22] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From bd53d91ff5b275f6ced23054642e5409482ad7ad Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 14/22] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From b4e3c992ca73097fabd1545472abcd090d60967c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 15/22] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From 07f0c58366da77c52ca760c75abf34d730a3ce63 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 16/22] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index bebfa0f4c61..7346474a7cd 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20190823.6
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From bc266b303f6ee7243087905504fa8a8c2cd7ca07 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 17/22] ispc: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

From 85e5421a7c02bf705793a969b6d495f8d4c4f69d Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:24:20 +0100
Subject: [PATCH 18/22] zig: update to 0.7.0

---
 srcpkgs/zig/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index e34d6471728..727a675383a 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,16 +1,16 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.6.0
-revision=2
+version=0.7.0
+revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
-makedepends="clang llvm10 lld-devel"
+makedepends="clang llvm11 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="MIT"
 homepage="https://ziglang.org/"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204
+checksum=0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83
 nopie=yes
 nocross=yes
 

From a35382445bf8959f4085ab4aa3addec1e99c0c33 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:41:53 +0100
Subject: [PATCH 19/22] clazy: rebuild for llvm11

---
 .../files/clazy-001-llvm11-stringref.patch    | 343 ++++++++++++++++++
 .../files/clazy-002-llvm11-stringref.patch    |  28 ++
 srcpkgs/clazy/template                        |   8 +-
 3 files changed, 378 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch

diff --git a/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..48049fa594a
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
@@ -0,0 +1,343 @@
+From 30d6a2b64f5a05722fdc5d8e3754dbf13425cd62 Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Thu, 4 Jun 2020 17:10:21 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+Also included header file clang/Basic/FileManager.h in src/MiniDumper
+because without this header, class clang::FileEntry in incomplete class
+---
+ src/FixItExporter.cpp                                 | 5 +++--
+ src/MiniAstDumper.cpp                                 | 1 +
+ src/Utils.cpp                                         | 2 +-
+ src/checkbase.cpp                                     | 2 +-
+ src/checks/detachingbase.cpp                          | 2 +-
+ src/checks/level0/qenums.cpp                          | 2 +-
+ src/checks/level0/qt-macros.cpp                       | 4 ++--
+ src/checks/level0/unused-non-trivial-variable.cpp     | 2 +-
+ src/checks/level1/detaching-temporary.cpp             | 2 +-
+ src/checks/level1/non-pod-global-static.cpp           | 2 +-
+ src/checks/level1/qproperty-without-notify.cpp        | 2 +-
+ src/checks/level2/missing-typeinfo.cpp                | 2 +-
+ src/checks/level2/old-style-connect.cpp               | 6 +++---
+ src/checks/level2/rule-of-three.cpp                   | 2 +-
+ src/checks/manuallevel/ifndef-define-typo.cpp         | 6 +++---
+ src/checks/manuallevel/qproperty-type-mismatch.cpp    | 2 +-
+ src/checks/manuallevel/qrequiredresult-candidates.cpp | 2 +-
+ src/checks/manuallevel/qt-keywords.cpp                | 4 ++--
+ src/checks/manuallevel/reserve-candidates.cpp         | 3 ++-
+ 19 files changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/src/FixItExporter.cpp b/src/FixItExporter.cpp
+index f3af2e54..44240cf5 100644
+--- a/src/FixItExporter.cpp
++++ b/src/FixItExporter.cpp
+@@ -68,7 +68,7 @@ void FixItExporter::BeginSourceFile(const LangOptions &LangOpts, const Preproces
+ 
+     const auto id = SourceMgr.getMainFileID();
+     const auto entry = SourceMgr.getFileEntryForID(id);
+-    getTuDiag().MainSourceFile = entry->getName();
++    getTuDiag().MainSourceFile = static_cast<std::string>(entry->getName());
+ }
+ 
+ bool FixItExporter::IncludeInDiagnosticCounts() const
+@@ -89,7 +89,8 @@ tooling::Diagnostic FixItExporter::ConvertDiagnostic(const Diagnostic &Info)
+     // TODO: This returns an empty string: DiagEngine->getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
+     // HACK: capture it at the end of the message: Message text [check-name]
+ 
+-    std::string checkName = DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
++    std::string checkName =
++        static_cast<std::string>(DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID()));
+     std::string messageText;
+ 
+     if (checkName.empty()) {
+diff --git a/src/MiniAstDumper.cpp b/src/MiniAstDumper.cpp
+index 47661749..6124e6e8 100644
+--- a/src/MiniAstDumper.cpp
++++ b/src/MiniAstDumper.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <clang/Frontend/CompilerInstance.h>
+ #include <clang/Frontend/FrontendPluginRegistry.h>
++#include <clang/Basic/FileManager.h>
+ 
+ using namespace clang;
+ using namespace std;
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index 001ced98..b0812fe3 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -878,7 +878,7 @@ string Utils::filenameForLoc(SourceLocation loc, const clang::SourceManager &sm)
+     if (loc.isMacroID())
+         loc = sm.getExpansionLoc(loc);
+ 
+-    const string filename = sm.getFilename(loc);
++    const string filename = static_cast<std::string>(sm.getFilename(loc));
+     auto splitted = clazy::splitString(filename, '/');
+     if (splitted.empty())
+         return {};
+diff --git a/src/checkbase.cpp b/src/checkbase.cpp
+index 8b40e19d..22a426cf 100644
+--- a/src/checkbase.cpp
++++ b/src/checkbase.cpp
+@@ -188,7 +188,7 @@ bool CheckBase::shouldIgnoreFile(SourceLocation loc) const
+     if (!loc.isValid())
+         return true;
+ 
+-    string filename = sm().getFilename(loc);
++    string filename = static_cast<std::string>(sm().getFilename(loc));
+ 
+     return clazy::any_of(m_filesToIgnore, [filename](const std::string &ignored) {
+         return clazy::contains(filename, ignored);
+diff --git a/src/checks/detachingbase.cpp b/src/checks/detachingbase.cpp
+index 70311f42..1b094ee7 100644
+--- a/src/checks/detachingbase.cpp
++++ b/src/checks/detachingbase.cpp
+@@ -57,7 +57,7 @@ bool DetachingBase::isDetachingMethod(CXXMethodDecl *method, DetachingMethodType
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = detachingMethodType == DetachingMethod ? clazy::detachingMethods()
+                                                                                                                      : clazy::detachingMethodsWithConstCounterParts();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     if (it != methodsByType.cend()) {
+         const auto &methods = it->second;
+         if (clazy::contains(methods, clazy::name(method)))
+diff --git a/src/checks/level0/qenums.cpp b/src/checks/level0/qenums.cpp
+index 00075b5c..db8910f2 100644
+--- a/src/checks/level0/qenums.cpp
++++ b/src/checks/level0/qenums.cpp
+@@ -59,7 +59,7 @@ void QEnums::VisitMacroExpands(const Token &MacroNameTok, const SourceRange &ran
+         // We simply check if :: is present because it's very cumbersome to to check for different classes when dealing with the pre-processor
+ 
+         CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+-        string text = Lexer::getSourceText(crange, sm(), lo());
++        string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+         if (clazy::contains(text, "::"))
+             return;
+     }
+diff --git a/src/checks/level0/qt-macros.cpp b/src/checks/level0/qt-macros.cpp
+index d3a587cb..ab8e9f52 100644
+--- a/src/checks/level0/qt-macros.cpp
++++ b/src/checks/level0/qt-macros.cpp
+@@ -44,7 +44,7 @@ void QtMacros::VisitMacroDefined(const Token &MacroNameTok)
+         return;
+ 
+     IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
+-    if (ii && clazy::startsWith(ii->getName(), "Q_OS_"))
++    if (ii && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_"))
+         m_OSMacroExists = true;
+ }
+ 
+@@ -58,7 +58,7 @@ void QtMacros::checkIfDef(const Token &macroNameTok, SourceLocation Loc)
+     if (preProcessorVisitor && preProcessorVisitor->qtVersion() < 51204 && ii->getName() == "Q_OS_WINDOWS") {
+         // Q_OS_WINDOWS was introduced in 5.12.4
+         emitWarning(Loc, "Q_OS_WINDOWS was only introduced in Qt 5.12.4, use Q_OS_WIN instead");
+-    } else if (!m_OSMacroExists && clazy::startsWith(ii->getName(), "Q_OS_")) {
++    } else if (!m_OSMacroExists && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_")) {
+         emitWarning(Loc, "Include qglobal.h before testing Q_OS_ macros");
+     }
+ }
+diff --git a/src/checks/level0/unused-non-trivial-variable.cpp b/src/checks/level0/unused-non-trivial-variable.cpp
+index 4e4b8303..93815f27 100644
+--- a/src/checks/level0/unused-non-trivial-variable.cpp
++++ b/src/checks/level0/unused-non-trivial-variable.cpp
+@@ -91,7 +91,7 @@ bool UnusedNonTrivialVariable::isUninterestingType(const CXXRecordDecl *record)
+     static const vector<StringRef> blacklistedTemplates = { "QScopedPointer", "QSetValueOnDestroy", "QScopedValueRollback" };
+     StringRef className = clazy::name(record);
+     for (StringRef templateName : blacklistedTemplates) {
+-        if (clazy::startsWith(className, templateName))
++        if (clazy::startsWith(static_cast<std::string>(className), static_cast<std::string>(templateName)))
+             return true;
+     }
+ 
+diff --git a/src/checks/level1/detaching-temporary.cpp b/src/checks/level1/detaching-temporary.cpp
+index fedfc81c..60c75532 100644
+--- a/src/checks/level1/detaching-temporary.cpp
++++ b/src/checks/level1/detaching-temporary.cpp
+@@ -140,7 +140,7 @@ void DetachingTemporary::VisitStmt(clang::Stmt *stm)
+     StringRef className = clazy::name(classDecl);
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = clazy::detachingMethods();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     auto it2 = m_writeMethodsByType.find(className);
+ 
+     std::vector<StringRef> allowedFunctions;
+diff --git a/src/checks/level1/non-pod-global-static.cpp b/src/checks/level1/non-pod-global-static.cpp
+index 5879bff8..433b5c5f 100644
+--- a/src/checks/level1/non-pod-global-static.cpp
++++ b/src/checks/level1/non-pod-global-static.cpp
+@@ -74,7 +74,7 @@ void NonPodGlobalStatic::VisitStmt(clang::Stmt *stm)
+     const SourceLocation declStart = clazy::getLocStart(varDecl);
+ 
+     if (declStart.isMacroID()) {
+-        auto macroName = Lexer::getImmediateMacroName(declStart, sm(), lo());
++        auto macroName = static_cast<std::string>(Lexer::getImmediateMacroName(declStart, sm(), lo()));
+         if (clazy::startsWithAny(macroName, { "Q_IMPORT_PLUGIN", "Q_CONSTRUCTOR_FUNCTION", "Q_DESTRUCTOR_FUNCTION"})) // Don't warn on these
+             return;
+     }
+diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp
+index e1d6db4a..3af9fee2 100644
+--- a/src/checks/level1/qproperty-without-notify.cpp
++++ b/src/checks/level1/qproperty-without-notify.cpp
+@@ -69,7 +69,7 @@ void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok,
+         return;
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/level2/missing-typeinfo.cpp b/src/checks/level2/missing-typeinfo.cpp
+index 98df2cd4..03b44e06 100644
+--- a/src/checks/level2/missing-typeinfo.cpp
++++ b/src/checks/level2/missing-typeinfo.cpp
+@@ -74,7 +74,7 @@ void MissingTypeInfo::VisitDecl(clang::Decl *decl)
+         if (sm().isInSystemHeader(clazy::getLocStart(record)))
+             return;
+ 
+-        std::string typeName = clazy::name(record);
++        std::string typeName = static_cast<std::string>(clazy::name(record));
+         if (typeName == "QPair") // QPair doesn't use Q_DECLARE_TYPEINFO, but rather a explicit QTypeInfo.
+             return;
+ 
+diff --git a/src/checks/level2/old-style-connect.cpp b/src/checks/level2/old-style-connect.cpp
+index 0fe68c13..396cb703 100644
+--- a/src/checks/level2/old-style-connect.cpp
++++ b/src/checks/level2/old-style-connect.cpp
+@@ -274,7 +274,7 @@ void OldStyleConnect::VisitMacroExpands(const Token &macroNameTok, const SourceR
+         return;
+ 
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(Q_PRIVATE_SLOT\s*\((.*)\s*,\s*.*\s+(.*)\(.*)");
+     smatch match;
+@@ -293,7 +293,7 @@ string OldStyleConnect::signalOrSlotNameFromMacro(SourceLocation macroLoc)
+     CharSourceRange expansionRange = clazy::getImmediateExpansionRange(macroLoc, sm());
+     SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(\s*(SIGNAL|SLOT)\s*\(\s*(.+)\s*\(.*)");
+ 
+@@ -315,7 +315,7 @@ bool OldStyleConnect::isSignalOrSlot(SourceLocation loc, string &macroName) cons
+     if (!loc.isMacroID() || loc.isInvalid())
+         return false;
+ 
+-    macroName = Lexer::getImmediateMacroName(loc, sm(), lo());
++    macroName = static_cast<std::string>(Lexer::getImmediateMacroName(loc, sm(), lo()));
+     return macroName == "SIGNAL" || macroName == "SLOT";
+ }
+ 
+diff --git a/src/checks/level2/rule-of-three.cpp b/src/checks/level2/rule-of-three.cpp
+index 8db55d53..7583fcc5 100644
+--- a/src/checks/level2/rule-of-three.cpp
++++ b/src/checks/level2/rule-of-three.cpp
+@@ -140,7 +140,7 @@ void RuleOfThree::VisitDecl(clang::Decl *decl)
+ 
+     const string className = record->getNameAsString();
+     const string classQualifiedName = record->getQualifiedNameAsString();
+-    const string filename = sm().getFilename(recordStart);
++    const string filename = static_cast<std::string>(sm().getFilename(recordStart));
+     if (clazy::endsWith(className, "Private") && clazy::endsWithAny(filename, { ".cpp", ".cxx", "_p.h" }))
+         return; // Lots of RAII classes fall into this category. And even Private (d-pointer) classes, warning in that case would just be noise
+ 
+diff --git a/src/checks/manuallevel/ifndef-define-typo.cpp b/src/checks/manuallevel/ifndef-define-typo.cpp
+index edb6cdf4..e9c50a45 100644
+--- a/src/checks/manuallevel/ifndef-define-typo.cpp
++++ b/src/checks/manuallevel/ifndef-define-typo.cpp
+@@ -44,7 +44,7 @@ void IfndefDefineTypo::VisitMacroDefined(const Token &macroNameTok)
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -53,7 +53,7 @@ void IfndefDefineTypo::VisitDefined(const Token &macroNameTok, const SourceRange
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -66,7 +66,7 @@ void IfndefDefineTypo::VisitIfdef(SourceLocation, const Token &)
+ void IfndefDefineTypo::VisitIfndef(SourceLocation, const Token &macroNameTok)
+ {
+     if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo())
+-        m_lastIfndef = ii->getName();
++        m_lastIfndef = static_cast<std::string>(ii->getName());
+ }
+ 
+ void IfndefDefineTypo::VisitIf(SourceLocation, SourceRange, PPCallbacks::ConditionValueKind)
+diff --git a/src/checks/manuallevel/qproperty-type-mismatch.cpp b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+index f91159cb..952d9f1d 100644
+--- a/src/checks/manuallevel/qproperty-type-mismatch.cpp
++++ b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+@@ -237,7 +237,7 @@ void QPropertyTypeMismatch::VisitMacroExpands(const clang::Token &MacroNameTok,
+ 
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (!text.empty() && text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/manuallevel/qrequiredresult-candidates.cpp b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+index 912dbaa0..6375bd7b 100644
+--- a/src/checks/manuallevel/qrequiredresult-candidates.cpp
++++ b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+@@ -65,7 +65,7 @@ void QRequiredResultCandidates::VisitDecl(clang::Decl *decl)
+ 
+ 
+     if (returnClass == classDecl) {
+-        const std::string methodName = clazy::name(method);
++        const std::string methodName = static_cast<std::string>(clazy::name(method));
+         if (methodName.empty()) // fixes assert
+             return;
+ 
+diff --git a/src/checks/manuallevel/qt-keywords.cpp b/src/checks/manuallevel/qt-keywords.cpp
+index e792e95a..b60752c9 100644
+--- a/src/checks/manuallevel/qt-keywords.cpp
++++ b/src/checks/manuallevel/qt-keywords.cpp
+@@ -59,12 +59,12 @@ void QtKeywords::VisitMacroExpands(const Token &macroNameTok, const SourceRange
+     }
+ 
+     static const vector<StringRef> keywords = { "foreach", "signals", "slots", "emit" };
+-    std::string name = ii->getName();
++    std::string name = static_cast<std::string>(ii->getName());
+     if (!clazy::contains(keywords, name))
+         return;
+ 
+     // Make sure the macro is Qt's. It must be defined in Qt's headers, not 3rdparty
+-    std::string qtheader = sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc()));
++    std::string qtheader = static_cast<std::string>(sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc())));
+     if (!clazy::endsWith(qtheader, "qglobal.h") && !clazy::endsWith(qtheader, "qobjectdefs.h"))
+         return;
+ 
+diff --git a/src/checks/manuallevel/reserve-candidates.cpp b/src/checks/manuallevel/reserve-candidates.cpp
+index 389cac5a..92e4491c 100644
+--- a/src/checks/manuallevel/reserve-candidates.cpp
++++ b/src/checks/manuallevel/reserve-candidates.cpp
+@@ -78,7 +78,8 @@ static bool isCandidateMethod(CXXMethodDecl *methodDecl)
+     if (!classDecl)
+         return false;
+ 
+-    if (!clazy::equalsAny(clazy::name(methodDecl), { "append", "push_back", "push", "operator<<", "operator+=" }))
++    if (!clazy::equalsAny(static_cast<std::string>(clazy::name(methodDecl)),
++                 { "append", "push_back", "push", "operator<<", "operator+=" }))
+         return false;
+ 
+     if (!clazy::isAReserveClass(classDecl))
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
new file mode 100644
index 00000000000..28cbb60b091
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
@@ -0,0 +1,28 @@
+From 25aa102cc49def9573ffbed88155589cd60a2e8f Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Fri, 5 Jun 2020 16:52:53 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10 (clazy-standalone)
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+---
+ src/checks/manuallevel/jnisignatures.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/checks/manuallevel/jnisignatures.cpp b/src/checks/manuallevel/jnisignatures.cpp
+index 81e61d48..5d4fe203 100644
+--- a/src/checks/manuallevel/jnisignatures.cpp
++++ b/src/checks/manuallevel/jnisignatures.cpp
+@@ -103,7 +103,7 @@ void JniSignatures::checkFunctionCall(Stmt *stm)
+         return;
+     }
+ 
+-    const std::string name = clazy::name(funDecl);
++    const std::string name = static_cast<std::string>(clazy::name(funDecl));
+ 
+     if (name == "callObjectMethod" || name == "callMethod") {
+         checkArgAt(callExpr, 0, methodNameRegex, "Invalid method name");
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 4d8557be669..5af2b918e14 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.7
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"
@@ -12,3 +12,9 @@ homepage="https://cgit.kde.org/clazy.git/about/"
 distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
 checksum=754da5815f769dd6b72a040a2430525c93f294eb7769c78271603df9614f1b21
 nocross="Clang cannot be installed as makedep"
+
+post_extract() {
+	for i in ${FILESDIR}/clazy-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}

From bd6b62c52ce00724cd79bce2744a7229cda7f3fc Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 15:19:37 +0100
Subject: [PATCH 20/22] include-what-you-use: rebuild for llvm11

---
 ...de-what-you-use-001-llvm11-stringref.patch | 146 ++++++++++++++++++
 ...ude-what-you-use-002-clang-astdumper.patch |  54 +++++++
 srcpkgs/include-what-you-use/template         |   8 +-
 3 files changed, 207 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch

diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..171dca28e34
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
@@ -0,0 +1,146 @@
+From 53487d209729d5781007dc0fd6076dc585cb3727 Mon Sep 17 00:00:00 2001
+From: Andrea Bocci <andrea.bocci@cern.ch>
+Date: Fri, 28 Feb 2020 17:45:03 +0100
+Subject: [PATCH] Add explicit conversion from llvm::StringRef to std::string
+
+llvm/llvm-project@777180a makes the llvm::StringRef conversion operator
+to std::string explicit.
+These changes add a call to the str() method to perform the conversion.
+
+Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
+---
+ iwyu_driver.cc       | 2 +-
+ iwyu_globals.cc      | 4 ++--
+ iwyu_lexer_utils.cc  | 2 +-
+ iwyu_location_util.h | 2 +-
+ iwyu_output.cc       | 2 +-
+ iwyu_path_util.cc    | 6 +++---
+ iwyu_preprocessor.cc | 4 ++--
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/iwyu_driver.cc b/iwyu_driver.cc
+index bd163144..42fea35b 100644
+--- a/iwyu_driver.cc
++++ b/iwyu_driver.cc
+@@ -79,7 +79,7 @@ std::string GetExecutablePath(const char *Argv0) {
+ }
+ 
+ const char *SaveStringInSet(std::set<std::string> &SavedStrings, StringRef S) {
+-  return SavedStrings.insert(S).first->c_str();
++  return SavedStrings.insert(S.str()).first->c_str();
+ }
+ 
+ void ExpandArgsFromBuf(const char *Arg,
+diff --git a/iwyu_globals.cc b/iwyu_globals.cc
+index 0f58b4dc..26998966 100644
+--- a/iwyu_globals.cc
++++ b/iwyu_globals.cc
+@@ -293,7 +293,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+   for (auto it = header_search->system_dir_begin();
+        it != header_search->system_dir_end(); ++it) {
+     if (const DirectoryEntry* entry = it->getDir()) {
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map[path] = HeaderSearchPath::kSystemPath;
+     }
+   }
+@@ -303,7 +303,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+       // search_dir_begin()/end() includes both system and user paths.
+       // If it's a system path, it's already in the map, so everything
+       // new is a user path.  The insert only 'takes' for new entries.
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map.insert(make_pair(path, HeaderSearchPath::kUserPath));
+     }
+   }
+diff --git a/iwyu_lexer_utils.cc b/iwyu_lexer_utils.cc
+index fcea2d28..648c9da8 100644
+--- a/iwyu_lexer_utils.cc
++++ b/iwyu_lexer_utils.cc
+@@ -70,7 +70,7 @@ SourceLocation GetLocationAfter(
+ string GetIncludeNameAsWritten(
+     SourceLocation include_loc,
+     const CharacterDataGetterInterface& data_getter) {
+-  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter);
++  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter).str();
+   if (data.empty())
+     return data;
+   string::size_type endpos = string::npos;
+diff --git a/iwyu_location_util.h b/iwyu_location_util.h
+index 3892a424..6f8cf81c 100644
+--- a/iwyu_location_util.h
++++ b/iwyu_location_util.h
+@@ -89,7 +89,7 @@ bool IsInScratchSpace(clang::SourceLocation loc);
+ 
+ inline string GetFilePath(const clang::FileEntry* file) {
+   return (IsBuiltinFile(file) ? "<built-in>" :
+-          NormalizeFilePath(file->getName()));
++          NormalizeFilePath(file->getName().str()));
+ }
+ 
+ //------------------------------------------------------------
+diff --git a/iwyu_output.cc b/iwyu_output.cc
+index ca145710..8666c26c 100644
+--- a/iwyu_output.cc
++++ b/iwyu_output.cc
+@@ -168,7 +168,7 @@ string GetKindName(const clang::TagDecl* tag_decl) {
+   if (const FakeNamedDecl* fake = FakeNamedDeclIfItIsOne(named_decl)) {
+     return fake->kind_name();
+   }
+-  return tag_decl->getKindName();
++  return tag_decl->getKindName().str();
+ }
+ 
+ string GetQualifiedNameAsString(const clang::NamedDecl* named_decl) {
+diff --git a/iwyu_path_util.cc b/iwyu_path_util.cc
+index ab4fc800..9987ea47 100644
+--- a/iwyu_path_util.cc
++++ b/iwyu_path_util.cc
+@@ -134,7 +134,7 @@ string NormalizeFilePath(const string& path) {
+   std::replace(normalized.begin(), normalized.end(), '\\', '/');
+ #endif
+ 
+-  return normalized.str();
++  return normalized.str().str();
+ }
+ 
+ string NormalizeDirPath(const string& path) {
+@@ -154,14 +154,14 @@ string MakeAbsolutePath(const string& path) {
+   std::error_code error = llvm::sys::fs::make_absolute(absolute_path);
+   CHECK_(!error);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string MakeAbsolutePath(const string& base_path, const string& relative_path) {
+   llvm::SmallString<128> absolute_path(base_path);
+   llvm::sys::path::append(absolute_path, relative_path);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string GetParentPath(const string& path) {
+diff --git a/iwyu_preprocessor.cc b/iwyu_preprocessor.cc
+index 58e78595..88b93144 100644
+--- a/iwyu_preprocessor.cc
++++ b/iwyu_preprocessor.cc
+@@ -313,7 +313,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+       break;
+     }
+     const string filename = GetSourceTextUntilEndOfLine(current_loc,
+-                                                        DefaultDataGetter());
++                                                        DefaultDataGetter()).str();
+     // Use "" or <> based on where the file lives.
+     string quoted_private_include;
+     if (IsSystemIncludeFile(GetFilePath(current_loc)))
+@@ -332,7 +332,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+     }
+ 
+     string after_text = GetSourceTextUntilEndOfLine(current_loc,
+-                                                    DefaultDataGetter());
++                                                    DefaultDataGetter()).str();
+     const string::size_type close_brace_pos = after_text.find('}');
+     if (close_brace_pos == string::npos) {
+       Warn(current_loc, "@headername directive missing a closing brace");
diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
new file mode 100644
index 00000000000..663a883fa91
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
@@ -0,0 +1,54 @@
+From 30549c6931972456d1e09ff5dbeecd258a8df72b Mon Sep 17 00:00:00 2001
+From: Kim Grasman <kim.grasman@gmail.com>
+Date: Thu, 9 Jul 2020 18:47:56 +0200
+Subject: [PATCH] Implement Stmt printing with ASTDumper
+
+The Clang API changed in commit 473fbc90d1fbf17e so that Stmt::dump
+takes an ASTContext instead of a SourceManager.
+
+Rather than wire a global ASTContext, reimplement PrintableStmt and
+PrintStmt to duplicate the most trivial implementations not requiring
+ASTContext.
+
+No functional change.
+---
+ iwyu_ast_util.cc | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/iwyu_ast_util.cc b/iwyu_ast_util.cc
+index d3d4dd1f..b19a11fb 100644
+--- a/iwyu_ast_util.cc
++++ b/iwyu_ast_util.cc
+@@ -25,6 +25,7 @@
+ #include "llvm/Support/Casting.h"
+ #include "llvm/Support/raw_ostream.h"
+ #include "clang/AST/ASTContext.h"
++#include "clang/AST/ASTDumper.h"
+ #include "clang/AST/CanonicalType.h"
+ #include "clang/AST/Decl.h"
+ #include "clang/AST/DeclBase.h"
+@@ -46,6 +47,7 @@ namespace clang {
+ class FileEntry;
+ }  // namespace clang
+ 
++using clang::ASTDumper;
+ using clang::BlockPointerType;
+ using clang::CXXConstructExpr;
+ using clang::CXXConstructorDecl;
+@@ -450,12 +452,14 @@ string PrintableDecl(const Decl* decl, bool terse/*=true*/) {
+ string PrintableStmt(const Stmt* stmt) {
+   std::string buffer;
+   raw_string_ostream ostream(buffer);
+-  stmt->dump(ostream, *GlobalSourceManager());
++  ASTDumper dumper(ostream, /*ShowColors=*/false);
++  dumper.Visit(stmt);
+   return ostream.str();
+ }
+ 
+ void PrintStmt(const Stmt* stmt) {
+-  stmt->dump(*GlobalSourceManager());  // This prints to errs().
++  ASTDumper dumper(llvm::errs(), /*ShowColors=*/false);
++  dumper.Visit(stmt);
+ }
+ 
+ string PrintableType(const Type* type) {
diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 22c9d09d091..3811309bdde 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.14
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
@@ -15,6 +15,12 @@ distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.
 checksum=43184397db57660c32e3298a6b1fd5ab82e808a1f5ab0591d6745f8d256200ef
 python_version=3
 
+post_extract() {
+	for i in ${FILESDIR}/include-what-you-use-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
+
 post_install() {
 	vlicense LICENSE.TXT
 }

From 4e0480d6f411c63c9b96619bdb70bce303a0b48b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 16:17:54 +0100
Subject: [PATCH 21/22] bpftrace: update to 0.11.2

---
 ...trace-001-six-args-bpf_attach_uprobe.patch | 126 +++++++++++++++
 ...ace-002-seven-args-bpf_attach_uprobe.patch | 148 ++++++++++++++++++
 srcpkgs/bpftrace/template                     |  10 +-
 3 files changed, 282 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch

diff --git a/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..e2b1ad1351b
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
@@ -0,0 +1,126 @@
+From 52fb793c6423c19696e07cc14ad5f9182f7eca0e Mon Sep 17 00:00:00 2001
+From: Viktor Malik <viktor.malik@gmail.com>
+Date: Wed, 12 Aug 2020 09:45:29 +0200
+Subject: [PATCH] Feature-detect bpf_attach_kprobe signature
+
+The function has 6 parameters in current versions of BCC and 5
+parameters in older versions.
+
+This is detected in CMake using CHECK_CXX_SOURCE_COMPILES. For static
+compilation, we also need to retrieve and link static libbpf, libelf,
+and libz. This may cause libbpf, libelf and libz to be searched for
+twice, but it should be fine since CMake caches results.
+
+Fixes iovisor#1027.
+---
+ cmake/FindLibBcc.cmake | 24 ++++++++++++++++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 31 ++++++++++++++-----------------
+ tests/CMakeLists.txt   |  3 +++
+ 4 files changed, 44 insertions(+), 17 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 9d30b04bc..ec216271d 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -70,3 +70,27 @@ include (FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBcc "Please install the bcc library package, which is required. Depending on your distro, it may be called bpfcclib or bcclib (Ubuntu), bcc-devel (Fedora), or something else. If unavailable, install bcc from source (github.com/iovisor/bcc)."
+   LIBBCC_LIBRARIES
+   LIBBCC_INCLUDE_DIRS)
++
++# Check bpf_attach_kprobe signature
++if(${LIBBCC_FOUND})
++if(STATIC_LINKING)
++  # libbcc.a is not statically linked with libbpf.a, libelf.a, and libz.a.
++  # If we do a static bpftrace build, we must link them in.
++  find_package(LibBpf)
++  find_package(LibElf)
++  find_package(LibZ)
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_BPF_LIBRARY_STATIC} ${LIBBPF_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBZ_LIBRARIES})
++else()
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_LIBRARIES})
++endif()
++INCLUDE(CheckCXXSourceCompiles)
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_kprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++SET(CMAKE_REQUIRED_LIBRARIES)
++endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 647a23f1c..448a045fc 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -80,6 +80,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 587a11576..afad9ed18 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -754,26 +754,23 @@ void AttachedProbe::load_prog()
+   }
+ }
+ 
+-// XXX(mmarchini): bcc changed the signature of bpf_attach_kprobe, adding a new
+-// int parameter at the end. Since there's no reliable way to feature-detect
+-// this, we create a function pointer with the long signature and cast
+-// bpf_attach_kprobe to this function pointer. If we're on an older bcc
+-// version, bpf_attach_kprobe call will be augmented with an extra register
+-// being used for the last parameter, even though this register won't be used
+-// inside the function. Since the register won't be used this is kinda safe,
+-// although not ideal.
+-typedef int (*attach_probe_wrapper_signature)(int, enum bpf_probe_attach_type, const char*, const char*, uint64_t, int);
+-
+ void AttachedProbe::attach_kprobe(bool safe_mode)
+ {
+   resolve_offset_kprobe(safe_mode);
+-  int perf_event_fd = cast_signature<attach_probe_wrapper_signature>(
+-      &bpf_attach_kprobe)(progfd_,
+-                          attachtype(probe_.type),
+-                          eventname().c_str(),
+-                          probe_.attach_point.c_str(),
+-                          offset_,
+-                          0);
++#ifdef LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_,
++                                        0);
++#else
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_);
++#endif
+ 
+   if (perf_event_fd < 0) {
+     if (probe_.orig_name != probe_.name) {
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 3688b8487..84daeb2aa 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -102,6 +102,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace_test ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..2cc55c86555
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
@@ -0,0 +1,148 @@
+From c7dbab451484b96178da1a8c43330154ce4c9d7a Mon Sep 17 00:00:00 2001
+From: Daniel Xu <dxu@dxuuu.xyz>
+Date: Wed, 14 Oct 2020 17:09:46 -0700
+Subject: [PATCH] Detect 7 arg bpf_attach_uprobe() API
+
+The 7th arg allows us to specify the usdt semaphore location.
+---
+ cmake/FindLibBcc.cmake | 11 +++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 42 ++++++++++++++++++++++++++++++++++--------
+ src/main.cpp           |  6 ++++++
+ tests/CMakeLists.txt   |  3 +++
+ 5 files changed, 57 insertions(+), 8 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 4c09a8ca2..92cedab5e 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -7,6 +7,8 @@
+ #  LIBBCC_DEFINITIONS - Compiler switches required for using libbcc
+ #  LIBBCC_BPF_LIBRARY_STATIC - libbpf static library (for static compilation)
+ #  LIBBCC_LOADER_LIBRARY_STATIC - libbcc helper static library (for static compilation)
++#  LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++#  LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ #
+ # Note that the shared libbcc binary has libbpf and bcc_loader already compiled in but
+ # the static doesn't. So when creating a static build those have to be included too.
+@@ -94,6 +96,15 @@ int main(void) {
+   return 0;
+ }
+ " LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_uprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ SET(CMAKE_REQUIRED_INCLUDES)
+ endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 9162356e3..cef94d144 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -88,6 +88,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 93fbfa876..a5d8bc56d 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -698,12 +698,23 @@ void AttachedProbe::attach_uprobe(bool safe_mode)
+ {
+   resolve_offset_uprobe(safe_mode);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_,
+-                                        attachtype(probe_.type),
+-                                        eventname().c_str(),
+-                                        probe_.path.c_str(),
+-                                        offset_,
+-                                        probe_.pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+     throw std::runtime_error("Error attaching probe: " + probe_.name);
+@@ -812,8 +823,23 @@ void AttachedProbe::attach_usdt(int pid)
+ 
+   offset_ = resolve_offset(probe_.path, probe_.attach_point, probe_.loc);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_, attachtype(probe_.type),
+-      eventname().c_str(), probe_.path.c_str(), offset_, pid == 0 ? -1 : pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+   {
+diff --git a/src/main.cpp b/src/main.cpp
+index 48fcf5aa0..09f4d9677 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -162,6 +162,12 @@ static int info()
+             << "yes" << std::endl;
+ #else
+             << "no" << std::endl;
++#endif
++  std::cerr << "  bcc bpf_attach_uprobe refcount: "
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++            << "yes" << std::endl;
++#else
++            << "no" << std::endl;
+ #endif
+   std::cerr << "  libbpf: "
+ #ifdef HAVE_LIBBPF
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index ace5ff106..332eba2b5 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -116,6 +116,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index d8367fa5c03..44e6c174107 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,6 +1,6 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
-version=0.11.1
+version=0.11.2
 revision=1
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
@@ -12,7 +12,13 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="Apache-2.0"
 homepage="https://github.com/iovisor/bpftrace/"
 distfiles="https://github.com/iovisor/bpftrace/archive/v${version}.tar.gz"
-checksum=98efc9396451bc1a4f73378cec4755e07e7718cb5d698472606f5ffc2b9e48e8
+checksum=1f0fc30073547e3b285e1a373aa469bb18d3ba27f8c05f91016df0ca84f77f90
+
+post_extract() {
+	for i in ${FILESDIR}/bpftrace-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
 
 post_install() {
 	# clashes with bcc-tools

From daa773de14d7a23ac4d1002bb06f4fef5047bbec Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 19:29:15 +0100
Subject: [PATCH 22/22] beignet: rebuild for llvm11

---
 srcpkgs/beignet/patches/llvm11.patch | 945 +++++++++++++++++++++++++++
 srcpkgs/beignet/template             |   2 +-
 2 files changed, 946 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/beignet/patches/llvm11.patch

diff --git a/srcpkgs/beignet/patches/llvm11.patch b/srcpkgs/beignet/patches/llvm11.patch
new file mode 100644
index 00000000000..9f328267698
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm11.patch
@@ -0,0 +1,945 @@
+Source: Snektron
+
+There were a few changes required for LLVM 11:
+* llvm::StringRef requires .str(), implicit conversion was removed
+* llvm::CallSite was removed, but the required methods are available on llvm::CallInst
+* VectorTyID was split into FixedVectorTyID and ScalableVectorTyID, FixedVectorTyID was used
+* CallInst::getCalledValue() was renamed to CallInst::getCalledOperand()
+* Implicit conversion from MaybeAlign to Align was removed, so MaybeAlign::valueOrOne was used instead.
+
+--- backend/src/llvm/StripAttributes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/StripAttributes.cpp	2020-11-09 19:04:19.641897141 +0100
+@@ -107,9 +107,8 @@
+        BB != E; ++BB) {
+     for (BasicBlock::iterator Inst = BB->begin(), E = BB->end();
+          Inst != E; ++Inst) {
+-      CallSite Call(&*Inst);
+-      if (Call)
+-        Call.setCallingConv(CallingConv::C);
++      if (CallInst* callInst = dyn_cast<CallInst>(&*Inst))
++        callInst->setCallingConv(CallingConv::C);
+     }
+   }
+
+--- backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 17:04:09.633753428 +0100
+@@ -98,7 +98,7 @@
+         if (callFunc && callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        std::string fnName = call->getCalledValue()->stripPointerCasts()->getName();
++        std::string fnName = call->getCalledOperand()->stripPointerCasts()->getName().str();
+
+         if (!MFS.insert(fnName).second) {
+           continue;
+--- backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 19:01:49.201915008 +0100
+@@ -45,7 +45,7 @@
+       return NULL;
+
+     /* This is a fake, to check the function bitcast is for block or not */
+-    std::string fnName = Fn->getName();
++    std::string fnName = Fn->getName().str();
+     if(fnName.find("_invoke") == std::string::npos)
+       return NULL;
+
+@@ -119,18 +119,18 @@
+       ParamTys.push_back(ty);
+     }
+     FunctionType* NewFT = FunctionType::get(Fn->getReturnType(), ParamTys, false);
+-    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName());
++    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName().str());
+     SmallVector<ReturnInst*, 8> Returns;
+
+     Function::arg_iterator NewFnArgIt = NewFn->arg_begin();
+     for (Function::arg_iterator I = Fn->arg_begin(), E = Fn->arg_end(); I != E; ++I) {
+-      std::string ArgName = I->getName();
++      std::string ArgName = I->getName().str();
+       NewFnArgIt->setName(ArgName);
+       VMap[&*I] = &(*NewFnArgIt++);
+     }
+     CloneFunctionInto(NewFn, Fn, VMap, /*ModuleLevelChanges=*/true, Returns);
+
+-    Fn->setName("__d" + Fn->getName());
++    Fn->setName("__d" + Fn->getName().str());
+     mod->getFunctionList().push_back(NewFn);
+     //mod->getOrInsertFunction(NewFn->getName(), NewFn->getFunctionType(),
+     //                         NewFn->getAttributes());
+@@ -147,7 +147,7 @@
+       argTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argBaseTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argTypeQuals.push_back(llvm::MDString::get(Context, ""));
+-      argNames.push_back(llvm::MDString::get(Context, I->getName()));
++      argNames.push_back(llvm::MDString::get(Context, I->getName().str()));
+     }
+
+     //If run to here, llvm version always > 3.9, add the version check just for build.
+@@ -198,7 +198,7 @@
+            * invoke pointer to store the index in the unit's block functions index.*/
+           Function *Fn = dyn_cast<Function>(bt->getOperand(0));
+
+-          std::string fnName = Fn->getName();
++          std::string fnName = Fn->getName().str();
+           int index = -1;
+           for(size_t i=0; i<unit.blockFuncs.size(); i++) {
+             if(unit.blockFuncs[i] == fnName) {
+@@ -241,7 +241,7 @@
+             //unnamed call function, parse the use to find the define of called function
+             SmallVector<Value*, 16> args(CI->op_begin(), CI->op_end()-1);
+
+-            Value *v = CI->getCalledValue();
++            Value *v = CI->getCalledOperand();
+             BitCastInst* bt = dyn_cast<BitCastInst>(v);
+             if(bt == NULL)
+               continue;
+@@ -316,7 +316,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+
+@@ -332,7 +332,7 @@
+           } else {
+             //handle enqueue_kernel function call
+             Function *fn = CI->getCalledFunction();
+-            if (fn->getName().find("enqueue_kernel") == std::string::npos)
++            if (fn->getName().str().find("enqueue_kernel") == std::string::npos)
+               continue;
+
+             //block parameter's index, 3 or 6
+@@ -361,7 +361,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+             } else if(isa<AllocaInst>(block)) {
+--- backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 18:33:50.919114327 +0100
+@@ -376,7 +376,7 @@
+           GBE_ASSERT(index == 0);
+           return this->_newScalar(value, key, type, index, uniform);
+           break;
+-        case Type::VectorTyID:
++        case Type::FixedVectorTyID:
+         {
+           auto vectorType = cast<VectorType>(type);
+           auto elementType = vectorType->getElementType();
+@@ -743,20 +743,20 @@
+ #undef DECL_VISIT_FN
+
+     // Emit rounding instructions from gen native function
+-    void emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode);
++    void emitRoundingCallInst(CallInst &I, ir::Opcode opcode);
+     // Emit unary instructions from gen native function
+-    void emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
++    void emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
+     // Emit unary instructions from gen native function
+-    void emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode);
++    void emitAtomicInst(CallInst &I, ir::AtomicOps opcode);
+     // Emit workgroup instructions
+-    void emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+-    void emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+
+-    uint8_t appendSampler(CallSite::arg_iterator AI);
++    uint8_t appendSampler(User::op_iterator AI);
+     uint8_t getImageID(CallInst &I);
+
+     // These instructions are not supported at all
+@@ -1320,13 +1320,13 @@
+ #endif
+
+       if(typeNameNode) {
+-        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+       }
+       if(typeBaseNameNode) {
+-        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+       }
+-      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
+-      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
++      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+       bool isImage = llvmInfo.isImageType();
+       bool isPipe = llvmInfo.isPipeType();
+       if (I->getType()->isPointerTy() || isImage || isPipe) {
+@@ -1531,7 +1531,7 @@
+             EltTy = getEltType(EltTy, TypeIndex);
+         }
+
+-        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName());
++        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName().str());
+         unsigned int defOffset = cc.getOffset();
+         relocs.push_back(ir::RelocEntry(offset, defOffset + constantOffset));
+
+@@ -1546,7 +1546,7 @@
+       return;
+     }
+     if (isa<GlobalVariable>(c)) {
+-      ir::Constant cc = unit.getConstantSet().getConstant(c->getName());
++      ir::Constant cc = unit.getConstantSet().getConstant(c->getName().str());
+       unsigned int defOffset = cc.getOffset();
+
+       relocs.push_back(ir::RelocEntry(offset, defOffset));
+@@ -1609,7 +1609,7 @@
+           }
+           break;
+         }
+-      case Type::TypeID::VectorTyID:
++      case Type::TypeID::FixedVectorTyID:
+         {
+           const ConstantDataSequential *cds = dyn_cast<ConstantDataSequential>(c);
+           const VectorType *vecTy = cast<VectorType>(type);
+@@ -1936,7 +1936,7 @@
+       case Type::PointerTyID:
+         regTranslator.newScalar(value, key, 0, uniform);
+         break;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         auto vectorType = cast<VectorType>(type);
+         const uint32_t elemNum = vectorType->getNumElements();
+@@ -2395,7 +2395,7 @@
+ #endif
+         }
+         if(typeNameNode) {
+-          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+           //LLVM 3.9 image's type name include access qual, don't match OpenCL spec, erase them.
+           std::vector<std::string> filters = {"__read_only ", "__write_only "};
+           for (uint32_t i = 0; i < filters.size(); i++) {
+@@ -2406,16 +2406,16 @@
+           }
+         }
+         if(typeBaseNameNode){
+-          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+         }
+         if(accessQualNode) {
+-          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString();
++          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString().str();
+         }
+         if(typeQualNode) {
+-          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+         }
+         if(argNameNode){
+-          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString();
++          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString().str();
+         }
+
+         // function arguments are uniform values.
+@@ -3010,7 +3010,7 @@
+         } else {
+           this->newRegister(const_cast<GlobalVariable*>(&v));
+           ir::Register reg = regTranslator.getScalar(const_cast<GlobalVariable*>(&v), 0);
+-          ir::Constant &con = unit.getConstantSet().getConstant(v.getName());
++          ir::Constant &con = unit.getConstantSet().getConstant(v.getName().str());
+           if (!legacyMode) {
+             ir::Register regload = ctx.reg(getFamily(getType(ctx, v.getType())));
+             ctx.LOADI(getType(ctx, v.getType()), regload, ctx.newIntegerImmediate(con.getOffset(), getType(ctx, v.getType())));
+@@ -3212,7 +3212,7 @@
+         GBE_ASSERTM(false, "Unsupported calling convention");
+     }
+
+-    ctx.startFunction(F.getName());
++    ctx.startFunction(F.getName().str());
+
+     ir::Function &fn = ctx.getFunction();
+     this->regTranslator.clear();
+@@ -3810,9 +3810,9 @@
+
+   void GenWriter::regAllocateCallInst(CallInst &I) {
+     Value *dst = &I;
+-    Value *Callee = I.getCalledValue();
++    Value *Callee = I.getCalledOperand();
+     GBE_ASSERT(ctx.getFunction().getProfile() == ir::PROFILE_OCL);
+-    GBE_ASSERT(isa<InlineAsm>(I.getCalledValue()) == false);
++    GBE_ASSERT(isa<InlineAsm>(I.getCalledOperand()) == false);
+     if(I.getNumArgOperands()) GBE_ASSERT(I.hasStructRetAttr() == false);
+
+     // We only support a small number of intrinsics right now
+@@ -3870,7 +3870,7 @@
+       }
+     }
+     // Get the name of the called function and handle it
+-    const std::string fnName = Callee->stripPointerCasts()->getName();
++    const std::string fnName = Callee->stripPointerCasts()->getName().str();
+     auto genIntrinsicID = intrinsicMap.find(fnName);
+     switch (genIntrinsicID) {
+       case GEN_OCL_GET_GROUP_ID0:
+@@ -4166,7 +4166,7 @@
+     };
+   }
+
+-  void GenWriter::emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode) {
++  void GenWriter::emitRoundingCallInst(CallInst &I, ir::Opcode opcode) {
+     if (I.getType()->isHalfTy()) {
+       const ir::Register src = this->getRegister(I.getOperand(0));
+       const ir::Register srcFloat = ctx.reg(ir::FAMILY_DWORD);
+@@ -4177,14 +4177,14 @@
+       ctx.F32TO16(ir::TYPE_U16, ir::TYPE_FLOAT, dst, dstFloat);
+     } else {
+       GBE_ASSERT(I.getType()->isFloatTy());
+-      this->emitUnaryCallInst(I,CS,opcode);
++      this->emitUnaryCallInst(I,opcode);
+     }
+   }
+
+-  void GenWriter::emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
++  void GenWriter::emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+     GBE_ASSERT(AI != AE);
+     const ir::Register src = this->getRegister(*AI);
+@@ -4293,9 +4293,9 @@
+     this->emitAtomicInstHelper(opcode, type, dst, llvmPtr, payloadTuple);
+   }
+
+-  void GenWriter::emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitAtomicInst(CallInst &I, ir::AtomicOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+     Value *llvmPtr = *AI;
+     ir::AddressSpace addrSpace = addressSpaceLLVMToGen(llvmPtr->getType()->getPointerAddressSpace());
+@@ -4348,7 +4348,7 @@
+     }
+   }
+
+-  void GenWriter::emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
++  void GenWriter::emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
+     ir::Function &f = ctx.getFunction();
+
+     if (f.getwgBroadcastSLM() < 0 && opcode == ir::WORKGROUP_OP_BROADCAST) {
+@@ -4378,8 +4378,8 @@
+       GBE_ASSERT(f.gettidMapSLM() >= 0);
+     }
+
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4391,14 +4391,14 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 3);
+       ctx.WORKGROUP(opcode, (uint32_t)f.gettidMapSLM(), getRegister(&I), srcTuple, 3, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+         src[i] = this->getRegister(*(AI++));
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.WORKGROUP(ir::WORKGROUP_OP_BROADCAST, (uint32_t)f.getwgBroadcastSLM(), getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4423,9 +4423,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4435,7 +4435,7 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 1);
+       ctx.SUBGROUP(opcode, getRegister(&I), srcTuple, 1, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       GBE_ASSERT(argNum == 2);
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+@@ -4443,7 +4443,7 @@
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.SUBGROUP(ir::WORKGROUP_OP_BROADCAST, getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4466,9 +4466,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     Value *llvmPtr = *(AI++);
+@@ -4522,9 +4522,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     const uint8_t imageID = getImageID(I);
+@@ -4557,7 +4557,7 @@
+
+   /* append a new sampler. should be called before any reference to
+    * a sampler_t value. */
+-  uint8_t GenWriter::appendSampler(CallSite::arg_iterator AI) {
++  uint8_t GenWriter::appendSampler(User::op_iterator AI) {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+     CallInst *TC = dyn_cast<CallInst>(*AI);
+     Constant *CPV = TC ? dyn_cast<Constant>(TC->getOperand(0)) : NULL;
+@@ -4595,10 +4595,9 @@
+         const ir::Function &fn = ctx.getFunction();
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+         switch (F->getIntrinsicID()) {
+           case Intrinsic::stacksave:
+@@ -4764,17 +4763,17 @@
+             ctx.MAD(srcType, dst, src0, src1, src2);
+           }
+           break;
+-          case Intrinsic::sqrt: this->emitUnaryCallInst(I,CS,ir::OP_SQR); break;
+-          case Intrinsic::ceil: this->emitRoundingCallInst(I,CS,ir::OP_RNDU); break;
+-          case Intrinsic::trunc: this->emitRoundingCallInst(I,CS,ir::OP_RNDZ); break;
+-          case Intrinsic::rint: this->emitRoundingCallInst(I,CS,ir::OP_RNDE); break;
+-          case Intrinsic::floor: this->emitRoundingCallInst(I,CS,ir::OP_RNDD); break;
+-          case Intrinsic::sin: this->emitUnaryCallInst(I,CS,ir::OP_SIN); break;
+-          case Intrinsic::cos: this->emitUnaryCallInst(I,CS,ir::OP_COS); break;
+-          case Intrinsic::log2: this->emitUnaryCallInst(I,CS,ir::OP_LOG); break;
+-          case Intrinsic::exp2: this->emitUnaryCallInst(I,CS,ir::OP_EXP); break;
++          case Intrinsic::sqrt: this->emitUnaryCallInst(I,ir::OP_SQR); break;
++          case Intrinsic::ceil: this->emitRoundingCallInst(I,ir::OP_RNDU); break;
++          case Intrinsic::trunc: this->emitRoundingCallInst(I,ir::OP_RNDZ); break;
++          case Intrinsic::rint: this->emitRoundingCallInst(I,ir::OP_RNDE); break;
++          case Intrinsic::floor: this->emitRoundingCallInst(I,ir::OP_RNDD); break;
++          case Intrinsic::sin: this->emitUnaryCallInst(I,ir::OP_SIN); break;
++          case Intrinsic::cos: this->emitUnaryCallInst(I,ir::OP_COS); break;
++          case Intrinsic::log2: this->emitUnaryCallInst(I,ir::OP_LOG); break;
++          case Intrinsic::exp2: this->emitUnaryCallInst(I,ir::OP_EXP); break;
+           case Intrinsic::bswap:
+-            this->emitUnaryCallInst(I,CS,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
++            this->emitUnaryCallInst(I,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
+           case Intrinsic::pow:
+           {
+             const ir::Register src0 = this->getRegister(*AI); ++AI;
+@@ -4794,21 +4793,20 @@
+         }
+       } else {
+         // Get the name of the called function and handle it
+-        Value *Callee = I.getCalledValue();
+-        const std::string fnName = Callee->stripPointerCasts()->getName();
++        Value *Callee = I.getCalledOperand();
++        const std::string fnName = Callee->stripPointerCasts()->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+
+         switch (genIntrinsicID) {
+-          case GEN_OCL_FBH: this->emitUnaryCallInst(I,CS,ir::OP_FBH, ir::TYPE_U32); break;
+-          case GEN_OCL_FBL: this->emitUnaryCallInst(I,CS,ir::OP_FBL, ir::TYPE_U32); break;
+-          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,CS,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
++          case GEN_OCL_FBH: this->emitUnaryCallInst(I,ir::OP_FBH, ir::TYPE_U32); break;
++          case GEN_OCL_FBL: this->emitUnaryCallInst(I,ir::OP_FBL, ir::TYPE_U32); break;
++          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
+           case GEN_OCL_ABS:
+           {
+             const ir::Register src = this->getRegister(*AI);
+@@ -4915,8 +4913,8 @@
+             ctx.REGION(dst, src, x.getIntegerValue());
+             break;
+           }
+-          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,CS,ir::OP_RSQ); break;
+-          case GEN_OCL_RCP: this->emitUnaryCallInst(I,CS,ir::OP_RCP); break;
++          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,ir::OP_RSQ); break;
++          case GEN_OCL_RCP: this->emitUnaryCallInst(I,ir::OP_RCP); break;
+           case GEN_OCL_FORCE_SIMD8: ctx.setSimdWidth(8); break;
+           case GEN_OCL_FORCE_SIMD16: ctx.setSimdWidth(16); break;
+           case GEN_OCL_LBARRIER: ctx.SYNC(ir::syncLocalBarrier); break;
+@@ -4947,31 +4945,31 @@
+             break;
+           }
+           case GEN_OCL_ATOMIC_ADD0:
+-          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_ADD); break;
++          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,ir::ATOMIC_OP_ADD); break;
+           case GEN_OCL_ATOMIC_SUB0:
+-          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_SUB); break;
++          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,ir::ATOMIC_OP_SUB); break;
+           case GEN_OCL_ATOMIC_AND0:
+-          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_AND); break;
++          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,ir::ATOMIC_OP_AND); break;
+           case GEN_OCL_ATOMIC_OR0:
+-          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_OR); break;
++          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,ir::ATOMIC_OP_OR); break;
+           case GEN_OCL_ATOMIC_XOR0:
+-          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XOR); break;
++          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,ir::ATOMIC_OP_XOR); break;
+           case GEN_OCL_ATOMIC_XCHG0:
+-          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XCHG); break;
++          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_XCHG); break;
+           case GEN_OCL_ATOMIC_INC0:
+-          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_INC); break;
++          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,ir::ATOMIC_OP_INC); break;
+           case GEN_OCL_ATOMIC_DEC0:
+-          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_DEC); break;
++          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,ir::ATOMIC_OP_DEC); break;
+           case GEN_OCL_ATOMIC_UMIN0:
+-          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMIN); break;
++          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMIN); break;
+           case GEN_OCL_ATOMIC_UMAX0:
+-          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMAX); break;
++          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMAX); break;
+           case GEN_OCL_ATOMIC_IMIN0:
+-          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMIN); break;
++          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMIN); break;
+           case GEN_OCL_ATOMIC_IMAX0:
+-          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMAX); break;
++          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMAX); break;
+           case GEN_OCL_ATOMIC_CMPXCHG0:
+-          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_CMPXCHG); break;
++          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_CMPXCHG); break;
+           case GEN_OCL_GET_IMAGE_WIDTH:
+           case GEN_OCL_GET_IMAGE_HEIGHT:
+           case GEN_OCL_GET_IMAGE_DEPTH:
+@@ -5429,48 +5427,48 @@
+             ctx.WAIT();
+             break;
+           }
+-          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ALL); break;
+-          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ANY); break;
++          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ALL); break;
++          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ANY); break;
+           case GEN_OCL_WORK_GROUP_BROADCAST:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_BROADCAST:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_LRP:
+           {
+             const ir::Register dst  = this->getRegister(&I);
+@@ -5484,69 +5482,69 @@
+             break;
+           }
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteMemInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteMemInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteMemInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteMemInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteMemInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteMemInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteMemInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteMemInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteImageInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteImageInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteImageInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteImageInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteImageInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteImageInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteImageInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteImageInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_GET_PIPE:
+           case GEN_OCL_MAKE_RID:
+           case GEN_OCL_GET_RID:
+--- backend/src/llvm/llvm_includes.hpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_includes.hpp	2020-11-09 19:00:09.955926795 +0100
+@@ -103,7 +103,6 @@
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+ #include "llvm/IR/Mangler.h"
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #include "llvm/IR/InstVisitor.h"
+ #include "llvm/IR/IRPrintingPasses.h"
+--- backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 19:10:37.141852308 +0100
+@@ -160,7 +160,7 @@
+     Value *vecPtr = Builder.CreateBitCast(ld->getPointerOperand(),
+                                         PointerType::get(vecTy, addrSpace));
+     LoadInst *vecValue = Builder.CreateLoad(vecPtr);
+-    vecValue->setAlignment(align);
++    vecValue->setAlignment(align.valueOrOne());
+
+     for (unsigned i = 0; i < size; ++i) {
+       Value *S = Builder.CreateExtractElement(vecValue, Builder.getInt32(i));
+@@ -251,7 +251,7 @@
+       return;
+     Value *newPtr = Builder.CreateBitCast(stPointer, PointerType::get(vecTy, addrSpace));
+     StoreInst *newST = Builder.CreateStore(parent, newPtr);
+-    newST->setAlignment(align);
++    newST->setAlignment(align.valueOrOne());
+   }
+
+   // Find the safe iterator we can point to. If reorder happens, we need to
+--- backend/src/llvm/llvm_passes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_passes.cpp	2020-11-09 18:48:55.997006837 +0100
+@@ -87,14 +87,14 @@
+   }
+
+   int32_t getPadding(int32_t offset, int32_t align) {
+-    return (align - (offset % align)) % align;
++    return (align - (offset % align)) % align;
+   }
+
+   uint32_t getAlignmentByte(const ir::Unit &unit, Type* Ty)
+   {
+     switch (Ty->getTypeID()) {
+       case Type::VoidTyID: NOT_SUPPORTED;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t elemNum = VecTy->getNumElements();
+@@ -138,7 +138,7 @@
+       case Type::HalfTyID:    return 16;
+       case Type::FloatTyID:   return 32;
+       case Type::DoubleTyID:  return 64;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t numElem = VecTy->getNumElements();
+@@ -184,10 +184,12 @@
+     Type *elementType = NULL;
+     if (PointerType* ptrType = dyn_cast<PointerType>(eltTy))
+       elementType = ptrType->getElementType();
+-    else if(SequentialType * seqType = dyn_cast<SequentialType>(eltTy))
+-      elementType = seqType->getElementType();
+-    else if(CompositeType * compTy= dyn_cast<CompositeType>(eltTy))
+-      elementType = compTy->getTypeAtIndex(index);
++    else if (ArrayType * arrType = dyn_cast<ArrayType>(eltTy))
++      elementType = arrType->getElementType();
++    else if(VectorType * vecType = dyn_cast<VectorType>(eltTy))
++      elementType = vecType->getElementType();
++    else if(StructType * structType = dyn_cast<StructType>(eltTy))
++      elementType = structType->getTypeAtIndex(index);
+     GBE_ASSERT(elementType);
+     return elementType;
+   }
+--- backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 18:57:52.618943105 +0100
+@@ -323,8 +323,7 @@
+
+   bool PrintfParser::parseOnePrintfInstruction(CallInst * call)
+   {
+-    CallSite CS(call);
+-    CallSite::arg_iterator CI_FMT = CS.arg_begin();
++    User::op_iterator CI_FMT = call->arg_begin();
+     int param_num = 0;
+
+     llvm::Constant* arg0 = dyn_cast<llvm::ConstantExpr>(*CI_FMT);
+@@ -341,7 +340,7 @@
+       return false;
+     }
+
+-    std::string fmt = fmt_arg->getAsCString();
++    std::string fmt = fmt_arg->getAsCString().str();
+     if (fmt.size() == 0)
+       return false;
+
+@@ -437,8 +436,8 @@
+         if ( callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+
+         if (fnName != "__gen_ocl_printf_stub" && fnName != "__gen_ocl_puts_stub")
+           continue;
+@@ -582,7 +581,7 @@
+             if (!fmt_arg || !fmt_arg->isCString()) {
+               return false;
+             }
+-            slot.state.str = fmt_arg->getAsCString();
++            slot.state.str = fmt_arg->getAsCString().str();
+             return true;
+           }
+           case PRINTF_CONVERSION_P: {
+@@ -595,10 +594,10 @@
+
+         break;
+
+-      case Type::VectorTyID: {
+-        Type* vect_type = arg->getType();
+-        Type* elt_type = vect_type->getVectorElementType();
+-        int vec_num = vect_type->getVectorNumElements();
++      case Type::FixedVectorTyID: {
++        VectorType* vect_type = dyn_cast<VectorType>(arg->getType());
++        Type* elt_type = vect_type->getElementType();
++        int vec_num = vect_type->getNumElements();
+         bool sign = false;
+
+         if (vec_num != slot.state.vector_n) {
+--- backend/src/llvm/llvm_profiling.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_profiling.cpp	2020-11-09 18:59:50.120929150 +0100
+@@ -35,7 +35,6 @@
+ #include "llvm/IR/IRBuilder.h"
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #else
+ #include "llvm/Support/CallSite.h"
+--- backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 17:01:09.407774832 +0100
+@@ -45,8 +45,8 @@
+     bool visitCallInst(CallInst *I) {
+       if(!I)
+         return false;
+-      Value *Callee = I->getCalledValue();
+-      const std::string fnName = Callee->getName();
++      Value *Callee = I->getCalledOperand();
++      const std::string fnName = Callee->getName().str();
+       bool changed = false;
+       Type *boolTy = IntegerType::get(I->getContext(), 1);
+       Type *i32Ty = IntegerType::get(I->getContext(), 32);
+@@ -59,7 +59,7 @@
+         Value *needFixVal;
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+@@ -113,7 +113,7 @@
+         Value *needFixVal;
+  #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+--- backend/src/llvm/llvm_scalarize.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_scalarize.cpp	2020-11-09 18:51:16.888990104 +0100
+@@ -178,7 +178,7 @@
+       if(!type)
+         return type;
+       switch(type->getTypeID()) {
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       case Type::ArrayTyID:
+         return GetBasicType(type->getContainedType(0));
+       default:
+@@ -188,7 +188,7 @@
+     }
+
+     int GetComponentCount(const Type* type)  {
+-      if (type && type->getTypeID() == Type::VectorTyID)
++      if (type && type->getTypeID() == Type::FixedVectorTyID)
+         return llvm::dyn_cast<VectorType>(type)->getNumElements();
+       else
+         return 1;
+@@ -652,13 +652,12 @@
+           break;
+         }
+       } else {
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(call);
+-        CallSite::arg_iterator CI = CS.arg_begin() + 1;
++        User::op_iterator CI = call->arg_begin() + 1;
+
+         switch (genIntrinsicID) {
+           case GEN_OCL_NOT_FOUND:
+@@ -729,7 +728,7 @@
+             extractFromVector(call);
+             break;
+           case GEN_OCL_PRINTF:
+-            for (; CI != CS.arg_end(); ++CI)
++            for (; CI != call->arg_end(); ++CI)
+               if ((*CI)->getType()->isVectorTy())
+                 *CI = InsertToVector(call, *CI);
+             break;
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index a7b6dff107f..e37102ce14f 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=8
+revision=9
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (22 preceding siblings ...)
  2020-11-09 18:29 ` Snektron
@ 2020-11-09 19:00 ` Snektron
  2020-11-09 19:11 ` Snektron
                   ` (8 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 19:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 165889 bytes --]

From 52a260f4a9e961424a92fcb30c1c604b4232730c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:10 +0100
Subject: [PATCH 01/22] new package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 ...h~b2110e270 (codelite: rebuild for llvm11) |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 747 insertions(+), 13 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index 12ade7a11ac..ef2400dd2ef 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11) b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
new file mode 100644
index 00000000000..5be8de4f068
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)	
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -153,7 +153,7 @@
+
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From a0da2fbf82386b9dd4590287edcc9190ad3b621b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:23 +0100
Subject: [PATCH 02/22] llvm: update to 11.0.0

---
 srcpkgs/llvm/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 6d16e98f895e340e826ae160519639af739f92c3 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 03/22] llvm10: rebuild standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 5ce860e47ae647dee6f12a85d444bb28d06c5b17 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 04/22] llvm-libunwind: update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 855b1e78b094003cf20534ba521882813117a3c2 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 05/22] libcxxabi: update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From ecc37be2127da750ee3f8584070301903fa2b56a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 06/22] libcxx: update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From b79366c5e56f25ce3af534fc635ed2223cba2671 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 07/22] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From 55dfbbe344a6c0fe74cc1f63f1642675eede0932 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 08/22] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 72a1716259d16440ce5b23c8ccbaa6c73756d6a4 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 09/22] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 247ae03fcafbe7145fca4180e0421776be654a96 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 10/22] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From 9039929902d69eaf6637558913ae4f9402f6c7a5 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 11/22] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From 8cd2e2026b0c14c8bdbf6534ad6208a865b4444b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 12/22] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 2d21d4b84717cb66b15e782e494afba7c04ccd52 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 13/22] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From 03aaa6306dc2c3184b476937d65c37eab8d81d09 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 14/22] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From 9365a6f16f079b600b39c34114aee1209a34b670 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 15/22] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From b674578c892fd01168126d3fe3d7da5d3ad2171b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 16/22] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index 1eb6d9bafc7..35a73955e11 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20201025
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From d871410d6f50cef031983657ceaaf75846c8e208 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 17/22] ispc: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

From 80806fcc24c0b3fb9134225af392ca2b888796bf Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:24:20 +0100
Subject: [PATCH 18/22] zig: update to 0.7.0

---
 srcpkgs/zig/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index e34d6471728..727a675383a 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,16 +1,16 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.6.0
-revision=2
+version=0.7.0
+revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
-makedepends="clang llvm10 lld-devel"
+makedepends="clang llvm11 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="MIT"
 homepage="https://ziglang.org/"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204
+checksum=0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83
 nopie=yes
 nocross=yes
 

From 1f0b5174e873d207778eebe336414e7e9212b866 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:41:53 +0100
Subject: [PATCH 19/22] clazy: rebuild for llvm11

---
 .../files/clazy-001-llvm11-stringref.patch    | 343 ++++++++++++++++++
 .../files/clazy-002-llvm11-stringref.patch    |  28 ++
 srcpkgs/clazy/template                        |   8 +-
 3 files changed, 378 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch

diff --git a/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..48049fa594a
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
@@ -0,0 +1,343 @@
+From 30d6a2b64f5a05722fdc5d8e3754dbf13425cd62 Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Thu, 4 Jun 2020 17:10:21 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+Also included header file clang/Basic/FileManager.h in src/MiniDumper
+because without this header, class clang::FileEntry in incomplete class
+---
+ src/FixItExporter.cpp                                 | 5 +++--
+ src/MiniAstDumper.cpp                                 | 1 +
+ src/Utils.cpp                                         | 2 +-
+ src/checkbase.cpp                                     | 2 +-
+ src/checks/detachingbase.cpp                          | 2 +-
+ src/checks/level0/qenums.cpp                          | 2 +-
+ src/checks/level0/qt-macros.cpp                       | 4 ++--
+ src/checks/level0/unused-non-trivial-variable.cpp     | 2 +-
+ src/checks/level1/detaching-temporary.cpp             | 2 +-
+ src/checks/level1/non-pod-global-static.cpp           | 2 +-
+ src/checks/level1/qproperty-without-notify.cpp        | 2 +-
+ src/checks/level2/missing-typeinfo.cpp                | 2 +-
+ src/checks/level2/old-style-connect.cpp               | 6 +++---
+ src/checks/level2/rule-of-three.cpp                   | 2 +-
+ src/checks/manuallevel/ifndef-define-typo.cpp         | 6 +++---
+ src/checks/manuallevel/qproperty-type-mismatch.cpp    | 2 +-
+ src/checks/manuallevel/qrequiredresult-candidates.cpp | 2 +-
+ src/checks/manuallevel/qt-keywords.cpp                | 4 ++--
+ src/checks/manuallevel/reserve-candidates.cpp         | 3 ++-
+ 19 files changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/src/FixItExporter.cpp b/src/FixItExporter.cpp
+index f3af2e54..44240cf5 100644
+--- a/src/FixItExporter.cpp
++++ b/src/FixItExporter.cpp
+@@ -68,7 +68,7 @@ void FixItExporter::BeginSourceFile(const LangOptions &LangOpts, const Preproces
+ 
+     const auto id = SourceMgr.getMainFileID();
+     const auto entry = SourceMgr.getFileEntryForID(id);
+-    getTuDiag().MainSourceFile = entry->getName();
++    getTuDiag().MainSourceFile = static_cast<std::string>(entry->getName());
+ }
+ 
+ bool FixItExporter::IncludeInDiagnosticCounts() const
+@@ -89,7 +89,8 @@ tooling::Diagnostic FixItExporter::ConvertDiagnostic(const Diagnostic &Info)
+     // TODO: This returns an empty string: DiagEngine->getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
+     // HACK: capture it at the end of the message: Message text [check-name]
+ 
+-    std::string checkName = DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
++    std::string checkName =
++        static_cast<std::string>(DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID()));
+     std::string messageText;
+ 
+     if (checkName.empty()) {
+diff --git a/src/MiniAstDumper.cpp b/src/MiniAstDumper.cpp
+index 47661749..6124e6e8 100644
+--- a/src/MiniAstDumper.cpp
++++ b/src/MiniAstDumper.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <clang/Frontend/CompilerInstance.h>
+ #include <clang/Frontend/FrontendPluginRegistry.h>
++#include <clang/Basic/FileManager.h>
+ 
+ using namespace clang;
+ using namespace std;
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index 001ced98..b0812fe3 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -878,7 +878,7 @@ string Utils::filenameForLoc(SourceLocation loc, const clang::SourceManager &sm)
+     if (loc.isMacroID())
+         loc = sm.getExpansionLoc(loc);
+ 
+-    const string filename = sm.getFilename(loc);
++    const string filename = static_cast<std::string>(sm.getFilename(loc));
+     auto splitted = clazy::splitString(filename, '/');
+     if (splitted.empty())
+         return {};
+diff --git a/src/checkbase.cpp b/src/checkbase.cpp
+index 8b40e19d..22a426cf 100644
+--- a/src/checkbase.cpp
++++ b/src/checkbase.cpp
+@@ -188,7 +188,7 @@ bool CheckBase::shouldIgnoreFile(SourceLocation loc) const
+     if (!loc.isValid())
+         return true;
+ 
+-    string filename = sm().getFilename(loc);
++    string filename = static_cast<std::string>(sm().getFilename(loc));
+ 
+     return clazy::any_of(m_filesToIgnore, [filename](const std::string &ignored) {
+         return clazy::contains(filename, ignored);
+diff --git a/src/checks/detachingbase.cpp b/src/checks/detachingbase.cpp
+index 70311f42..1b094ee7 100644
+--- a/src/checks/detachingbase.cpp
++++ b/src/checks/detachingbase.cpp
+@@ -57,7 +57,7 @@ bool DetachingBase::isDetachingMethod(CXXMethodDecl *method, DetachingMethodType
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = detachingMethodType == DetachingMethod ? clazy::detachingMethods()
+                                                                                                                      : clazy::detachingMethodsWithConstCounterParts();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     if (it != methodsByType.cend()) {
+         const auto &methods = it->second;
+         if (clazy::contains(methods, clazy::name(method)))
+diff --git a/src/checks/level0/qenums.cpp b/src/checks/level0/qenums.cpp
+index 00075b5c..db8910f2 100644
+--- a/src/checks/level0/qenums.cpp
++++ b/src/checks/level0/qenums.cpp
+@@ -59,7 +59,7 @@ void QEnums::VisitMacroExpands(const Token &MacroNameTok, const SourceRange &ran
+         // We simply check if :: is present because it's very cumbersome to to check for different classes when dealing with the pre-processor
+ 
+         CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+-        string text = Lexer::getSourceText(crange, sm(), lo());
++        string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+         if (clazy::contains(text, "::"))
+             return;
+     }
+diff --git a/src/checks/level0/qt-macros.cpp b/src/checks/level0/qt-macros.cpp
+index d3a587cb..ab8e9f52 100644
+--- a/src/checks/level0/qt-macros.cpp
++++ b/src/checks/level0/qt-macros.cpp
+@@ -44,7 +44,7 @@ void QtMacros::VisitMacroDefined(const Token &MacroNameTok)
+         return;
+ 
+     IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
+-    if (ii && clazy::startsWith(ii->getName(), "Q_OS_"))
++    if (ii && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_"))
+         m_OSMacroExists = true;
+ }
+ 
+@@ -58,7 +58,7 @@ void QtMacros::checkIfDef(const Token &macroNameTok, SourceLocation Loc)
+     if (preProcessorVisitor && preProcessorVisitor->qtVersion() < 51204 && ii->getName() == "Q_OS_WINDOWS") {
+         // Q_OS_WINDOWS was introduced in 5.12.4
+         emitWarning(Loc, "Q_OS_WINDOWS was only introduced in Qt 5.12.4, use Q_OS_WIN instead");
+-    } else if (!m_OSMacroExists && clazy::startsWith(ii->getName(), "Q_OS_")) {
++    } else if (!m_OSMacroExists && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_")) {
+         emitWarning(Loc, "Include qglobal.h before testing Q_OS_ macros");
+     }
+ }
+diff --git a/src/checks/level0/unused-non-trivial-variable.cpp b/src/checks/level0/unused-non-trivial-variable.cpp
+index 4e4b8303..93815f27 100644
+--- a/src/checks/level0/unused-non-trivial-variable.cpp
++++ b/src/checks/level0/unused-non-trivial-variable.cpp
+@@ -91,7 +91,7 @@ bool UnusedNonTrivialVariable::isUninterestingType(const CXXRecordDecl *record)
+     static const vector<StringRef> blacklistedTemplates = { "QScopedPointer", "QSetValueOnDestroy", "QScopedValueRollback" };
+     StringRef className = clazy::name(record);
+     for (StringRef templateName : blacklistedTemplates) {
+-        if (clazy::startsWith(className, templateName))
++        if (clazy::startsWith(static_cast<std::string>(className), static_cast<std::string>(templateName)))
+             return true;
+     }
+ 
+diff --git a/src/checks/level1/detaching-temporary.cpp b/src/checks/level1/detaching-temporary.cpp
+index fedfc81c..60c75532 100644
+--- a/src/checks/level1/detaching-temporary.cpp
++++ b/src/checks/level1/detaching-temporary.cpp
+@@ -140,7 +140,7 @@ void DetachingTemporary::VisitStmt(clang::Stmt *stm)
+     StringRef className = clazy::name(classDecl);
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = clazy::detachingMethods();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     auto it2 = m_writeMethodsByType.find(className);
+ 
+     std::vector<StringRef> allowedFunctions;
+diff --git a/src/checks/level1/non-pod-global-static.cpp b/src/checks/level1/non-pod-global-static.cpp
+index 5879bff8..433b5c5f 100644
+--- a/src/checks/level1/non-pod-global-static.cpp
++++ b/src/checks/level1/non-pod-global-static.cpp
+@@ -74,7 +74,7 @@ void NonPodGlobalStatic::VisitStmt(clang::Stmt *stm)
+     const SourceLocation declStart = clazy::getLocStart(varDecl);
+ 
+     if (declStart.isMacroID()) {
+-        auto macroName = Lexer::getImmediateMacroName(declStart, sm(), lo());
++        auto macroName = static_cast<std::string>(Lexer::getImmediateMacroName(declStart, sm(), lo()));
+         if (clazy::startsWithAny(macroName, { "Q_IMPORT_PLUGIN", "Q_CONSTRUCTOR_FUNCTION", "Q_DESTRUCTOR_FUNCTION"})) // Don't warn on these
+             return;
+     }
+diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp
+index e1d6db4a..3af9fee2 100644
+--- a/src/checks/level1/qproperty-without-notify.cpp
++++ b/src/checks/level1/qproperty-without-notify.cpp
+@@ -69,7 +69,7 @@ void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok,
+         return;
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/level2/missing-typeinfo.cpp b/src/checks/level2/missing-typeinfo.cpp
+index 98df2cd4..03b44e06 100644
+--- a/src/checks/level2/missing-typeinfo.cpp
++++ b/src/checks/level2/missing-typeinfo.cpp
+@@ -74,7 +74,7 @@ void MissingTypeInfo::VisitDecl(clang::Decl *decl)
+         if (sm().isInSystemHeader(clazy::getLocStart(record)))
+             return;
+ 
+-        std::string typeName = clazy::name(record);
++        std::string typeName = static_cast<std::string>(clazy::name(record));
+         if (typeName == "QPair") // QPair doesn't use Q_DECLARE_TYPEINFO, but rather a explicit QTypeInfo.
+             return;
+ 
+diff --git a/src/checks/level2/old-style-connect.cpp b/src/checks/level2/old-style-connect.cpp
+index 0fe68c13..396cb703 100644
+--- a/src/checks/level2/old-style-connect.cpp
++++ b/src/checks/level2/old-style-connect.cpp
+@@ -274,7 +274,7 @@ void OldStyleConnect::VisitMacroExpands(const Token &macroNameTok, const SourceR
+         return;
+ 
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(Q_PRIVATE_SLOT\s*\((.*)\s*,\s*.*\s+(.*)\(.*)");
+     smatch match;
+@@ -293,7 +293,7 @@ string OldStyleConnect::signalOrSlotNameFromMacro(SourceLocation macroLoc)
+     CharSourceRange expansionRange = clazy::getImmediateExpansionRange(macroLoc, sm());
+     SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(\s*(SIGNAL|SLOT)\s*\(\s*(.+)\s*\(.*)");
+ 
+@@ -315,7 +315,7 @@ bool OldStyleConnect::isSignalOrSlot(SourceLocation loc, string &macroName) cons
+     if (!loc.isMacroID() || loc.isInvalid())
+         return false;
+ 
+-    macroName = Lexer::getImmediateMacroName(loc, sm(), lo());
++    macroName = static_cast<std::string>(Lexer::getImmediateMacroName(loc, sm(), lo()));
+     return macroName == "SIGNAL" || macroName == "SLOT";
+ }
+ 
+diff --git a/src/checks/level2/rule-of-three.cpp b/src/checks/level2/rule-of-three.cpp
+index 8db55d53..7583fcc5 100644
+--- a/src/checks/level2/rule-of-three.cpp
++++ b/src/checks/level2/rule-of-three.cpp
+@@ -140,7 +140,7 @@ void RuleOfThree::VisitDecl(clang::Decl *decl)
+ 
+     const string className = record->getNameAsString();
+     const string classQualifiedName = record->getQualifiedNameAsString();
+-    const string filename = sm().getFilename(recordStart);
++    const string filename = static_cast<std::string>(sm().getFilename(recordStart));
+     if (clazy::endsWith(className, "Private") && clazy::endsWithAny(filename, { ".cpp", ".cxx", "_p.h" }))
+         return; // Lots of RAII classes fall into this category. And even Private (d-pointer) classes, warning in that case would just be noise
+ 
+diff --git a/src/checks/manuallevel/ifndef-define-typo.cpp b/src/checks/manuallevel/ifndef-define-typo.cpp
+index edb6cdf4..e9c50a45 100644
+--- a/src/checks/manuallevel/ifndef-define-typo.cpp
++++ b/src/checks/manuallevel/ifndef-define-typo.cpp
+@@ -44,7 +44,7 @@ void IfndefDefineTypo::VisitMacroDefined(const Token &macroNameTok)
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -53,7 +53,7 @@ void IfndefDefineTypo::VisitDefined(const Token &macroNameTok, const SourceRange
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -66,7 +66,7 @@ void IfndefDefineTypo::VisitIfdef(SourceLocation, const Token &)
+ void IfndefDefineTypo::VisitIfndef(SourceLocation, const Token &macroNameTok)
+ {
+     if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo())
+-        m_lastIfndef = ii->getName();
++        m_lastIfndef = static_cast<std::string>(ii->getName());
+ }
+ 
+ void IfndefDefineTypo::VisitIf(SourceLocation, SourceRange, PPCallbacks::ConditionValueKind)
+diff --git a/src/checks/manuallevel/qproperty-type-mismatch.cpp b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+index f91159cb..952d9f1d 100644
+--- a/src/checks/manuallevel/qproperty-type-mismatch.cpp
++++ b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+@@ -237,7 +237,7 @@ void QPropertyTypeMismatch::VisitMacroExpands(const clang::Token &MacroNameTok,
+ 
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (!text.empty() && text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/manuallevel/qrequiredresult-candidates.cpp b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+index 912dbaa0..6375bd7b 100644
+--- a/src/checks/manuallevel/qrequiredresult-candidates.cpp
++++ b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+@@ -65,7 +65,7 @@ void QRequiredResultCandidates::VisitDecl(clang::Decl *decl)
+ 
+ 
+     if (returnClass == classDecl) {
+-        const std::string methodName = clazy::name(method);
++        const std::string methodName = static_cast<std::string>(clazy::name(method));
+         if (methodName.empty()) // fixes assert
+             return;
+ 
+diff --git a/src/checks/manuallevel/qt-keywords.cpp b/src/checks/manuallevel/qt-keywords.cpp
+index e792e95a..b60752c9 100644
+--- a/src/checks/manuallevel/qt-keywords.cpp
++++ b/src/checks/manuallevel/qt-keywords.cpp
+@@ -59,12 +59,12 @@ void QtKeywords::VisitMacroExpands(const Token &macroNameTok, const SourceRange
+     }
+ 
+     static const vector<StringRef> keywords = { "foreach", "signals", "slots", "emit" };
+-    std::string name = ii->getName();
++    std::string name = static_cast<std::string>(ii->getName());
+     if (!clazy::contains(keywords, name))
+         return;
+ 
+     // Make sure the macro is Qt's. It must be defined in Qt's headers, not 3rdparty
+-    std::string qtheader = sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc()));
++    std::string qtheader = static_cast<std::string>(sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc())));
+     if (!clazy::endsWith(qtheader, "qglobal.h") && !clazy::endsWith(qtheader, "qobjectdefs.h"))
+         return;
+ 
+diff --git a/src/checks/manuallevel/reserve-candidates.cpp b/src/checks/manuallevel/reserve-candidates.cpp
+index 389cac5a..92e4491c 100644
+--- a/src/checks/manuallevel/reserve-candidates.cpp
++++ b/src/checks/manuallevel/reserve-candidates.cpp
+@@ -78,7 +78,8 @@ static bool isCandidateMethod(CXXMethodDecl *methodDecl)
+     if (!classDecl)
+         return false;
+ 
+-    if (!clazy::equalsAny(clazy::name(methodDecl), { "append", "push_back", "push", "operator<<", "operator+=" }))
++    if (!clazy::equalsAny(static_cast<std::string>(clazy::name(methodDecl)),
++                 { "append", "push_back", "push", "operator<<", "operator+=" }))
+         return false;
+ 
+     if (!clazy::isAReserveClass(classDecl))
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
new file mode 100644
index 00000000000..28cbb60b091
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
@@ -0,0 +1,28 @@
+From 25aa102cc49def9573ffbed88155589cd60a2e8f Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Fri, 5 Jun 2020 16:52:53 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10 (clazy-standalone)
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+---
+ src/checks/manuallevel/jnisignatures.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/checks/manuallevel/jnisignatures.cpp b/src/checks/manuallevel/jnisignatures.cpp
+index 81e61d48..5d4fe203 100644
+--- a/src/checks/manuallevel/jnisignatures.cpp
++++ b/src/checks/manuallevel/jnisignatures.cpp
+@@ -103,7 +103,7 @@ void JniSignatures::checkFunctionCall(Stmt *stm)
+         return;
+     }
+ 
+-    const std::string name = clazy::name(funDecl);
++    const std::string name = static_cast<std::string>(clazy::name(funDecl));
+ 
+     if (name == "callObjectMethod" || name == "callMethod") {
+         checkArgAt(callExpr, 0, methodNameRegex, "Invalid method name");
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 4d8557be669..5af2b918e14 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.7
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"
@@ -12,3 +12,9 @@ homepage="https://cgit.kde.org/clazy.git/about/"
 distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
 checksum=754da5815f769dd6b72a040a2430525c93f294eb7769c78271603df9614f1b21
 nocross="Clang cannot be installed as makedep"
+
+post_extract() {
+	for i in ${FILESDIR}/clazy-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}

From 707f6512d487fee86031eb7e189df1eccc27e175 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 15:19:37 +0100
Subject: [PATCH 20/22] include-what-you-use: rebuild for llvm11

---
 ...de-what-you-use-001-llvm11-stringref.patch | 146 ++++++++++++++++++
 ...ude-what-you-use-002-clang-astdumper.patch |  54 +++++++
 srcpkgs/include-what-you-use/template         |   8 +-
 3 files changed, 207 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch

diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..171dca28e34
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
@@ -0,0 +1,146 @@
+From 53487d209729d5781007dc0fd6076dc585cb3727 Mon Sep 17 00:00:00 2001
+From: Andrea Bocci <andrea.bocci@cern.ch>
+Date: Fri, 28 Feb 2020 17:45:03 +0100
+Subject: [PATCH] Add explicit conversion from llvm::StringRef to std::string
+
+llvm/llvm-project@777180a makes the llvm::StringRef conversion operator
+to std::string explicit.
+These changes add a call to the str() method to perform the conversion.
+
+Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
+---
+ iwyu_driver.cc       | 2 +-
+ iwyu_globals.cc      | 4 ++--
+ iwyu_lexer_utils.cc  | 2 +-
+ iwyu_location_util.h | 2 +-
+ iwyu_output.cc       | 2 +-
+ iwyu_path_util.cc    | 6 +++---
+ iwyu_preprocessor.cc | 4 ++--
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/iwyu_driver.cc b/iwyu_driver.cc
+index bd163144..42fea35b 100644
+--- a/iwyu_driver.cc
++++ b/iwyu_driver.cc
+@@ -79,7 +79,7 @@ std::string GetExecutablePath(const char *Argv0) {
+ }
+ 
+ const char *SaveStringInSet(std::set<std::string> &SavedStrings, StringRef S) {
+-  return SavedStrings.insert(S).first->c_str();
++  return SavedStrings.insert(S.str()).first->c_str();
+ }
+ 
+ void ExpandArgsFromBuf(const char *Arg,
+diff --git a/iwyu_globals.cc b/iwyu_globals.cc
+index 0f58b4dc..26998966 100644
+--- a/iwyu_globals.cc
++++ b/iwyu_globals.cc
+@@ -293,7 +293,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+   for (auto it = header_search->system_dir_begin();
+        it != header_search->system_dir_end(); ++it) {
+     if (const DirectoryEntry* entry = it->getDir()) {
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map[path] = HeaderSearchPath::kSystemPath;
+     }
+   }
+@@ -303,7 +303,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+       // search_dir_begin()/end() includes both system and user paths.
+       // If it's a system path, it's already in the map, so everything
+       // new is a user path.  The insert only 'takes' for new entries.
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map.insert(make_pair(path, HeaderSearchPath::kUserPath));
+     }
+   }
+diff --git a/iwyu_lexer_utils.cc b/iwyu_lexer_utils.cc
+index fcea2d28..648c9da8 100644
+--- a/iwyu_lexer_utils.cc
++++ b/iwyu_lexer_utils.cc
+@@ -70,7 +70,7 @@ SourceLocation GetLocationAfter(
+ string GetIncludeNameAsWritten(
+     SourceLocation include_loc,
+     const CharacterDataGetterInterface& data_getter) {
+-  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter);
++  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter).str();
+   if (data.empty())
+     return data;
+   string::size_type endpos = string::npos;
+diff --git a/iwyu_location_util.h b/iwyu_location_util.h
+index 3892a424..6f8cf81c 100644
+--- a/iwyu_location_util.h
++++ b/iwyu_location_util.h
+@@ -89,7 +89,7 @@ bool IsInScratchSpace(clang::SourceLocation loc);
+ 
+ inline string GetFilePath(const clang::FileEntry* file) {
+   return (IsBuiltinFile(file) ? "<built-in>" :
+-          NormalizeFilePath(file->getName()));
++          NormalizeFilePath(file->getName().str()));
+ }
+ 
+ //------------------------------------------------------------
+diff --git a/iwyu_output.cc b/iwyu_output.cc
+index ca145710..8666c26c 100644
+--- a/iwyu_output.cc
++++ b/iwyu_output.cc
+@@ -168,7 +168,7 @@ string GetKindName(const clang::TagDecl* tag_decl) {
+   if (const FakeNamedDecl* fake = FakeNamedDeclIfItIsOne(named_decl)) {
+     return fake->kind_name();
+   }
+-  return tag_decl->getKindName();
++  return tag_decl->getKindName().str();
+ }
+ 
+ string GetQualifiedNameAsString(const clang::NamedDecl* named_decl) {
+diff --git a/iwyu_path_util.cc b/iwyu_path_util.cc
+index ab4fc800..9987ea47 100644
+--- a/iwyu_path_util.cc
++++ b/iwyu_path_util.cc
+@@ -134,7 +134,7 @@ string NormalizeFilePath(const string& path) {
+   std::replace(normalized.begin(), normalized.end(), '\\', '/');
+ #endif
+ 
+-  return normalized.str();
++  return normalized.str().str();
+ }
+ 
+ string NormalizeDirPath(const string& path) {
+@@ -154,14 +154,14 @@ string MakeAbsolutePath(const string& path) {
+   std::error_code error = llvm::sys::fs::make_absolute(absolute_path);
+   CHECK_(!error);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string MakeAbsolutePath(const string& base_path, const string& relative_path) {
+   llvm::SmallString<128> absolute_path(base_path);
+   llvm::sys::path::append(absolute_path, relative_path);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string GetParentPath(const string& path) {
+diff --git a/iwyu_preprocessor.cc b/iwyu_preprocessor.cc
+index 58e78595..88b93144 100644
+--- a/iwyu_preprocessor.cc
++++ b/iwyu_preprocessor.cc
+@@ -313,7 +313,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+       break;
+     }
+     const string filename = GetSourceTextUntilEndOfLine(current_loc,
+-                                                        DefaultDataGetter());
++                                                        DefaultDataGetter()).str();
+     // Use "" or <> based on where the file lives.
+     string quoted_private_include;
+     if (IsSystemIncludeFile(GetFilePath(current_loc)))
+@@ -332,7 +332,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+     }
+ 
+     string after_text = GetSourceTextUntilEndOfLine(current_loc,
+-                                                    DefaultDataGetter());
++                                                    DefaultDataGetter()).str();
+     const string::size_type close_brace_pos = after_text.find('}');
+     if (close_brace_pos == string::npos) {
+       Warn(current_loc, "@headername directive missing a closing brace");
diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
new file mode 100644
index 00000000000..663a883fa91
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
@@ -0,0 +1,54 @@
+From 30549c6931972456d1e09ff5dbeecd258a8df72b Mon Sep 17 00:00:00 2001
+From: Kim Grasman <kim.grasman@gmail.com>
+Date: Thu, 9 Jul 2020 18:47:56 +0200
+Subject: [PATCH] Implement Stmt printing with ASTDumper
+
+The Clang API changed in commit 473fbc90d1fbf17e so that Stmt::dump
+takes an ASTContext instead of a SourceManager.
+
+Rather than wire a global ASTContext, reimplement PrintableStmt and
+PrintStmt to duplicate the most trivial implementations not requiring
+ASTContext.
+
+No functional change.
+---
+ iwyu_ast_util.cc | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/iwyu_ast_util.cc b/iwyu_ast_util.cc
+index d3d4dd1f..b19a11fb 100644
+--- a/iwyu_ast_util.cc
++++ b/iwyu_ast_util.cc
+@@ -25,6 +25,7 @@
+ #include "llvm/Support/Casting.h"
+ #include "llvm/Support/raw_ostream.h"
+ #include "clang/AST/ASTContext.h"
++#include "clang/AST/ASTDumper.h"
+ #include "clang/AST/CanonicalType.h"
+ #include "clang/AST/Decl.h"
+ #include "clang/AST/DeclBase.h"
+@@ -46,6 +47,7 @@ namespace clang {
+ class FileEntry;
+ }  // namespace clang
+ 
++using clang::ASTDumper;
+ using clang::BlockPointerType;
+ using clang::CXXConstructExpr;
+ using clang::CXXConstructorDecl;
+@@ -450,12 +452,14 @@ string PrintableDecl(const Decl* decl, bool terse/*=true*/) {
+ string PrintableStmt(const Stmt* stmt) {
+   std::string buffer;
+   raw_string_ostream ostream(buffer);
+-  stmt->dump(ostream, *GlobalSourceManager());
++  ASTDumper dumper(ostream, /*ShowColors=*/false);
++  dumper.Visit(stmt);
+   return ostream.str();
+ }
+ 
+ void PrintStmt(const Stmt* stmt) {
+-  stmt->dump(*GlobalSourceManager());  // This prints to errs().
++  ASTDumper dumper(llvm::errs(), /*ShowColors=*/false);
++  dumper.Visit(stmt);
+ }
+ 
+ string PrintableType(const Type* type) {
diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 22c9d09d091..3811309bdde 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.14
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
@@ -15,6 +15,12 @@ distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.
 checksum=43184397db57660c32e3298a6b1fd5ab82e808a1f5ab0591d6745f8d256200ef
 python_version=3
 
+post_extract() {
+	for i in ${FILESDIR}/include-what-you-use-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
+
 post_install() {
 	vlicense LICENSE.TXT
 }

From f932b52169f6a182b2e3645017e70bff9e00016c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 16:17:54 +0100
Subject: [PATCH 21/22] bpftrace: update to 0.11.2

---
 ...trace-001-six-args-bpf_attach_uprobe.patch | 126 +++++++++++++++
 ...ace-002-seven-args-bpf_attach_uprobe.patch | 148 ++++++++++++++++++
 srcpkgs/bpftrace/template                     |  10 +-
 3 files changed, 282 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch

diff --git a/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..e2b1ad1351b
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
@@ -0,0 +1,126 @@
+From 52fb793c6423c19696e07cc14ad5f9182f7eca0e Mon Sep 17 00:00:00 2001
+From: Viktor Malik <viktor.malik@gmail.com>
+Date: Wed, 12 Aug 2020 09:45:29 +0200
+Subject: [PATCH] Feature-detect bpf_attach_kprobe signature
+
+The function has 6 parameters in current versions of BCC and 5
+parameters in older versions.
+
+This is detected in CMake using CHECK_CXX_SOURCE_COMPILES. For static
+compilation, we also need to retrieve and link static libbpf, libelf,
+and libz. This may cause libbpf, libelf and libz to be searched for
+twice, but it should be fine since CMake caches results.
+
+Fixes iovisor#1027.
+---
+ cmake/FindLibBcc.cmake | 24 ++++++++++++++++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 31 ++++++++++++++-----------------
+ tests/CMakeLists.txt   |  3 +++
+ 4 files changed, 44 insertions(+), 17 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 9d30b04bc..ec216271d 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -70,3 +70,27 @@ include (FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBcc "Please install the bcc library package, which is required. Depending on your distro, it may be called bpfcclib or bcclib (Ubuntu), bcc-devel (Fedora), or something else. If unavailable, install bcc from source (github.com/iovisor/bcc)."
+   LIBBCC_LIBRARIES
+   LIBBCC_INCLUDE_DIRS)
++
++# Check bpf_attach_kprobe signature
++if(${LIBBCC_FOUND})
++if(STATIC_LINKING)
++  # libbcc.a is not statically linked with libbpf.a, libelf.a, and libz.a.
++  # If we do a static bpftrace build, we must link them in.
++  find_package(LibBpf)
++  find_package(LibElf)
++  find_package(LibZ)
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_BPF_LIBRARY_STATIC} ${LIBBPF_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBZ_LIBRARIES})
++else()
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_LIBRARIES})
++endif()
++INCLUDE(CheckCXXSourceCompiles)
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_kprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++SET(CMAKE_REQUIRED_LIBRARIES)
++endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 647a23f1c..448a045fc 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -80,6 +80,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 587a11576..afad9ed18 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -754,26 +754,23 @@ void AttachedProbe::load_prog()
+   }
+ }
+ 
+-// XXX(mmarchini): bcc changed the signature of bpf_attach_kprobe, adding a new
+-// int parameter at the end. Since there's no reliable way to feature-detect
+-// this, we create a function pointer with the long signature and cast
+-// bpf_attach_kprobe to this function pointer. If we're on an older bcc
+-// version, bpf_attach_kprobe call will be augmented with an extra register
+-// being used for the last parameter, even though this register won't be used
+-// inside the function. Since the register won't be used this is kinda safe,
+-// although not ideal.
+-typedef int (*attach_probe_wrapper_signature)(int, enum bpf_probe_attach_type, const char*, const char*, uint64_t, int);
+-
+ void AttachedProbe::attach_kprobe(bool safe_mode)
+ {
+   resolve_offset_kprobe(safe_mode);
+-  int perf_event_fd = cast_signature<attach_probe_wrapper_signature>(
+-      &bpf_attach_kprobe)(progfd_,
+-                          attachtype(probe_.type),
+-                          eventname().c_str(),
+-                          probe_.attach_point.c_str(),
+-                          offset_,
+-                          0);
++#ifdef LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_,
++                                        0);
++#else
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_);
++#endif
+ 
+   if (perf_event_fd < 0) {
+     if (probe_.orig_name != probe_.name) {
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 3688b8487..84daeb2aa 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -102,6 +102,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace_test ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..2cc55c86555
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
@@ -0,0 +1,148 @@
+From c7dbab451484b96178da1a8c43330154ce4c9d7a Mon Sep 17 00:00:00 2001
+From: Daniel Xu <dxu@dxuuu.xyz>
+Date: Wed, 14 Oct 2020 17:09:46 -0700
+Subject: [PATCH] Detect 7 arg bpf_attach_uprobe() API
+
+The 7th arg allows us to specify the usdt semaphore location.
+---
+ cmake/FindLibBcc.cmake | 11 +++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 42 ++++++++++++++++++++++++++++++++++--------
+ src/main.cpp           |  6 ++++++
+ tests/CMakeLists.txt   |  3 +++
+ 5 files changed, 57 insertions(+), 8 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 4c09a8ca2..92cedab5e 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -7,6 +7,8 @@
+ #  LIBBCC_DEFINITIONS - Compiler switches required for using libbcc
+ #  LIBBCC_BPF_LIBRARY_STATIC - libbpf static library (for static compilation)
+ #  LIBBCC_LOADER_LIBRARY_STATIC - libbcc helper static library (for static compilation)
++#  LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++#  LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ #
+ # Note that the shared libbcc binary has libbpf and bcc_loader already compiled in but
+ # the static doesn't. So when creating a static build those have to be included too.
+@@ -94,6 +96,15 @@ int main(void) {
+   return 0;
+ }
+ " LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_uprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ SET(CMAKE_REQUIRED_INCLUDES)
+ endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 9162356e3..cef94d144 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -88,6 +88,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 93fbfa876..a5d8bc56d 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -698,12 +698,23 @@ void AttachedProbe::attach_uprobe(bool safe_mode)
+ {
+   resolve_offset_uprobe(safe_mode);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_,
+-                                        attachtype(probe_.type),
+-                                        eventname().c_str(),
+-                                        probe_.path.c_str(),
+-                                        offset_,
+-                                        probe_.pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+     throw std::runtime_error("Error attaching probe: " + probe_.name);
+@@ -812,8 +823,23 @@ void AttachedProbe::attach_usdt(int pid)
+ 
+   offset_ = resolve_offset(probe_.path, probe_.attach_point, probe_.loc);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_, attachtype(probe_.type),
+-      eventname().c_str(), probe_.path.c_str(), offset_, pid == 0 ? -1 : pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+   {
+diff --git a/src/main.cpp b/src/main.cpp
+index 48fcf5aa0..09f4d9677 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -162,6 +162,12 @@ static int info()
+             << "yes" << std::endl;
+ #else
+             << "no" << std::endl;
++#endif
++  std::cerr << "  bcc bpf_attach_uprobe refcount: "
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++            << "yes" << std::endl;
++#else
++            << "no" << std::endl;
+ #endif
+   std::cerr << "  libbpf: "
+ #ifdef HAVE_LIBBPF
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index ace5ff106..332eba2b5 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -116,6 +116,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index d8367fa5c03..44e6c174107 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,6 +1,6 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
-version=0.11.1
+version=0.11.2
 revision=1
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
@@ -12,7 +12,13 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="Apache-2.0"
 homepage="https://github.com/iovisor/bpftrace/"
 distfiles="https://github.com/iovisor/bpftrace/archive/v${version}.tar.gz"
-checksum=98efc9396451bc1a4f73378cec4755e07e7718cb5d698472606f5ffc2b9e48e8
+checksum=1f0fc30073547e3b285e1a373aa469bb18d3ba27f8c05f91016df0ca84f77f90
+
+post_extract() {
+	for i in ${FILESDIR}/bpftrace-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
 
 post_install() {
 	# clashes with bcc-tools

From 33c9bc04ccf3d1af0e58db890dc8d6c9443d0324 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 19:29:15 +0100
Subject: [PATCH 22/22] beignet: rebuild for llvm11

---
 srcpkgs/beignet/patches/llvm11.patch | 945 +++++++++++++++++++++++++++
 srcpkgs/beignet/template             |   2 +-
 2 files changed, 946 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/beignet/patches/llvm11.patch

diff --git a/srcpkgs/beignet/patches/llvm11.patch b/srcpkgs/beignet/patches/llvm11.patch
new file mode 100644
index 00000000000..9f328267698
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm11.patch
@@ -0,0 +1,945 @@
+Source: Snektron
+
+There were a few changes required for LLVM 11:
+* llvm::StringRef requires .str(), implicit conversion was removed
+* llvm::CallSite was removed, but the required methods are available on llvm::CallInst
+* VectorTyID was split into FixedVectorTyID and ScalableVectorTyID, FixedVectorTyID was used
+* CallInst::getCalledValue() was renamed to CallInst::getCalledOperand()
+* Implicit conversion from MaybeAlign to Align was removed, so MaybeAlign::valueOrOne was used instead.
+
+--- backend/src/llvm/StripAttributes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/StripAttributes.cpp	2020-11-09 19:04:19.641897141 +0100
+@@ -107,9 +107,8 @@
+        BB != E; ++BB) {
+     for (BasicBlock::iterator Inst = BB->begin(), E = BB->end();
+          Inst != E; ++Inst) {
+-      CallSite Call(&*Inst);
+-      if (Call)
+-        Call.setCallingConv(CallingConv::C);
++      if (CallInst* callInst = dyn_cast<CallInst>(&*Inst))
++        callInst->setCallingConv(CallingConv::C);
+     }
+   }
+
+--- backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 17:04:09.633753428 +0100
+@@ -98,7 +98,7 @@
+         if (callFunc && callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        std::string fnName = call->getCalledValue()->stripPointerCasts()->getName();
++        std::string fnName = call->getCalledOperand()->stripPointerCasts()->getName().str();
+
+         if (!MFS.insert(fnName).second) {
+           continue;
+--- backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 19:01:49.201915008 +0100
+@@ -45,7 +45,7 @@
+       return NULL;
+
+     /* This is a fake, to check the function bitcast is for block or not */
+-    std::string fnName = Fn->getName();
++    std::string fnName = Fn->getName().str();
+     if(fnName.find("_invoke") == std::string::npos)
+       return NULL;
+
+@@ -119,18 +119,18 @@
+       ParamTys.push_back(ty);
+     }
+     FunctionType* NewFT = FunctionType::get(Fn->getReturnType(), ParamTys, false);
+-    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName());
++    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName().str());
+     SmallVector<ReturnInst*, 8> Returns;
+
+     Function::arg_iterator NewFnArgIt = NewFn->arg_begin();
+     for (Function::arg_iterator I = Fn->arg_begin(), E = Fn->arg_end(); I != E; ++I) {
+-      std::string ArgName = I->getName();
++      std::string ArgName = I->getName().str();
+       NewFnArgIt->setName(ArgName);
+       VMap[&*I] = &(*NewFnArgIt++);
+     }
+     CloneFunctionInto(NewFn, Fn, VMap, /*ModuleLevelChanges=*/true, Returns);
+
+-    Fn->setName("__d" + Fn->getName());
++    Fn->setName("__d" + Fn->getName().str());
+     mod->getFunctionList().push_back(NewFn);
+     //mod->getOrInsertFunction(NewFn->getName(), NewFn->getFunctionType(),
+     //                         NewFn->getAttributes());
+@@ -147,7 +147,7 @@
+       argTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argBaseTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argTypeQuals.push_back(llvm::MDString::get(Context, ""));
+-      argNames.push_back(llvm::MDString::get(Context, I->getName()));
++      argNames.push_back(llvm::MDString::get(Context, I->getName().str()));
+     }
+
+     //If run to here, llvm version always > 3.9, add the version check just for build.
+@@ -198,7 +198,7 @@
+            * invoke pointer to store the index in the unit's block functions index.*/
+           Function *Fn = dyn_cast<Function>(bt->getOperand(0));
+
+-          std::string fnName = Fn->getName();
++          std::string fnName = Fn->getName().str();
+           int index = -1;
+           for(size_t i=0; i<unit.blockFuncs.size(); i++) {
+             if(unit.blockFuncs[i] == fnName) {
+@@ -241,7 +241,7 @@
+             //unnamed call function, parse the use to find the define of called function
+             SmallVector<Value*, 16> args(CI->op_begin(), CI->op_end()-1);
+
+-            Value *v = CI->getCalledValue();
++            Value *v = CI->getCalledOperand();
+             BitCastInst* bt = dyn_cast<BitCastInst>(v);
+             if(bt == NULL)
+               continue;
+@@ -316,7 +316,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+
+@@ -332,7 +332,7 @@
+           } else {
+             //handle enqueue_kernel function call
+             Function *fn = CI->getCalledFunction();
+-            if (fn->getName().find("enqueue_kernel") == std::string::npos)
++            if (fn->getName().str().find("enqueue_kernel") == std::string::npos)
+               continue;
+
+             //block parameter's index, 3 or 6
+@@ -361,7 +361,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+             } else if(isa<AllocaInst>(block)) {
+--- backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 18:33:50.919114327 +0100
+@@ -376,7 +376,7 @@
+           GBE_ASSERT(index == 0);
+           return this->_newScalar(value, key, type, index, uniform);
+           break;
+-        case Type::VectorTyID:
++        case Type::FixedVectorTyID:
+         {
+           auto vectorType = cast<VectorType>(type);
+           auto elementType = vectorType->getElementType();
+@@ -743,20 +743,20 @@
+ #undef DECL_VISIT_FN
+
+     // Emit rounding instructions from gen native function
+-    void emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode);
++    void emitRoundingCallInst(CallInst &I, ir::Opcode opcode);
+     // Emit unary instructions from gen native function
+-    void emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
++    void emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
+     // Emit unary instructions from gen native function
+-    void emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode);
++    void emitAtomicInst(CallInst &I, ir::AtomicOps opcode);
+     // Emit workgroup instructions
+-    void emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+-    void emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+
+-    uint8_t appendSampler(CallSite::arg_iterator AI);
++    uint8_t appendSampler(User::op_iterator AI);
+     uint8_t getImageID(CallInst &I);
+
+     // These instructions are not supported at all
+@@ -1320,13 +1320,13 @@
+ #endif
+
+       if(typeNameNode) {
+-        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+       }
+       if(typeBaseNameNode) {
+-        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+       }
+-      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
+-      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
++      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+       bool isImage = llvmInfo.isImageType();
+       bool isPipe = llvmInfo.isPipeType();
+       if (I->getType()->isPointerTy() || isImage || isPipe) {
+@@ -1531,7 +1531,7 @@
+             EltTy = getEltType(EltTy, TypeIndex);
+         }
+
+-        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName());
++        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName().str());
+         unsigned int defOffset = cc.getOffset();
+         relocs.push_back(ir::RelocEntry(offset, defOffset + constantOffset));
+
+@@ -1546,7 +1546,7 @@
+       return;
+     }
+     if (isa<GlobalVariable>(c)) {
+-      ir::Constant cc = unit.getConstantSet().getConstant(c->getName());
++      ir::Constant cc = unit.getConstantSet().getConstant(c->getName().str());
+       unsigned int defOffset = cc.getOffset();
+
+       relocs.push_back(ir::RelocEntry(offset, defOffset));
+@@ -1609,7 +1609,7 @@
+           }
+           break;
+         }
+-      case Type::TypeID::VectorTyID:
++      case Type::TypeID::FixedVectorTyID:
+         {
+           const ConstantDataSequential *cds = dyn_cast<ConstantDataSequential>(c);
+           const VectorType *vecTy = cast<VectorType>(type);
+@@ -1936,7 +1936,7 @@
+       case Type::PointerTyID:
+         regTranslator.newScalar(value, key, 0, uniform);
+         break;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         auto vectorType = cast<VectorType>(type);
+         const uint32_t elemNum = vectorType->getNumElements();
+@@ -2395,7 +2395,7 @@
+ #endif
+         }
+         if(typeNameNode) {
+-          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+           //LLVM 3.9 image's type name include access qual, don't match OpenCL spec, erase them.
+           std::vector<std::string> filters = {"__read_only ", "__write_only "};
+           for (uint32_t i = 0; i < filters.size(); i++) {
+@@ -2406,16 +2406,16 @@
+           }
+         }
+         if(typeBaseNameNode){
+-          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+         }
+         if(accessQualNode) {
+-          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString();
++          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString().str();
+         }
+         if(typeQualNode) {
+-          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+         }
+         if(argNameNode){
+-          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString();
++          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString().str();
+         }
+
+         // function arguments are uniform values.
+@@ -3010,7 +3010,7 @@
+         } else {
+           this->newRegister(const_cast<GlobalVariable*>(&v));
+           ir::Register reg = regTranslator.getScalar(const_cast<GlobalVariable*>(&v), 0);
+-          ir::Constant &con = unit.getConstantSet().getConstant(v.getName());
++          ir::Constant &con = unit.getConstantSet().getConstant(v.getName().str());
+           if (!legacyMode) {
+             ir::Register regload = ctx.reg(getFamily(getType(ctx, v.getType())));
+             ctx.LOADI(getType(ctx, v.getType()), regload, ctx.newIntegerImmediate(con.getOffset(), getType(ctx, v.getType())));
+@@ -3212,7 +3212,7 @@
+         GBE_ASSERTM(false, "Unsupported calling convention");
+     }
+
+-    ctx.startFunction(F.getName());
++    ctx.startFunction(F.getName().str());
+
+     ir::Function &fn = ctx.getFunction();
+     this->regTranslator.clear();
+@@ -3810,9 +3810,9 @@
+
+   void GenWriter::regAllocateCallInst(CallInst &I) {
+     Value *dst = &I;
+-    Value *Callee = I.getCalledValue();
++    Value *Callee = I.getCalledOperand();
+     GBE_ASSERT(ctx.getFunction().getProfile() == ir::PROFILE_OCL);
+-    GBE_ASSERT(isa<InlineAsm>(I.getCalledValue()) == false);
++    GBE_ASSERT(isa<InlineAsm>(I.getCalledOperand()) == false);
+     if(I.getNumArgOperands()) GBE_ASSERT(I.hasStructRetAttr() == false);
+
+     // We only support a small number of intrinsics right now
+@@ -3870,7 +3870,7 @@
+       }
+     }
+     // Get the name of the called function and handle it
+-    const std::string fnName = Callee->stripPointerCasts()->getName();
++    const std::string fnName = Callee->stripPointerCasts()->getName().str();
+     auto genIntrinsicID = intrinsicMap.find(fnName);
+     switch (genIntrinsicID) {
+       case GEN_OCL_GET_GROUP_ID0:
+@@ -4166,7 +4166,7 @@
+     };
+   }
+
+-  void GenWriter::emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode) {
++  void GenWriter::emitRoundingCallInst(CallInst &I, ir::Opcode opcode) {
+     if (I.getType()->isHalfTy()) {
+       const ir::Register src = this->getRegister(I.getOperand(0));
+       const ir::Register srcFloat = ctx.reg(ir::FAMILY_DWORD);
+@@ -4177,14 +4177,14 @@
+       ctx.F32TO16(ir::TYPE_U16, ir::TYPE_FLOAT, dst, dstFloat);
+     } else {
+       GBE_ASSERT(I.getType()->isFloatTy());
+-      this->emitUnaryCallInst(I,CS,opcode);
++      this->emitUnaryCallInst(I,opcode);
+     }
+   }
+
+-  void GenWriter::emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
++  void GenWriter::emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+     GBE_ASSERT(AI != AE);
+     const ir::Register src = this->getRegister(*AI);
+@@ -4293,9 +4293,9 @@
+     this->emitAtomicInstHelper(opcode, type, dst, llvmPtr, payloadTuple);
+   }
+
+-  void GenWriter::emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitAtomicInst(CallInst &I, ir::AtomicOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+     Value *llvmPtr = *AI;
+     ir::AddressSpace addrSpace = addressSpaceLLVMToGen(llvmPtr->getType()->getPointerAddressSpace());
+@@ -4348,7 +4348,7 @@
+     }
+   }
+
+-  void GenWriter::emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
++  void GenWriter::emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
+     ir::Function &f = ctx.getFunction();
+
+     if (f.getwgBroadcastSLM() < 0 && opcode == ir::WORKGROUP_OP_BROADCAST) {
+@@ -4378,8 +4378,8 @@
+       GBE_ASSERT(f.gettidMapSLM() >= 0);
+     }
+
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4391,14 +4391,14 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 3);
+       ctx.WORKGROUP(opcode, (uint32_t)f.gettidMapSLM(), getRegister(&I), srcTuple, 3, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+         src[i] = this->getRegister(*(AI++));
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.WORKGROUP(ir::WORKGROUP_OP_BROADCAST, (uint32_t)f.getwgBroadcastSLM(), getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4423,9 +4423,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4435,7 +4435,7 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 1);
+       ctx.SUBGROUP(opcode, getRegister(&I), srcTuple, 1, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       GBE_ASSERT(argNum == 2);
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+@@ -4443,7 +4443,7 @@
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.SUBGROUP(ir::WORKGROUP_OP_BROADCAST, getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4466,9 +4466,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     Value *llvmPtr = *(AI++);
+@@ -4522,9 +4522,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     const uint8_t imageID = getImageID(I);
+@@ -4557,7 +4557,7 @@
+
+   /* append a new sampler. should be called before any reference to
+    * a sampler_t value. */
+-  uint8_t GenWriter::appendSampler(CallSite::arg_iterator AI) {
++  uint8_t GenWriter::appendSampler(User::op_iterator AI) {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+     CallInst *TC = dyn_cast<CallInst>(*AI);
+     Constant *CPV = TC ? dyn_cast<Constant>(TC->getOperand(0)) : NULL;
+@@ -4595,10 +4595,9 @@
+         const ir::Function &fn = ctx.getFunction();
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+         switch (F->getIntrinsicID()) {
+           case Intrinsic::stacksave:
+@@ -4764,17 +4763,17 @@
+             ctx.MAD(srcType, dst, src0, src1, src2);
+           }
+           break;
+-          case Intrinsic::sqrt: this->emitUnaryCallInst(I,CS,ir::OP_SQR); break;
+-          case Intrinsic::ceil: this->emitRoundingCallInst(I,CS,ir::OP_RNDU); break;
+-          case Intrinsic::trunc: this->emitRoundingCallInst(I,CS,ir::OP_RNDZ); break;
+-          case Intrinsic::rint: this->emitRoundingCallInst(I,CS,ir::OP_RNDE); break;
+-          case Intrinsic::floor: this->emitRoundingCallInst(I,CS,ir::OP_RNDD); break;
+-          case Intrinsic::sin: this->emitUnaryCallInst(I,CS,ir::OP_SIN); break;
+-          case Intrinsic::cos: this->emitUnaryCallInst(I,CS,ir::OP_COS); break;
+-          case Intrinsic::log2: this->emitUnaryCallInst(I,CS,ir::OP_LOG); break;
+-          case Intrinsic::exp2: this->emitUnaryCallInst(I,CS,ir::OP_EXP); break;
++          case Intrinsic::sqrt: this->emitUnaryCallInst(I,ir::OP_SQR); break;
++          case Intrinsic::ceil: this->emitRoundingCallInst(I,ir::OP_RNDU); break;
++          case Intrinsic::trunc: this->emitRoundingCallInst(I,ir::OP_RNDZ); break;
++          case Intrinsic::rint: this->emitRoundingCallInst(I,ir::OP_RNDE); break;
++          case Intrinsic::floor: this->emitRoundingCallInst(I,ir::OP_RNDD); break;
++          case Intrinsic::sin: this->emitUnaryCallInst(I,ir::OP_SIN); break;
++          case Intrinsic::cos: this->emitUnaryCallInst(I,ir::OP_COS); break;
++          case Intrinsic::log2: this->emitUnaryCallInst(I,ir::OP_LOG); break;
++          case Intrinsic::exp2: this->emitUnaryCallInst(I,ir::OP_EXP); break;
+           case Intrinsic::bswap:
+-            this->emitUnaryCallInst(I,CS,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
++            this->emitUnaryCallInst(I,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
+           case Intrinsic::pow:
+           {
+             const ir::Register src0 = this->getRegister(*AI); ++AI;
+@@ -4794,21 +4793,20 @@
+         }
+       } else {
+         // Get the name of the called function and handle it
+-        Value *Callee = I.getCalledValue();
+-        const std::string fnName = Callee->stripPointerCasts()->getName();
++        Value *Callee = I.getCalledOperand();
++        const std::string fnName = Callee->stripPointerCasts()->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+
+         switch (genIntrinsicID) {
+-          case GEN_OCL_FBH: this->emitUnaryCallInst(I,CS,ir::OP_FBH, ir::TYPE_U32); break;
+-          case GEN_OCL_FBL: this->emitUnaryCallInst(I,CS,ir::OP_FBL, ir::TYPE_U32); break;
+-          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,CS,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
++          case GEN_OCL_FBH: this->emitUnaryCallInst(I,ir::OP_FBH, ir::TYPE_U32); break;
++          case GEN_OCL_FBL: this->emitUnaryCallInst(I,ir::OP_FBL, ir::TYPE_U32); break;
++          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
+           case GEN_OCL_ABS:
+           {
+             const ir::Register src = this->getRegister(*AI);
+@@ -4915,8 +4913,8 @@
+             ctx.REGION(dst, src, x.getIntegerValue());
+             break;
+           }
+-          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,CS,ir::OP_RSQ); break;
+-          case GEN_OCL_RCP: this->emitUnaryCallInst(I,CS,ir::OP_RCP); break;
++          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,ir::OP_RSQ); break;
++          case GEN_OCL_RCP: this->emitUnaryCallInst(I,ir::OP_RCP); break;
+           case GEN_OCL_FORCE_SIMD8: ctx.setSimdWidth(8); break;
+           case GEN_OCL_FORCE_SIMD16: ctx.setSimdWidth(16); break;
+           case GEN_OCL_LBARRIER: ctx.SYNC(ir::syncLocalBarrier); break;
+@@ -4947,31 +4945,31 @@
+             break;
+           }
+           case GEN_OCL_ATOMIC_ADD0:
+-          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_ADD); break;
++          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,ir::ATOMIC_OP_ADD); break;
+           case GEN_OCL_ATOMIC_SUB0:
+-          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_SUB); break;
++          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,ir::ATOMIC_OP_SUB); break;
+           case GEN_OCL_ATOMIC_AND0:
+-          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_AND); break;
++          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,ir::ATOMIC_OP_AND); break;
+           case GEN_OCL_ATOMIC_OR0:
+-          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_OR); break;
++          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,ir::ATOMIC_OP_OR); break;
+           case GEN_OCL_ATOMIC_XOR0:
+-          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XOR); break;
++          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,ir::ATOMIC_OP_XOR); break;
+           case GEN_OCL_ATOMIC_XCHG0:
+-          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XCHG); break;
++          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_XCHG); break;
+           case GEN_OCL_ATOMIC_INC0:
+-          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_INC); break;
++          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,ir::ATOMIC_OP_INC); break;
+           case GEN_OCL_ATOMIC_DEC0:
+-          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_DEC); break;
++          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,ir::ATOMIC_OP_DEC); break;
+           case GEN_OCL_ATOMIC_UMIN0:
+-          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMIN); break;
++          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMIN); break;
+           case GEN_OCL_ATOMIC_UMAX0:
+-          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMAX); break;
++          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMAX); break;
+           case GEN_OCL_ATOMIC_IMIN0:
+-          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMIN); break;
++          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMIN); break;
+           case GEN_OCL_ATOMIC_IMAX0:
+-          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMAX); break;
++          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMAX); break;
+           case GEN_OCL_ATOMIC_CMPXCHG0:
+-          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_CMPXCHG); break;
++          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_CMPXCHG); break;
+           case GEN_OCL_GET_IMAGE_WIDTH:
+           case GEN_OCL_GET_IMAGE_HEIGHT:
+           case GEN_OCL_GET_IMAGE_DEPTH:
+@@ -5429,48 +5427,48 @@
+             ctx.WAIT();
+             break;
+           }
+-          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ALL); break;
+-          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ANY); break;
++          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ALL); break;
++          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ANY); break;
+           case GEN_OCL_WORK_GROUP_BROADCAST:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_BROADCAST:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_LRP:
+           {
+             const ir::Register dst  = this->getRegister(&I);
+@@ -5484,69 +5482,69 @@
+             break;
+           }
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteMemInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteMemInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteMemInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteMemInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteMemInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteMemInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteMemInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteMemInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteImageInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteImageInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteImageInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteImageInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteImageInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteImageInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteImageInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteImageInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_GET_PIPE:
+           case GEN_OCL_MAKE_RID:
+           case GEN_OCL_GET_RID:
+--- backend/src/llvm/llvm_includes.hpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_includes.hpp	2020-11-09 19:00:09.955926795 +0100
+@@ -103,7 +103,6 @@
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+ #include "llvm/IR/Mangler.h"
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #include "llvm/IR/InstVisitor.h"
+ #include "llvm/IR/IRPrintingPasses.h"
+--- backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 19:10:37.141852308 +0100
+@@ -160,7 +160,7 @@
+     Value *vecPtr = Builder.CreateBitCast(ld->getPointerOperand(),
+                                         PointerType::get(vecTy, addrSpace));
+     LoadInst *vecValue = Builder.CreateLoad(vecPtr);
+-    vecValue->setAlignment(align);
++    vecValue->setAlignment(align.valueOrOne());
+
+     for (unsigned i = 0; i < size; ++i) {
+       Value *S = Builder.CreateExtractElement(vecValue, Builder.getInt32(i));
+@@ -251,7 +251,7 @@
+       return;
+     Value *newPtr = Builder.CreateBitCast(stPointer, PointerType::get(vecTy, addrSpace));
+     StoreInst *newST = Builder.CreateStore(parent, newPtr);
+-    newST->setAlignment(align);
++    newST->setAlignment(align.valueOrOne());
+   }
+
+   // Find the safe iterator we can point to. If reorder happens, we need to
+--- backend/src/llvm/llvm_passes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_passes.cpp	2020-11-09 18:48:55.997006837 +0100
+@@ -87,14 +87,14 @@
+   }
+
+   int32_t getPadding(int32_t offset, int32_t align) {
+-    return (align - (offset % align)) % align;
++    return (align - (offset % align)) % align;
+   }
+
+   uint32_t getAlignmentByte(const ir::Unit &unit, Type* Ty)
+   {
+     switch (Ty->getTypeID()) {
+       case Type::VoidTyID: NOT_SUPPORTED;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t elemNum = VecTy->getNumElements();
+@@ -138,7 +138,7 @@
+       case Type::HalfTyID:    return 16;
+       case Type::FloatTyID:   return 32;
+       case Type::DoubleTyID:  return 64;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t numElem = VecTy->getNumElements();
+@@ -184,10 +184,12 @@
+     Type *elementType = NULL;
+     if (PointerType* ptrType = dyn_cast<PointerType>(eltTy))
+       elementType = ptrType->getElementType();
+-    else if(SequentialType * seqType = dyn_cast<SequentialType>(eltTy))
+-      elementType = seqType->getElementType();
+-    else if(CompositeType * compTy= dyn_cast<CompositeType>(eltTy))
+-      elementType = compTy->getTypeAtIndex(index);
++    else if (ArrayType * arrType = dyn_cast<ArrayType>(eltTy))
++      elementType = arrType->getElementType();
++    else if(VectorType * vecType = dyn_cast<VectorType>(eltTy))
++      elementType = vecType->getElementType();
++    else if(StructType * structType = dyn_cast<StructType>(eltTy))
++      elementType = structType->getTypeAtIndex(index);
+     GBE_ASSERT(elementType);
+     return elementType;
+   }
+--- backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 18:57:52.618943105 +0100
+@@ -323,8 +323,7 @@
+
+   bool PrintfParser::parseOnePrintfInstruction(CallInst * call)
+   {
+-    CallSite CS(call);
+-    CallSite::arg_iterator CI_FMT = CS.arg_begin();
++    User::op_iterator CI_FMT = call->arg_begin();
+     int param_num = 0;
+
+     llvm::Constant* arg0 = dyn_cast<llvm::ConstantExpr>(*CI_FMT);
+@@ -341,7 +340,7 @@
+       return false;
+     }
+
+-    std::string fmt = fmt_arg->getAsCString();
++    std::string fmt = fmt_arg->getAsCString().str();
+     if (fmt.size() == 0)
+       return false;
+
+@@ -437,8 +436,8 @@
+         if ( callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+
+         if (fnName != "__gen_ocl_printf_stub" && fnName != "__gen_ocl_puts_stub")
+           continue;
+@@ -582,7 +581,7 @@
+             if (!fmt_arg || !fmt_arg->isCString()) {
+               return false;
+             }
+-            slot.state.str = fmt_arg->getAsCString();
++            slot.state.str = fmt_arg->getAsCString().str();
+             return true;
+           }
+           case PRINTF_CONVERSION_P: {
+@@ -595,10 +594,10 @@
+
+         break;
+
+-      case Type::VectorTyID: {
+-        Type* vect_type = arg->getType();
+-        Type* elt_type = vect_type->getVectorElementType();
+-        int vec_num = vect_type->getVectorNumElements();
++      case Type::FixedVectorTyID: {
++        VectorType* vect_type = dyn_cast<VectorType>(arg->getType());
++        Type* elt_type = vect_type->getElementType();
++        int vec_num = vect_type->getNumElements();
+         bool sign = false;
+
+         if (vec_num != slot.state.vector_n) {
+--- backend/src/llvm/llvm_profiling.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_profiling.cpp	2020-11-09 18:59:50.120929150 +0100
+@@ -35,7 +35,6 @@
+ #include "llvm/IR/IRBuilder.h"
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #else
+ #include "llvm/Support/CallSite.h"
+--- backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 17:01:09.407774832 +0100
+@@ -45,8 +45,8 @@
+     bool visitCallInst(CallInst *I) {
+       if(!I)
+         return false;
+-      Value *Callee = I->getCalledValue();
+-      const std::string fnName = Callee->getName();
++      Value *Callee = I->getCalledOperand();
++      const std::string fnName = Callee->getName().str();
+       bool changed = false;
+       Type *boolTy = IntegerType::get(I->getContext(), 1);
+       Type *i32Ty = IntegerType::get(I->getContext(), 32);
+@@ -59,7 +59,7 @@
+         Value *needFixVal;
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+@@ -113,7 +113,7 @@
+         Value *needFixVal;
+  #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+--- backend/src/llvm/llvm_scalarize.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_scalarize.cpp	2020-11-09 18:51:16.888990104 +0100
+@@ -178,7 +178,7 @@
+       if(!type)
+         return type;
+       switch(type->getTypeID()) {
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       case Type::ArrayTyID:
+         return GetBasicType(type->getContainedType(0));
+       default:
+@@ -188,7 +188,7 @@
+     }
+
+     int GetComponentCount(const Type* type)  {
+-      if (type && type->getTypeID() == Type::VectorTyID)
++      if (type && type->getTypeID() == Type::FixedVectorTyID)
+         return llvm::dyn_cast<VectorType>(type)->getNumElements();
+       else
+         return 1;
+@@ -652,13 +652,12 @@
+           break;
+         }
+       } else {
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(call);
+-        CallSite::arg_iterator CI = CS.arg_begin() + 1;
++        User::op_iterator CI = call->arg_begin() + 1;
+
+         switch (genIntrinsicID) {
+           case GEN_OCL_NOT_FOUND:
+@@ -729,7 +728,7 @@
+             extractFromVector(call);
+             break;
+           case GEN_OCL_PRINTF:
+-            for (; CI != CS.arg_end(); ++CI)
++            for (; CI != call->arg_end(); ++CI)
+               if ((*CI)->getType()->isVectorTy())
+                 *CI = InsertToVector(call, *CI);
+             break;
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index a7b6dff107f..e37102ce14f 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=8
+revision=9
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (23 preceding siblings ...)
  2020-11-09 19:00 ` Snektron
@ 2020-11-09 19:11 ` Snektron
  2020-11-09 19:52 ` Snektron
                   ` (7 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 19:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 167212 bytes --]

From 52a260f4a9e961424a92fcb30c1c604b4232730c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:10 +0100
Subject: [PATCH 01/24] new package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 ...h~b2110e270 (codelite: rebuild for llvm11) |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 747 insertions(+), 13 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index 12ade7a11ac..ef2400dd2ef 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11) b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
new file mode 100644
index 00000000000..5be8de4f068
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)	
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -153,7 +153,7 @@
+
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From a0da2fbf82386b9dd4590287edcc9190ad3b621b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:23 +0100
Subject: [PATCH 02/24] llvm: update to 11.0.0

---
 srcpkgs/llvm/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 6d16e98f895e340e826ae160519639af739f92c3 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 03/24] llvm10: rebuild standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 5ce860e47ae647dee6f12a85d444bb28d06c5b17 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 04/24] llvm-libunwind: update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 855b1e78b094003cf20534ba521882813117a3c2 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 05/24] libcxxabi: update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From ecc37be2127da750ee3f8584070301903fa2b56a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 06/24] libcxx: update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From b79366c5e56f25ce3af534fc635ed2223cba2671 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 07/24] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From 55dfbbe344a6c0fe74cc1f63f1642675eede0932 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 08/24] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 72a1716259d16440ce5b23c8ccbaa6c73756d6a4 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 09/24] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 247ae03fcafbe7145fca4180e0421776be654a96 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 10/24] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From 9039929902d69eaf6637558913ae4f9402f6c7a5 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 11/24] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From 8cd2e2026b0c14c8bdbf6534ad6208a865b4444b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 12/24] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 2d21d4b84717cb66b15e782e494afba7c04ccd52 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 13/24] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From 03aaa6306dc2c3184b476937d65c37eab8d81d09 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 14/24] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From 9365a6f16f079b600b39c34114aee1209a34b670 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 15/24] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From b674578c892fd01168126d3fe3d7da5d3ad2171b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 16/24] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index 1eb6d9bafc7..35a73955e11 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20201025
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From d871410d6f50cef031983657ceaaf75846c8e208 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 17/24] ispc: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

From 80806fcc24c0b3fb9134225af392ca2b888796bf Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:24:20 +0100
Subject: [PATCH 18/24] zig: update to 0.7.0

---
 srcpkgs/zig/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index e34d6471728..727a675383a 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,16 +1,16 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.6.0
-revision=2
+version=0.7.0
+revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
-makedepends="clang llvm10 lld-devel"
+makedepends="clang llvm11 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="MIT"
 homepage="https://ziglang.org/"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204
+checksum=0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83
 nopie=yes
 nocross=yes
 

From 1f0b5174e873d207778eebe336414e7e9212b866 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:41:53 +0100
Subject: [PATCH 19/24] clazy: rebuild for llvm11

---
 .../files/clazy-001-llvm11-stringref.patch    | 343 ++++++++++++++++++
 .../files/clazy-002-llvm11-stringref.patch    |  28 ++
 srcpkgs/clazy/template                        |   8 +-
 3 files changed, 378 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch

diff --git a/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..48049fa594a
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
@@ -0,0 +1,343 @@
+From 30d6a2b64f5a05722fdc5d8e3754dbf13425cd62 Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Thu, 4 Jun 2020 17:10:21 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+Also included header file clang/Basic/FileManager.h in src/MiniDumper
+because without this header, class clang::FileEntry in incomplete class
+---
+ src/FixItExporter.cpp                                 | 5 +++--
+ src/MiniAstDumper.cpp                                 | 1 +
+ src/Utils.cpp                                         | 2 +-
+ src/checkbase.cpp                                     | 2 +-
+ src/checks/detachingbase.cpp                          | 2 +-
+ src/checks/level0/qenums.cpp                          | 2 +-
+ src/checks/level0/qt-macros.cpp                       | 4 ++--
+ src/checks/level0/unused-non-trivial-variable.cpp     | 2 +-
+ src/checks/level1/detaching-temporary.cpp             | 2 +-
+ src/checks/level1/non-pod-global-static.cpp           | 2 +-
+ src/checks/level1/qproperty-without-notify.cpp        | 2 +-
+ src/checks/level2/missing-typeinfo.cpp                | 2 +-
+ src/checks/level2/old-style-connect.cpp               | 6 +++---
+ src/checks/level2/rule-of-three.cpp                   | 2 +-
+ src/checks/manuallevel/ifndef-define-typo.cpp         | 6 +++---
+ src/checks/manuallevel/qproperty-type-mismatch.cpp    | 2 +-
+ src/checks/manuallevel/qrequiredresult-candidates.cpp | 2 +-
+ src/checks/manuallevel/qt-keywords.cpp                | 4 ++--
+ src/checks/manuallevel/reserve-candidates.cpp         | 3 ++-
+ 19 files changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/src/FixItExporter.cpp b/src/FixItExporter.cpp
+index f3af2e54..44240cf5 100644
+--- a/src/FixItExporter.cpp
++++ b/src/FixItExporter.cpp
+@@ -68,7 +68,7 @@ void FixItExporter::BeginSourceFile(const LangOptions &LangOpts, const Preproces
+ 
+     const auto id = SourceMgr.getMainFileID();
+     const auto entry = SourceMgr.getFileEntryForID(id);
+-    getTuDiag().MainSourceFile = entry->getName();
++    getTuDiag().MainSourceFile = static_cast<std::string>(entry->getName());
+ }
+ 
+ bool FixItExporter::IncludeInDiagnosticCounts() const
+@@ -89,7 +89,8 @@ tooling::Diagnostic FixItExporter::ConvertDiagnostic(const Diagnostic &Info)
+     // TODO: This returns an empty string: DiagEngine->getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
+     // HACK: capture it at the end of the message: Message text [check-name]
+ 
+-    std::string checkName = DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
++    std::string checkName =
++        static_cast<std::string>(DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID()));
+     std::string messageText;
+ 
+     if (checkName.empty()) {
+diff --git a/src/MiniAstDumper.cpp b/src/MiniAstDumper.cpp
+index 47661749..6124e6e8 100644
+--- a/src/MiniAstDumper.cpp
++++ b/src/MiniAstDumper.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <clang/Frontend/CompilerInstance.h>
+ #include <clang/Frontend/FrontendPluginRegistry.h>
++#include <clang/Basic/FileManager.h>
+ 
+ using namespace clang;
+ using namespace std;
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index 001ced98..b0812fe3 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -878,7 +878,7 @@ string Utils::filenameForLoc(SourceLocation loc, const clang::SourceManager &sm)
+     if (loc.isMacroID())
+         loc = sm.getExpansionLoc(loc);
+ 
+-    const string filename = sm.getFilename(loc);
++    const string filename = static_cast<std::string>(sm.getFilename(loc));
+     auto splitted = clazy::splitString(filename, '/');
+     if (splitted.empty())
+         return {};
+diff --git a/src/checkbase.cpp b/src/checkbase.cpp
+index 8b40e19d..22a426cf 100644
+--- a/src/checkbase.cpp
++++ b/src/checkbase.cpp
+@@ -188,7 +188,7 @@ bool CheckBase::shouldIgnoreFile(SourceLocation loc) const
+     if (!loc.isValid())
+         return true;
+ 
+-    string filename = sm().getFilename(loc);
++    string filename = static_cast<std::string>(sm().getFilename(loc));
+ 
+     return clazy::any_of(m_filesToIgnore, [filename](const std::string &ignored) {
+         return clazy::contains(filename, ignored);
+diff --git a/src/checks/detachingbase.cpp b/src/checks/detachingbase.cpp
+index 70311f42..1b094ee7 100644
+--- a/src/checks/detachingbase.cpp
++++ b/src/checks/detachingbase.cpp
+@@ -57,7 +57,7 @@ bool DetachingBase::isDetachingMethod(CXXMethodDecl *method, DetachingMethodType
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = detachingMethodType == DetachingMethod ? clazy::detachingMethods()
+                                                                                                                      : clazy::detachingMethodsWithConstCounterParts();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     if (it != methodsByType.cend()) {
+         const auto &methods = it->second;
+         if (clazy::contains(methods, clazy::name(method)))
+diff --git a/src/checks/level0/qenums.cpp b/src/checks/level0/qenums.cpp
+index 00075b5c..db8910f2 100644
+--- a/src/checks/level0/qenums.cpp
++++ b/src/checks/level0/qenums.cpp
+@@ -59,7 +59,7 @@ void QEnums::VisitMacroExpands(const Token &MacroNameTok, const SourceRange &ran
+         // We simply check if :: is present because it's very cumbersome to to check for different classes when dealing with the pre-processor
+ 
+         CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+-        string text = Lexer::getSourceText(crange, sm(), lo());
++        string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+         if (clazy::contains(text, "::"))
+             return;
+     }
+diff --git a/src/checks/level0/qt-macros.cpp b/src/checks/level0/qt-macros.cpp
+index d3a587cb..ab8e9f52 100644
+--- a/src/checks/level0/qt-macros.cpp
++++ b/src/checks/level0/qt-macros.cpp
+@@ -44,7 +44,7 @@ void QtMacros::VisitMacroDefined(const Token &MacroNameTok)
+         return;
+ 
+     IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
+-    if (ii && clazy::startsWith(ii->getName(), "Q_OS_"))
++    if (ii && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_"))
+         m_OSMacroExists = true;
+ }
+ 
+@@ -58,7 +58,7 @@ void QtMacros::checkIfDef(const Token &macroNameTok, SourceLocation Loc)
+     if (preProcessorVisitor && preProcessorVisitor->qtVersion() < 51204 && ii->getName() == "Q_OS_WINDOWS") {
+         // Q_OS_WINDOWS was introduced in 5.12.4
+         emitWarning(Loc, "Q_OS_WINDOWS was only introduced in Qt 5.12.4, use Q_OS_WIN instead");
+-    } else if (!m_OSMacroExists && clazy::startsWith(ii->getName(), "Q_OS_")) {
++    } else if (!m_OSMacroExists && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_")) {
+         emitWarning(Loc, "Include qglobal.h before testing Q_OS_ macros");
+     }
+ }
+diff --git a/src/checks/level0/unused-non-trivial-variable.cpp b/src/checks/level0/unused-non-trivial-variable.cpp
+index 4e4b8303..93815f27 100644
+--- a/src/checks/level0/unused-non-trivial-variable.cpp
++++ b/src/checks/level0/unused-non-trivial-variable.cpp
+@@ -91,7 +91,7 @@ bool UnusedNonTrivialVariable::isUninterestingType(const CXXRecordDecl *record)
+     static const vector<StringRef> blacklistedTemplates = { "QScopedPointer", "QSetValueOnDestroy", "QScopedValueRollback" };
+     StringRef className = clazy::name(record);
+     for (StringRef templateName : blacklistedTemplates) {
+-        if (clazy::startsWith(className, templateName))
++        if (clazy::startsWith(static_cast<std::string>(className), static_cast<std::string>(templateName)))
+             return true;
+     }
+ 
+diff --git a/src/checks/level1/detaching-temporary.cpp b/src/checks/level1/detaching-temporary.cpp
+index fedfc81c..60c75532 100644
+--- a/src/checks/level1/detaching-temporary.cpp
++++ b/src/checks/level1/detaching-temporary.cpp
+@@ -140,7 +140,7 @@ void DetachingTemporary::VisitStmt(clang::Stmt *stm)
+     StringRef className = clazy::name(classDecl);
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = clazy::detachingMethods();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     auto it2 = m_writeMethodsByType.find(className);
+ 
+     std::vector<StringRef> allowedFunctions;
+diff --git a/src/checks/level1/non-pod-global-static.cpp b/src/checks/level1/non-pod-global-static.cpp
+index 5879bff8..433b5c5f 100644
+--- a/src/checks/level1/non-pod-global-static.cpp
++++ b/src/checks/level1/non-pod-global-static.cpp
+@@ -74,7 +74,7 @@ void NonPodGlobalStatic::VisitStmt(clang::Stmt *stm)
+     const SourceLocation declStart = clazy::getLocStart(varDecl);
+ 
+     if (declStart.isMacroID()) {
+-        auto macroName = Lexer::getImmediateMacroName(declStart, sm(), lo());
++        auto macroName = static_cast<std::string>(Lexer::getImmediateMacroName(declStart, sm(), lo()));
+         if (clazy::startsWithAny(macroName, { "Q_IMPORT_PLUGIN", "Q_CONSTRUCTOR_FUNCTION", "Q_DESTRUCTOR_FUNCTION"})) // Don't warn on these
+             return;
+     }
+diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp
+index e1d6db4a..3af9fee2 100644
+--- a/src/checks/level1/qproperty-without-notify.cpp
++++ b/src/checks/level1/qproperty-without-notify.cpp
+@@ -69,7 +69,7 @@ void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok,
+         return;
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/level2/missing-typeinfo.cpp b/src/checks/level2/missing-typeinfo.cpp
+index 98df2cd4..03b44e06 100644
+--- a/src/checks/level2/missing-typeinfo.cpp
++++ b/src/checks/level2/missing-typeinfo.cpp
+@@ -74,7 +74,7 @@ void MissingTypeInfo::VisitDecl(clang::Decl *decl)
+         if (sm().isInSystemHeader(clazy::getLocStart(record)))
+             return;
+ 
+-        std::string typeName = clazy::name(record);
++        std::string typeName = static_cast<std::string>(clazy::name(record));
+         if (typeName == "QPair") // QPair doesn't use Q_DECLARE_TYPEINFO, but rather a explicit QTypeInfo.
+             return;
+ 
+diff --git a/src/checks/level2/old-style-connect.cpp b/src/checks/level2/old-style-connect.cpp
+index 0fe68c13..396cb703 100644
+--- a/src/checks/level2/old-style-connect.cpp
++++ b/src/checks/level2/old-style-connect.cpp
+@@ -274,7 +274,7 @@ void OldStyleConnect::VisitMacroExpands(const Token &macroNameTok, const SourceR
+         return;
+ 
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(Q_PRIVATE_SLOT\s*\((.*)\s*,\s*.*\s+(.*)\(.*)");
+     smatch match;
+@@ -293,7 +293,7 @@ string OldStyleConnect::signalOrSlotNameFromMacro(SourceLocation macroLoc)
+     CharSourceRange expansionRange = clazy::getImmediateExpansionRange(macroLoc, sm());
+     SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(\s*(SIGNAL|SLOT)\s*\(\s*(.+)\s*\(.*)");
+ 
+@@ -315,7 +315,7 @@ bool OldStyleConnect::isSignalOrSlot(SourceLocation loc, string &macroName) cons
+     if (!loc.isMacroID() || loc.isInvalid())
+         return false;
+ 
+-    macroName = Lexer::getImmediateMacroName(loc, sm(), lo());
++    macroName = static_cast<std::string>(Lexer::getImmediateMacroName(loc, sm(), lo()));
+     return macroName == "SIGNAL" || macroName == "SLOT";
+ }
+ 
+diff --git a/src/checks/level2/rule-of-three.cpp b/src/checks/level2/rule-of-three.cpp
+index 8db55d53..7583fcc5 100644
+--- a/src/checks/level2/rule-of-three.cpp
++++ b/src/checks/level2/rule-of-three.cpp
+@@ -140,7 +140,7 @@ void RuleOfThree::VisitDecl(clang::Decl *decl)
+ 
+     const string className = record->getNameAsString();
+     const string classQualifiedName = record->getQualifiedNameAsString();
+-    const string filename = sm().getFilename(recordStart);
++    const string filename = static_cast<std::string>(sm().getFilename(recordStart));
+     if (clazy::endsWith(className, "Private") && clazy::endsWithAny(filename, { ".cpp", ".cxx", "_p.h" }))
+         return; // Lots of RAII classes fall into this category. And even Private (d-pointer) classes, warning in that case would just be noise
+ 
+diff --git a/src/checks/manuallevel/ifndef-define-typo.cpp b/src/checks/manuallevel/ifndef-define-typo.cpp
+index edb6cdf4..e9c50a45 100644
+--- a/src/checks/manuallevel/ifndef-define-typo.cpp
++++ b/src/checks/manuallevel/ifndef-define-typo.cpp
+@@ -44,7 +44,7 @@ void IfndefDefineTypo::VisitMacroDefined(const Token &macroNameTok)
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -53,7 +53,7 @@ void IfndefDefineTypo::VisitDefined(const Token &macroNameTok, const SourceRange
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -66,7 +66,7 @@ void IfndefDefineTypo::VisitIfdef(SourceLocation, const Token &)
+ void IfndefDefineTypo::VisitIfndef(SourceLocation, const Token &macroNameTok)
+ {
+     if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo())
+-        m_lastIfndef = ii->getName();
++        m_lastIfndef = static_cast<std::string>(ii->getName());
+ }
+ 
+ void IfndefDefineTypo::VisitIf(SourceLocation, SourceRange, PPCallbacks::ConditionValueKind)
+diff --git a/src/checks/manuallevel/qproperty-type-mismatch.cpp b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+index f91159cb..952d9f1d 100644
+--- a/src/checks/manuallevel/qproperty-type-mismatch.cpp
++++ b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+@@ -237,7 +237,7 @@ void QPropertyTypeMismatch::VisitMacroExpands(const clang::Token &MacroNameTok,
+ 
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (!text.empty() && text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/manuallevel/qrequiredresult-candidates.cpp b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+index 912dbaa0..6375bd7b 100644
+--- a/src/checks/manuallevel/qrequiredresult-candidates.cpp
++++ b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+@@ -65,7 +65,7 @@ void QRequiredResultCandidates::VisitDecl(clang::Decl *decl)
+ 
+ 
+     if (returnClass == classDecl) {
+-        const std::string methodName = clazy::name(method);
++        const std::string methodName = static_cast<std::string>(clazy::name(method));
+         if (methodName.empty()) // fixes assert
+             return;
+ 
+diff --git a/src/checks/manuallevel/qt-keywords.cpp b/src/checks/manuallevel/qt-keywords.cpp
+index e792e95a..b60752c9 100644
+--- a/src/checks/manuallevel/qt-keywords.cpp
++++ b/src/checks/manuallevel/qt-keywords.cpp
+@@ -59,12 +59,12 @@ void QtKeywords::VisitMacroExpands(const Token &macroNameTok, const SourceRange
+     }
+ 
+     static const vector<StringRef> keywords = { "foreach", "signals", "slots", "emit" };
+-    std::string name = ii->getName();
++    std::string name = static_cast<std::string>(ii->getName());
+     if (!clazy::contains(keywords, name))
+         return;
+ 
+     // Make sure the macro is Qt's. It must be defined in Qt's headers, not 3rdparty
+-    std::string qtheader = sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc()));
++    std::string qtheader = static_cast<std::string>(sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc())));
+     if (!clazy::endsWith(qtheader, "qglobal.h") && !clazy::endsWith(qtheader, "qobjectdefs.h"))
+         return;
+ 
+diff --git a/src/checks/manuallevel/reserve-candidates.cpp b/src/checks/manuallevel/reserve-candidates.cpp
+index 389cac5a..92e4491c 100644
+--- a/src/checks/manuallevel/reserve-candidates.cpp
++++ b/src/checks/manuallevel/reserve-candidates.cpp
+@@ -78,7 +78,8 @@ static bool isCandidateMethod(CXXMethodDecl *methodDecl)
+     if (!classDecl)
+         return false;
+ 
+-    if (!clazy::equalsAny(clazy::name(methodDecl), { "append", "push_back", "push", "operator<<", "operator+=" }))
++    if (!clazy::equalsAny(static_cast<std::string>(clazy::name(methodDecl)),
++                 { "append", "push_back", "push", "operator<<", "operator+=" }))
+         return false;
+ 
+     if (!clazy::isAReserveClass(classDecl))
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
new file mode 100644
index 00000000000..28cbb60b091
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
@@ -0,0 +1,28 @@
+From 25aa102cc49def9573ffbed88155589cd60a2e8f Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Fri, 5 Jun 2020 16:52:53 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10 (clazy-standalone)
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+---
+ src/checks/manuallevel/jnisignatures.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/checks/manuallevel/jnisignatures.cpp b/src/checks/manuallevel/jnisignatures.cpp
+index 81e61d48..5d4fe203 100644
+--- a/src/checks/manuallevel/jnisignatures.cpp
++++ b/src/checks/manuallevel/jnisignatures.cpp
+@@ -103,7 +103,7 @@ void JniSignatures::checkFunctionCall(Stmt *stm)
+         return;
+     }
+ 
+-    const std::string name = clazy::name(funDecl);
++    const std::string name = static_cast<std::string>(clazy::name(funDecl));
+ 
+     if (name == "callObjectMethod" || name == "callMethod") {
+         checkArgAt(callExpr, 0, methodNameRegex, "Invalid method name");
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 4d8557be669..5af2b918e14 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.7
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"
@@ -12,3 +12,9 @@ homepage="https://cgit.kde.org/clazy.git/about/"
 distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
 checksum=754da5815f769dd6b72a040a2430525c93f294eb7769c78271603df9614f1b21
 nocross="Clang cannot be installed as makedep"
+
+post_extract() {
+	for i in ${FILESDIR}/clazy-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}

From 707f6512d487fee86031eb7e189df1eccc27e175 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 15:19:37 +0100
Subject: [PATCH 20/24] include-what-you-use: rebuild for llvm11

---
 ...de-what-you-use-001-llvm11-stringref.patch | 146 ++++++++++++++++++
 ...ude-what-you-use-002-clang-astdumper.patch |  54 +++++++
 srcpkgs/include-what-you-use/template         |   8 +-
 3 files changed, 207 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch

diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..171dca28e34
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
@@ -0,0 +1,146 @@
+From 53487d209729d5781007dc0fd6076dc585cb3727 Mon Sep 17 00:00:00 2001
+From: Andrea Bocci <andrea.bocci@cern.ch>
+Date: Fri, 28 Feb 2020 17:45:03 +0100
+Subject: [PATCH] Add explicit conversion from llvm::StringRef to std::string
+
+llvm/llvm-project@777180a makes the llvm::StringRef conversion operator
+to std::string explicit.
+These changes add a call to the str() method to perform the conversion.
+
+Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
+---
+ iwyu_driver.cc       | 2 +-
+ iwyu_globals.cc      | 4 ++--
+ iwyu_lexer_utils.cc  | 2 +-
+ iwyu_location_util.h | 2 +-
+ iwyu_output.cc       | 2 +-
+ iwyu_path_util.cc    | 6 +++---
+ iwyu_preprocessor.cc | 4 ++--
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/iwyu_driver.cc b/iwyu_driver.cc
+index bd163144..42fea35b 100644
+--- a/iwyu_driver.cc
++++ b/iwyu_driver.cc
+@@ -79,7 +79,7 @@ std::string GetExecutablePath(const char *Argv0) {
+ }
+ 
+ const char *SaveStringInSet(std::set<std::string> &SavedStrings, StringRef S) {
+-  return SavedStrings.insert(S).first->c_str();
++  return SavedStrings.insert(S.str()).first->c_str();
+ }
+ 
+ void ExpandArgsFromBuf(const char *Arg,
+diff --git a/iwyu_globals.cc b/iwyu_globals.cc
+index 0f58b4dc..26998966 100644
+--- a/iwyu_globals.cc
++++ b/iwyu_globals.cc
+@@ -293,7 +293,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+   for (auto it = header_search->system_dir_begin();
+        it != header_search->system_dir_end(); ++it) {
+     if (const DirectoryEntry* entry = it->getDir()) {
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map[path] = HeaderSearchPath::kSystemPath;
+     }
+   }
+@@ -303,7 +303,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+       // search_dir_begin()/end() includes both system and user paths.
+       // If it's a system path, it's already in the map, so everything
+       // new is a user path.  The insert only 'takes' for new entries.
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map.insert(make_pair(path, HeaderSearchPath::kUserPath));
+     }
+   }
+diff --git a/iwyu_lexer_utils.cc b/iwyu_lexer_utils.cc
+index fcea2d28..648c9da8 100644
+--- a/iwyu_lexer_utils.cc
++++ b/iwyu_lexer_utils.cc
+@@ -70,7 +70,7 @@ SourceLocation GetLocationAfter(
+ string GetIncludeNameAsWritten(
+     SourceLocation include_loc,
+     const CharacterDataGetterInterface& data_getter) {
+-  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter);
++  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter).str();
+   if (data.empty())
+     return data;
+   string::size_type endpos = string::npos;
+diff --git a/iwyu_location_util.h b/iwyu_location_util.h
+index 3892a424..6f8cf81c 100644
+--- a/iwyu_location_util.h
++++ b/iwyu_location_util.h
+@@ -89,7 +89,7 @@ bool IsInScratchSpace(clang::SourceLocation loc);
+ 
+ inline string GetFilePath(const clang::FileEntry* file) {
+   return (IsBuiltinFile(file) ? "<built-in>" :
+-          NormalizeFilePath(file->getName()));
++          NormalizeFilePath(file->getName().str()));
+ }
+ 
+ //------------------------------------------------------------
+diff --git a/iwyu_output.cc b/iwyu_output.cc
+index ca145710..8666c26c 100644
+--- a/iwyu_output.cc
++++ b/iwyu_output.cc
+@@ -168,7 +168,7 @@ string GetKindName(const clang::TagDecl* tag_decl) {
+   if (const FakeNamedDecl* fake = FakeNamedDeclIfItIsOne(named_decl)) {
+     return fake->kind_name();
+   }
+-  return tag_decl->getKindName();
++  return tag_decl->getKindName().str();
+ }
+ 
+ string GetQualifiedNameAsString(const clang::NamedDecl* named_decl) {
+diff --git a/iwyu_path_util.cc b/iwyu_path_util.cc
+index ab4fc800..9987ea47 100644
+--- a/iwyu_path_util.cc
++++ b/iwyu_path_util.cc
+@@ -134,7 +134,7 @@ string NormalizeFilePath(const string& path) {
+   std::replace(normalized.begin(), normalized.end(), '\\', '/');
+ #endif
+ 
+-  return normalized.str();
++  return normalized.str().str();
+ }
+ 
+ string NormalizeDirPath(const string& path) {
+@@ -154,14 +154,14 @@ string MakeAbsolutePath(const string& path) {
+   std::error_code error = llvm::sys::fs::make_absolute(absolute_path);
+   CHECK_(!error);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string MakeAbsolutePath(const string& base_path, const string& relative_path) {
+   llvm::SmallString<128> absolute_path(base_path);
+   llvm::sys::path::append(absolute_path, relative_path);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string GetParentPath(const string& path) {
+diff --git a/iwyu_preprocessor.cc b/iwyu_preprocessor.cc
+index 58e78595..88b93144 100644
+--- a/iwyu_preprocessor.cc
++++ b/iwyu_preprocessor.cc
+@@ -313,7 +313,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+       break;
+     }
+     const string filename = GetSourceTextUntilEndOfLine(current_loc,
+-                                                        DefaultDataGetter());
++                                                        DefaultDataGetter()).str();
+     // Use "" or <> based on where the file lives.
+     string quoted_private_include;
+     if (IsSystemIncludeFile(GetFilePath(current_loc)))
+@@ -332,7 +332,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+     }
+ 
+     string after_text = GetSourceTextUntilEndOfLine(current_loc,
+-                                                    DefaultDataGetter());
++                                                    DefaultDataGetter()).str();
+     const string::size_type close_brace_pos = after_text.find('}');
+     if (close_brace_pos == string::npos) {
+       Warn(current_loc, "@headername directive missing a closing brace");
diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
new file mode 100644
index 00000000000..663a883fa91
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
@@ -0,0 +1,54 @@
+From 30549c6931972456d1e09ff5dbeecd258a8df72b Mon Sep 17 00:00:00 2001
+From: Kim Grasman <kim.grasman@gmail.com>
+Date: Thu, 9 Jul 2020 18:47:56 +0200
+Subject: [PATCH] Implement Stmt printing with ASTDumper
+
+The Clang API changed in commit 473fbc90d1fbf17e so that Stmt::dump
+takes an ASTContext instead of a SourceManager.
+
+Rather than wire a global ASTContext, reimplement PrintableStmt and
+PrintStmt to duplicate the most trivial implementations not requiring
+ASTContext.
+
+No functional change.
+---
+ iwyu_ast_util.cc | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/iwyu_ast_util.cc b/iwyu_ast_util.cc
+index d3d4dd1f..b19a11fb 100644
+--- a/iwyu_ast_util.cc
++++ b/iwyu_ast_util.cc
+@@ -25,6 +25,7 @@
+ #include "llvm/Support/Casting.h"
+ #include "llvm/Support/raw_ostream.h"
+ #include "clang/AST/ASTContext.h"
++#include "clang/AST/ASTDumper.h"
+ #include "clang/AST/CanonicalType.h"
+ #include "clang/AST/Decl.h"
+ #include "clang/AST/DeclBase.h"
+@@ -46,6 +47,7 @@ namespace clang {
+ class FileEntry;
+ }  // namespace clang
+ 
++using clang::ASTDumper;
+ using clang::BlockPointerType;
+ using clang::CXXConstructExpr;
+ using clang::CXXConstructorDecl;
+@@ -450,12 +452,14 @@ string PrintableDecl(const Decl* decl, bool terse/*=true*/) {
+ string PrintableStmt(const Stmt* stmt) {
+   std::string buffer;
+   raw_string_ostream ostream(buffer);
+-  stmt->dump(ostream, *GlobalSourceManager());
++  ASTDumper dumper(ostream, /*ShowColors=*/false);
++  dumper.Visit(stmt);
+   return ostream.str();
+ }
+ 
+ void PrintStmt(const Stmt* stmt) {
+-  stmt->dump(*GlobalSourceManager());  // This prints to errs().
++  ASTDumper dumper(llvm::errs(), /*ShowColors=*/false);
++  dumper.Visit(stmt);
+ }
+ 
+ string PrintableType(const Type* type) {
diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 22c9d09d091..3811309bdde 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.14
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
@@ -15,6 +15,12 @@ distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.
 checksum=43184397db57660c32e3298a6b1fd5ab82e808a1f5ab0591d6745f8d256200ef
 python_version=3
 
+post_extract() {
+	for i in ${FILESDIR}/include-what-you-use-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
+
 post_install() {
 	vlicense LICENSE.TXT
 }

From f932b52169f6a182b2e3645017e70bff9e00016c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 16:17:54 +0100
Subject: [PATCH 21/24] bpftrace: update to 0.11.2

---
 ...trace-001-six-args-bpf_attach_uprobe.patch | 126 +++++++++++++++
 ...ace-002-seven-args-bpf_attach_uprobe.patch | 148 ++++++++++++++++++
 srcpkgs/bpftrace/template                     |  10 +-
 3 files changed, 282 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch

diff --git a/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..e2b1ad1351b
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
@@ -0,0 +1,126 @@
+From 52fb793c6423c19696e07cc14ad5f9182f7eca0e Mon Sep 17 00:00:00 2001
+From: Viktor Malik <viktor.malik@gmail.com>
+Date: Wed, 12 Aug 2020 09:45:29 +0200
+Subject: [PATCH] Feature-detect bpf_attach_kprobe signature
+
+The function has 6 parameters in current versions of BCC and 5
+parameters in older versions.
+
+This is detected in CMake using CHECK_CXX_SOURCE_COMPILES. For static
+compilation, we also need to retrieve and link static libbpf, libelf,
+and libz. This may cause libbpf, libelf and libz to be searched for
+twice, but it should be fine since CMake caches results.
+
+Fixes iovisor#1027.
+---
+ cmake/FindLibBcc.cmake | 24 ++++++++++++++++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 31 ++++++++++++++-----------------
+ tests/CMakeLists.txt   |  3 +++
+ 4 files changed, 44 insertions(+), 17 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 9d30b04bc..ec216271d 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -70,3 +70,27 @@ include (FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBcc "Please install the bcc library package, which is required. Depending on your distro, it may be called bpfcclib or bcclib (Ubuntu), bcc-devel (Fedora), or something else. If unavailable, install bcc from source (github.com/iovisor/bcc)."
+   LIBBCC_LIBRARIES
+   LIBBCC_INCLUDE_DIRS)
++
++# Check bpf_attach_kprobe signature
++if(${LIBBCC_FOUND})
++if(STATIC_LINKING)
++  # libbcc.a is not statically linked with libbpf.a, libelf.a, and libz.a.
++  # If we do a static bpftrace build, we must link them in.
++  find_package(LibBpf)
++  find_package(LibElf)
++  find_package(LibZ)
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_BPF_LIBRARY_STATIC} ${LIBBPF_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBZ_LIBRARIES})
++else()
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_LIBRARIES})
++endif()
++INCLUDE(CheckCXXSourceCompiles)
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_kprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++SET(CMAKE_REQUIRED_LIBRARIES)
++endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 647a23f1c..448a045fc 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -80,6 +80,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 587a11576..afad9ed18 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -754,26 +754,23 @@ void AttachedProbe::load_prog()
+   }
+ }
+ 
+-// XXX(mmarchini): bcc changed the signature of bpf_attach_kprobe, adding a new
+-// int parameter at the end. Since there's no reliable way to feature-detect
+-// this, we create a function pointer with the long signature and cast
+-// bpf_attach_kprobe to this function pointer. If we're on an older bcc
+-// version, bpf_attach_kprobe call will be augmented with an extra register
+-// being used for the last parameter, even though this register won't be used
+-// inside the function. Since the register won't be used this is kinda safe,
+-// although not ideal.
+-typedef int (*attach_probe_wrapper_signature)(int, enum bpf_probe_attach_type, const char*, const char*, uint64_t, int);
+-
+ void AttachedProbe::attach_kprobe(bool safe_mode)
+ {
+   resolve_offset_kprobe(safe_mode);
+-  int perf_event_fd = cast_signature<attach_probe_wrapper_signature>(
+-      &bpf_attach_kprobe)(progfd_,
+-                          attachtype(probe_.type),
+-                          eventname().c_str(),
+-                          probe_.attach_point.c_str(),
+-                          offset_,
+-                          0);
++#ifdef LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_,
++                                        0);
++#else
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_);
++#endif
+ 
+   if (perf_event_fd < 0) {
+     if (probe_.orig_name != probe_.name) {
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 3688b8487..84daeb2aa 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -102,6 +102,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace_test ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..2cc55c86555
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
@@ -0,0 +1,148 @@
+From c7dbab451484b96178da1a8c43330154ce4c9d7a Mon Sep 17 00:00:00 2001
+From: Daniel Xu <dxu@dxuuu.xyz>
+Date: Wed, 14 Oct 2020 17:09:46 -0700
+Subject: [PATCH] Detect 7 arg bpf_attach_uprobe() API
+
+The 7th arg allows us to specify the usdt semaphore location.
+---
+ cmake/FindLibBcc.cmake | 11 +++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 42 ++++++++++++++++++++++++++++++++++--------
+ src/main.cpp           |  6 ++++++
+ tests/CMakeLists.txt   |  3 +++
+ 5 files changed, 57 insertions(+), 8 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 4c09a8ca2..92cedab5e 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -7,6 +7,8 @@
+ #  LIBBCC_DEFINITIONS - Compiler switches required for using libbcc
+ #  LIBBCC_BPF_LIBRARY_STATIC - libbpf static library (for static compilation)
+ #  LIBBCC_LOADER_LIBRARY_STATIC - libbcc helper static library (for static compilation)
++#  LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++#  LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ #
+ # Note that the shared libbcc binary has libbpf and bcc_loader already compiled in but
+ # the static doesn't. So when creating a static build those have to be included too.
+@@ -94,6 +96,15 @@ int main(void) {
+   return 0;
+ }
+ " LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_uprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ SET(CMAKE_REQUIRED_INCLUDES)
+ endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 9162356e3..cef94d144 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -88,6 +88,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 93fbfa876..a5d8bc56d 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -698,12 +698,23 @@ void AttachedProbe::attach_uprobe(bool safe_mode)
+ {
+   resolve_offset_uprobe(safe_mode);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_,
+-                                        attachtype(probe_.type),
+-                                        eventname().c_str(),
+-                                        probe_.path.c_str(),
+-                                        offset_,
+-                                        probe_.pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+     throw std::runtime_error("Error attaching probe: " + probe_.name);
+@@ -812,8 +823,23 @@ void AttachedProbe::attach_usdt(int pid)
+ 
+   offset_ = resolve_offset(probe_.path, probe_.attach_point, probe_.loc);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_, attachtype(probe_.type),
+-      eventname().c_str(), probe_.path.c_str(), offset_, pid == 0 ? -1 : pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+   {
+diff --git a/src/main.cpp b/src/main.cpp
+index 48fcf5aa0..09f4d9677 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -162,6 +162,12 @@ static int info()
+             << "yes" << std::endl;
+ #else
+             << "no" << std::endl;
++#endif
++  std::cerr << "  bcc bpf_attach_uprobe refcount: "
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++            << "yes" << std::endl;
++#else
++            << "no" << std::endl;
+ #endif
+   std::cerr << "  libbpf: "
+ #ifdef HAVE_LIBBPF
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index ace5ff106..332eba2b5 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -116,6 +116,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index d8367fa5c03..44e6c174107 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,6 +1,6 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
-version=0.11.1
+version=0.11.2
 revision=1
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
@@ -12,7 +12,13 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="Apache-2.0"
 homepage="https://github.com/iovisor/bpftrace/"
 distfiles="https://github.com/iovisor/bpftrace/archive/v${version}.tar.gz"
-checksum=98efc9396451bc1a4f73378cec4755e07e7718cb5d698472606f5ffc2b9e48e8
+checksum=1f0fc30073547e3b285e1a373aa469bb18d3ba27f8c05f91016df0ca84f77f90
+
+post_extract() {
+	for i in ${FILESDIR}/bpftrace-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
 
 post_install() {
 	# clashes with bcc-tools

From 33c9bc04ccf3d1af0e58db890dc8d6c9443d0324 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 19:29:15 +0100
Subject: [PATCH 22/24] beignet: rebuild for llvm11

---
 srcpkgs/beignet/patches/llvm11.patch | 945 +++++++++++++++++++++++++++
 srcpkgs/beignet/template             |   2 +-
 2 files changed, 946 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/beignet/patches/llvm11.patch

diff --git a/srcpkgs/beignet/patches/llvm11.patch b/srcpkgs/beignet/patches/llvm11.patch
new file mode 100644
index 00000000000..9f328267698
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm11.patch
@@ -0,0 +1,945 @@
+Source: Snektron
+
+There were a few changes required for LLVM 11:
+* llvm::StringRef requires .str(), implicit conversion was removed
+* llvm::CallSite was removed, but the required methods are available on llvm::CallInst
+* VectorTyID was split into FixedVectorTyID and ScalableVectorTyID, FixedVectorTyID was used
+* CallInst::getCalledValue() was renamed to CallInst::getCalledOperand()
+* Implicit conversion from MaybeAlign to Align was removed, so MaybeAlign::valueOrOne was used instead.
+
+--- backend/src/llvm/StripAttributes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/StripAttributes.cpp	2020-11-09 19:04:19.641897141 +0100
+@@ -107,9 +107,8 @@
+        BB != E; ++BB) {
+     for (BasicBlock::iterator Inst = BB->begin(), E = BB->end();
+          Inst != E; ++Inst) {
+-      CallSite Call(&*Inst);
+-      if (Call)
+-        Call.setCallingConv(CallingConv::C);
++      if (CallInst* callInst = dyn_cast<CallInst>(&*Inst))
++        callInst->setCallingConv(CallingConv::C);
+     }
+   }
+
+--- backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 17:04:09.633753428 +0100
+@@ -98,7 +98,7 @@
+         if (callFunc && callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        std::string fnName = call->getCalledValue()->stripPointerCasts()->getName();
++        std::string fnName = call->getCalledOperand()->stripPointerCasts()->getName().str();
+
+         if (!MFS.insert(fnName).second) {
+           continue;
+--- backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 19:01:49.201915008 +0100
+@@ -45,7 +45,7 @@
+       return NULL;
+
+     /* This is a fake, to check the function bitcast is for block or not */
+-    std::string fnName = Fn->getName();
++    std::string fnName = Fn->getName().str();
+     if(fnName.find("_invoke") == std::string::npos)
+       return NULL;
+
+@@ -119,18 +119,18 @@
+       ParamTys.push_back(ty);
+     }
+     FunctionType* NewFT = FunctionType::get(Fn->getReturnType(), ParamTys, false);
+-    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName());
++    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName().str());
+     SmallVector<ReturnInst*, 8> Returns;
+
+     Function::arg_iterator NewFnArgIt = NewFn->arg_begin();
+     for (Function::arg_iterator I = Fn->arg_begin(), E = Fn->arg_end(); I != E; ++I) {
+-      std::string ArgName = I->getName();
++      std::string ArgName = I->getName().str();
+       NewFnArgIt->setName(ArgName);
+       VMap[&*I] = &(*NewFnArgIt++);
+     }
+     CloneFunctionInto(NewFn, Fn, VMap, /*ModuleLevelChanges=*/true, Returns);
+
+-    Fn->setName("__d" + Fn->getName());
++    Fn->setName("__d" + Fn->getName().str());
+     mod->getFunctionList().push_back(NewFn);
+     //mod->getOrInsertFunction(NewFn->getName(), NewFn->getFunctionType(),
+     //                         NewFn->getAttributes());
+@@ -147,7 +147,7 @@
+       argTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argBaseTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argTypeQuals.push_back(llvm::MDString::get(Context, ""));
+-      argNames.push_back(llvm::MDString::get(Context, I->getName()));
++      argNames.push_back(llvm::MDString::get(Context, I->getName().str()));
+     }
+
+     //If run to here, llvm version always > 3.9, add the version check just for build.
+@@ -198,7 +198,7 @@
+            * invoke pointer to store the index in the unit's block functions index.*/
+           Function *Fn = dyn_cast<Function>(bt->getOperand(0));
+
+-          std::string fnName = Fn->getName();
++          std::string fnName = Fn->getName().str();
+           int index = -1;
+           for(size_t i=0; i<unit.blockFuncs.size(); i++) {
+             if(unit.blockFuncs[i] == fnName) {
+@@ -241,7 +241,7 @@
+             //unnamed call function, parse the use to find the define of called function
+             SmallVector<Value*, 16> args(CI->op_begin(), CI->op_end()-1);
+
+-            Value *v = CI->getCalledValue();
++            Value *v = CI->getCalledOperand();
+             BitCastInst* bt = dyn_cast<BitCastInst>(v);
+             if(bt == NULL)
+               continue;
+@@ -316,7 +316,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+
+@@ -332,7 +332,7 @@
+           } else {
+             //handle enqueue_kernel function call
+             Function *fn = CI->getCalledFunction();
+-            if (fn->getName().find("enqueue_kernel") == std::string::npos)
++            if (fn->getName().str().find("enqueue_kernel") == std::string::npos)
+               continue;
+
+             //block parameter's index, 3 or 6
+@@ -361,7 +361,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+             } else if(isa<AllocaInst>(block)) {
+--- backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 18:33:50.919114327 +0100
+@@ -376,7 +376,7 @@
+           GBE_ASSERT(index == 0);
+           return this->_newScalar(value, key, type, index, uniform);
+           break;
+-        case Type::VectorTyID:
++        case Type::FixedVectorTyID:
+         {
+           auto vectorType = cast<VectorType>(type);
+           auto elementType = vectorType->getElementType();
+@@ -743,20 +743,20 @@
+ #undef DECL_VISIT_FN
+
+     // Emit rounding instructions from gen native function
+-    void emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode);
++    void emitRoundingCallInst(CallInst &I, ir::Opcode opcode);
+     // Emit unary instructions from gen native function
+-    void emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
++    void emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
+     // Emit unary instructions from gen native function
+-    void emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode);
++    void emitAtomicInst(CallInst &I, ir::AtomicOps opcode);
+     // Emit workgroup instructions
+-    void emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+-    void emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+
+-    uint8_t appendSampler(CallSite::arg_iterator AI);
++    uint8_t appendSampler(User::op_iterator AI);
+     uint8_t getImageID(CallInst &I);
+
+     // These instructions are not supported at all
+@@ -1320,13 +1320,13 @@
+ #endif
+
+       if(typeNameNode) {
+-        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+       }
+       if(typeBaseNameNode) {
+-        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+       }
+-      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
+-      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
++      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+       bool isImage = llvmInfo.isImageType();
+       bool isPipe = llvmInfo.isPipeType();
+       if (I->getType()->isPointerTy() || isImage || isPipe) {
+@@ -1531,7 +1531,7 @@
+             EltTy = getEltType(EltTy, TypeIndex);
+         }
+
+-        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName());
++        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName().str());
+         unsigned int defOffset = cc.getOffset();
+         relocs.push_back(ir::RelocEntry(offset, defOffset + constantOffset));
+
+@@ -1546,7 +1546,7 @@
+       return;
+     }
+     if (isa<GlobalVariable>(c)) {
+-      ir::Constant cc = unit.getConstantSet().getConstant(c->getName());
++      ir::Constant cc = unit.getConstantSet().getConstant(c->getName().str());
+       unsigned int defOffset = cc.getOffset();
+
+       relocs.push_back(ir::RelocEntry(offset, defOffset));
+@@ -1609,7 +1609,7 @@
+           }
+           break;
+         }
+-      case Type::TypeID::VectorTyID:
++      case Type::TypeID::FixedVectorTyID:
+         {
+           const ConstantDataSequential *cds = dyn_cast<ConstantDataSequential>(c);
+           const VectorType *vecTy = cast<VectorType>(type);
+@@ -1936,7 +1936,7 @@
+       case Type::PointerTyID:
+         regTranslator.newScalar(value, key, 0, uniform);
+         break;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         auto vectorType = cast<VectorType>(type);
+         const uint32_t elemNum = vectorType->getNumElements();
+@@ -2395,7 +2395,7 @@
+ #endif
+         }
+         if(typeNameNode) {
+-          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+           //LLVM 3.9 image's type name include access qual, don't match OpenCL spec, erase them.
+           std::vector<std::string> filters = {"__read_only ", "__write_only "};
+           for (uint32_t i = 0; i < filters.size(); i++) {
+@@ -2406,16 +2406,16 @@
+           }
+         }
+         if(typeBaseNameNode){
+-          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+         }
+         if(accessQualNode) {
+-          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString();
++          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString().str();
+         }
+         if(typeQualNode) {
+-          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+         }
+         if(argNameNode){
+-          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString();
++          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString().str();
+         }
+
+         // function arguments are uniform values.
+@@ -3010,7 +3010,7 @@
+         } else {
+           this->newRegister(const_cast<GlobalVariable*>(&v));
+           ir::Register reg = regTranslator.getScalar(const_cast<GlobalVariable*>(&v), 0);
+-          ir::Constant &con = unit.getConstantSet().getConstant(v.getName());
++          ir::Constant &con = unit.getConstantSet().getConstant(v.getName().str());
+           if (!legacyMode) {
+             ir::Register regload = ctx.reg(getFamily(getType(ctx, v.getType())));
+             ctx.LOADI(getType(ctx, v.getType()), regload, ctx.newIntegerImmediate(con.getOffset(), getType(ctx, v.getType())));
+@@ -3212,7 +3212,7 @@
+         GBE_ASSERTM(false, "Unsupported calling convention");
+     }
+
+-    ctx.startFunction(F.getName());
++    ctx.startFunction(F.getName().str());
+
+     ir::Function &fn = ctx.getFunction();
+     this->regTranslator.clear();
+@@ -3810,9 +3810,9 @@
+
+   void GenWriter::regAllocateCallInst(CallInst &I) {
+     Value *dst = &I;
+-    Value *Callee = I.getCalledValue();
++    Value *Callee = I.getCalledOperand();
+     GBE_ASSERT(ctx.getFunction().getProfile() == ir::PROFILE_OCL);
+-    GBE_ASSERT(isa<InlineAsm>(I.getCalledValue()) == false);
++    GBE_ASSERT(isa<InlineAsm>(I.getCalledOperand()) == false);
+     if(I.getNumArgOperands()) GBE_ASSERT(I.hasStructRetAttr() == false);
+
+     // We only support a small number of intrinsics right now
+@@ -3870,7 +3870,7 @@
+       }
+     }
+     // Get the name of the called function and handle it
+-    const std::string fnName = Callee->stripPointerCasts()->getName();
++    const std::string fnName = Callee->stripPointerCasts()->getName().str();
+     auto genIntrinsicID = intrinsicMap.find(fnName);
+     switch (genIntrinsicID) {
+       case GEN_OCL_GET_GROUP_ID0:
+@@ -4166,7 +4166,7 @@
+     };
+   }
+
+-  void GenWriter::emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode) {
++  void GenWriter::emitRoundingCallInst(CallInst &I, ir::Opcode opcode) {
+     if (I.getType()->isHalfTy()) {
+       const ir::Register src = this->getRegister(I.getOperand(0));
+       const ir::Register srcFloat = ctx.reg(ir::FAMILY_DWORD);
+@@ -4177,14 +4177,14 @@
+       ctx.F32TO16(ir::TYPE_U16, ir::TYPE_FLOAT, dst, dstFloat);
+     } else {
+       GBE_ASSERT(I.getType()->isFloatTy());
+-      this->emitUnaryCallInst(I,CS,opcode);
++      this->emitUnaryCallInst(I,opcode);
+     }
+   }
+
+-  void GenWriter::emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
++  void GenWriter::emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+     GBE_ASSERT(AI != AE);
+     const ir::Register src = this->getRegister(*AI);
+@@ -4293,9 +4293,9 @@
+     this->emitAtomicInstHelper(opcode, type, dst, llvmPtr, payloadTuple);
+   }
+
+-  void GenWriter::emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitAtomicInst(CallInst &I, ir::AtomicOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+     Value *llvmPtr = *AI;
+     ir::AddressSpace addrSpace = addressSpaceLLVMToGen(llvmPtr->getType()->getPointerAddressSpace());
+@@ -4348,7 +4348,7 @@
+     }
+   }
+
+-  void GenWriter::emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
++  void GenWriter::emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
+     ir::Function &f = ctx.getFunction();
+
+     if (f.getwgBroadcastSLM() < 0 && opcode == ir::WORKGROUP_OP_BROADCAST) {
+@@ -4378,8 +4378,8 @@
+       GBE_ASSERT(f.gettidMapSLM() >= 0);
+     }
+
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4391,14 +4391,14 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 3);
+       ctx.WORKGROUP(opcode, (uint32_t)f.gettidMapSLM(), getRegister(&I), srcTuple, 3, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+         src[i] = this->getRegister(*(AI++));
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.WORKGROUP(ir::WORKGROUP_OP_BROADCAST, (uint32_t)f.getwgBroadcastSLM(), getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4423,9 +4423,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4435,7 +4435,7 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 1);
+       ctx.SUBGROUP(opcode, getRegister(&I), srcTuple, 1, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       GBE_ASSERT(argNum == 2);
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+@@ -4443,7 +4443,7 @@
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.SUBGROUP(ir::WORKGROUP_OP_BROADCAST, getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4466,9 +4466,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     Value *llvmPtr = *(AI++);
+@@ -4522,9 +4522,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     const uint8_t imageID = getImageID(I);
+@@ -4557,7 +4557,7 @@
+
+   /* append a new sampler. should be called before any reference to
+    * a sampler_t value. */
+-  uint8_t GenWriter::appendSampler(CallSite::arg_iterator AI) {
++  uint8_t GenWriter::appendSampler(User::op_iterator AI) {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+     CallInst *TC = dyn_cast<CallInst>(*AI);
+     Constant *CPV = TC ? dyn_cast<Constant>(TC->getOperand(0)) : NULL;
+@@ -4595,10 +4595,9 @@
+         const ir::Function &fn = ctx.getFunction();
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+         switch (F->getIntrinsicID()) {
+           case Intrinsic::stacksave:
+@@ -4764,17 +4763,17 @@
+             ctx.MAD(srcType, dst, src0, src1, src2);
+           }
+           break;
+-          case Intrinsic::sqrt: this->emitUnaryCallInst(I,CS,ir::OP_SQR); break;
+-          case Intrinsic::ceil: this->emitRoundingCallInst(I,CS,ir::OP_RNDU); break;
+-          case Intrinsic::trunc: this->emitRoundingCallInst(I,CS,ir::OP_RNDZ); break;
+-          case Intrinsic::rint: this->emitRoundingCallInst(I,CS,ir::OP_RNDE); break;
+-          case Intrinsic::floor: this->emitRoundingCallInst(I,CS,ir::OP_RNDD); break;
+-          case Intrinsic::sin: this->emitUnaryCallInst(I,CS,ir::OP_SIN); break;
+-          case Intrinsic::cos: this->emitUnaryCallInst(I,CS,ir::OP_COS); break;
+-          case Intrinsic::log2: this->emitUnaryCallInst(I,CS,ir::OP_LOG); break;
+-          case Intrinsic::exp2: this->emitUnaryCallInst(I,CS,ir::OP_EXP); break;
++          case Intrinsic::sqrt: this->emitUnaryCallInst(I,ir::OP_SQR); break;
++          case Intrinsic::ceil: this->emitRoundingCallInst(I,ir::OP_RNDU); break;
++          case Intrinsic::trunc: this->emitRoundingCallInst(I,ir::OP_RNDZ); break;
++          case Intrinsic::rint: this->emitRoundingCallInst(I,ir::OP_RNDE); break;
++          case Intrinsic::floor: this->emitRoundingCallInst(I,ir::OP_RNDD); break;
++          case Intrinsic::sin: this->emitUnaryCallInst(I,ir::OP_SIN); break;
++          case Intrinsic::cos: this->emitUnaryCallInst(I,ir::OP_COS); break;
++          case Intrinsic::log2: this->emitUnaryCallInst(I,ir::OP_LOG); break;
++          case Intrinsic::exp2: this->emitUnaryCallInst(I,ir::OP_EXP); break;
+           case Intrinsic::bswap:
+-            this->emitUnaryCallInst(I,CS,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
++            this->emitUnaryCallInst(I,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
+           case Intrinsic::pow:
+           {
+             const ir::Register src0 = this->getRegister(*AI); ++AI;
+@@ -4794,21 +4793,20 @@
+         }
+       } else {
+         // Get the name of the called function and handle it
+-        Value *Callee = I.getCalledValue();
+-        const std::string fnName = Callee->stripPointerCasts()->getName();
++        Value *Callee = I.getCalledOperand();
++        const std::string fnName = Callee->stripPointerCasts()->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+
+         switch (genIntrinsicID) {
+-          case GEN_OCL_FBH: this->emitUnaryCallInst(I,CS,ir::OP_FBH, ir::TYPE_U32); break;
+-          case GEN_OCL_FBL: this->emitUnaryCallInst(I,CS,ir::OP_FBL, ir::TYPE_U32); break;
+-          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,CS,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
++          case GEN_OCL_FBH: this->emitUnaryCallInst(I,ir::OP_FBH, ir::TYPE_U32); break;
++          case GEN_OCL_FBL: this->emitUnaryCallInst(I,ir::OP_FBL, ir::TYPE_U32); break;
++          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
+           case GEN_OCL_ABS:
+           {
+             const ir::Register src = this->getRegister(*AI);
+@@ -4915,8 +4913,8 @@
+             ctx.REGION(dst, src, x.getIntegerValue());
+             break;
+           }
+-          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,CS,ir::OP_RSQ); break;
+-          case GEN_OCL_RCP: this->emitUnaryCallInst(I,CS,ir::OP_RCP); break;
++          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,ir::OP_RSQ); break;
++          case GEN_OCL_RCP: this->emitUnaryCallInst(I,ir::OP_RCP); break;
+           case GEN_OCL_FORCE_SIMD8: ctx.setSimdWidth(8); break;
+           case GEN_OCL_FORCE_SIMD16: ctx.setSimdWidth(16); break;
+           case GEN_OCL_LBARRIER: ctx.SYNC(ir::syncLocalBarrier); break;
+@@ -4947,31 +4945,31 @@
+             break;
+           }
+           case GEN_OCL_ATOMIC_ADD0:
+-          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_ADD); break;
++          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,ir::ATOMIC_OP_ADD); break;
+           case GEN_OCL_ATOMIC_SUB0:
+-          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_SUB); break;
++          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,ir::ATOMIC_OP_SUB); break;
+           case GEN_OCL_ATOMIC_AND0:
+-          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_AND); break;
++          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,ir::ATOMIC_OP_AND); break;
+           case GEN_OCL_ATOMIC_OR0:
+-          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_OR); break;
++          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,ir::ATOMIC_OP_OR); break;
+           case GEN_OCL_ATOMIC_XOR0:
+-          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XOR); break;
++          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,ir::ATOMIC_OP_XOR); break;
+           case GEN_OCL_ATOMIC_XCHG0:
+-          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XCHG); break;
++          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_XCHG); break;
+           case GEN_OCL_ATOMIC_INC0:
+-          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_INC); break;
++          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,ir::ATOMIC_OP_INC); break;
+           case GEN_OCL_ATOMIC_DEC0:
+-          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_DEC); break;
++          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,ir::ATOMIC_OP_DEC); break;
+           case GEN_OCL_ATOMIC_UMIN0:
+-          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMIN); break;
++          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMIN); break;
+           case GEN_OCL_ATOMIC_UMAX0:
+-          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMAX); break;
++          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMAX); break;
+           case GEN_OCL_ATOMIC_IMIN0:
+-          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMIN); break;
++          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMIN); break;
+           case GEN_OCL_ATOMIC_IMAX0:
+-          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMAX); break;
++          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMAX); break;
+           case GEN_OCL_ATOMIC_CMPXCHG0:
+-          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_CMPXCHG); break;
++          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_CMPXCHG); break;
+           case GEN_OCL_GET_IMAGE_WIDTH:
+           case GEN_OCL_GET_IMAGE_HEIGHT:
+           case GEN_OCL_GET_IMAGE_DEPTH:
+@@ -5429,48 +5427,48 @@
+             ctx.WAIT();
+             break;
+           }
+-          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ALL); break;
+-          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ANY); break;
++          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ALL); break;
++          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ANY); break;
+           case GEN_OCL_WORK_GROUP_BROADCAST:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_BROADCAST:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_LRP:
+           {
+             const ir::Register dst  = this->getRegister(&I);
+@@ -5484,69 +5482,69 @@
+             break;
+           }
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteMemInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteMemInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteMemInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteMemInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteMemInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteMemInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteMemInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteMemInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteImageInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteImageInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteImageInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteImageInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteImageInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteImageInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteImageInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteImageInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_GET_PIPE:
+           case GEN_OCL_MAKE_RID:
+           case GEN_OCL_GET_RID:
+--- backend/src/llvm/llvm_includes.hpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_includes.hpp	2020-11-09 19:00:09.955926795 +0100
+@@ -103,7 +103,6 @@
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+ #include "llvm/IR/Mangler.h"
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #include "llvm/IR/InstVisitor.h"
+ #include "llvm/IR/IRPrintingPasses.h"
+--- backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 19:10:37.141852308 +0100
+@@ -160,7 +160,7 @@
+     Value *vecPtr = Builder.CreateBitCast(ld->getPointerOperand(),
+                                         PointerType::get(vecTy, addrSpace));
+     LoadInst *vecValue = Builder.CreateLoad(vecPtr);
+-    vecValue->setAlignment(align);
++    vecValue->setAlignment(align.valueOrOne());
+
+     for (unsigned i = 0; i < size; ++i) {
+       Value *S = Builder.CreateExtractElement(vecValue, Builder.getInt32(i));
+@@ -251,7 +251,7 @@
+       return;
+     Value *newPtr = Builder.CreateBitCast(stPointer, PointerType::get(vecTy, addrSpace));
+     StoreInst *newST = Builder.CreateStore(parent, newPtr);
+-    newST->setAlignment(align);
++    newST->setAlignment(align.valueOrOne());
+   }
+
+   // Find the safe iterator we can point to. If reorder happens, we need to
+--- backend/src/llvm/llvm_passes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_passes.cpp	2020-11-09 18:48:55.997006837 +0100
+@@ -87,14 +87,14 @@
+   }
+
+   int32_t getPadding(int32_t offset, int32_t align) {
+-    return (align - (offset % align)) % align;
++    return (align - (offset % align)) % align;
+   }
+
+   uint32_t getAlignmentByte(const ir::Unit &unit, Type* Ty)
+   {
+     switch (Ty->getTypeID()) {
+       case Type::VoidTyID: NOT_SUPPORTED;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t elemNum = VecTy->getNumElements();
+@@ -138,7 +138,7 @@
+       case Type::HalfTyID:    return 16;
+       case Type::FloatTyID:   return 32;
+       case Type::DoubleTyID:  return 64;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t numElem = VecTy->getNumElements();
+@@ -184,10 +184,12 @@
+     Type *elementType = NULL;
+     if (PointerType* ptrType = dyn_cast<PointerType>(eltTy))
+       elementType = ptrType->getElementType();
+-    else if(SequentialType * seqType = dyn_cast<SequentialType>(eltTy))
+-      elementType = seqType->getElementType();
+-    else if(CompositeType * compTy= dyn_cast<CompositeType>(eltTy))
+-      elementType = compTy->getTypeAtIndex(index);
++    else if (ArrayType * arrType = dyn_cast<ArrayType>(eltTy))
++      elementType = arrType->getElementType();
++    else if(VectorType * vecType = dyn_cast<VectorType>(eltTy))
++      elementType = vecType->getElementType();
++    else if(StructType * structType = dyn_cast<StructType>(eltTy))
++      elementType = structType->getTypeAtIndex(index);
+     GBE_ASSERT(elementType);
+     return elementType;
+   }
+--- backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 18:57:52.618943105 +0100
+@@ -323,8 +323,7 @@
+
+   bool PrintfParser::parseOnePrintfInstruction(CallInst * call)
+   {
+-    CallSite CS(call);
+-    CallSite::arg_iterator CI_FMT = CS.arg_begin();
++    User::op_iterator CI_FMT = call->arg_begin();
+     int param_num = 0;
+
+     llvm::Constant* arg0 = dyn_cast<llvm::ConstantExpr>(*CI_FMT);
+@@ -341,7 +340,7 @@
+       return false;
+     }
+
+-    std::string fmt = fmt_arg->getAsCString();
++    std::string fmt = fmt_arg->getAsCString().str();
+     if (fmt.size() == 0)
+       return false;
+
+@@ -437,8 +436,8 @@
+         if ( callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+
+         if (fnName != "__gen_ocl_printf_stub" && fnName != "__gen_ocl_puts_stub")
+           continue;
+@@ -582,7 +581,7 @@
+             if (!fmt_arg || !fmt_arg->isCString()) {
+               return false;
+             }
+-            slot.state.str = fmt_arg->getAsCString();
++            slot.state.str = fmt_arg->getAsCString().str();
+             return true;
+           }
+           case PRINTF_CONVERSION_P: {
+@@ -595,10 +594,10 @@
+
+         break;
+
+-      case Type::VectorTyID: {
+-        Type* vect_type = arg->getType();
+-        Type* elt_type = vect_type->getVectorElementType();
+-        int vec_num = vect_type->getVectorNumElements();
++      case Type::FixedVectorTyID: {
++        VectorType* vect_type = dyn_cast<VectorType>(arg->getType());
++        Type* elt_type = vect_type->getElementType();
++        int vec_num = vect_type->getNumElements();
+         bool sign = false;
+
+         if (vec_num != slot.state.vector_n) {
+--- backend/src/llvm/llvm_profiling.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_profiling.cpp	2020-11-09 18:59:50.120929150 +0100
+@@ -35,7 +35,6 @@
+ #include "llvm/IR/IRBuilder.h"
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #else
+ #include "llvm/Support/CallSite.h"
+--- backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 17:01:09.407774832 +0100
+@@ -45,8 +45,8 @@
+     bool visitCallInst(CallInst *I) {
+       if(!I)
+         return false;
+-      Value *Callee = I->getCalledValue();
+-      const std::string fnName = Callee->getName();
++      Value *Callee = I->getCalledOperand();
++      const std::string fnName = Callee->getName().str();
+       bool changed = false;
+       Type *boolTy = IntegerType::get(I->getContext(), 1);
+       Type *i32Ty = IntegerType::get(I->getContext(), 32);
+@@ -59,7 +59,7 @@
+         Value *needFixVal;
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+@@ -113,7 +113,7 @@
+         Value *needFixVal;
+  #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+--- backend/src/llvm/llvm_scalarize.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_scalarize.cpp	2020-11-09 18:51:16.888990104 +0100
+@@ -178,7 +178,7 @@
+       if(!type)
+         return type;
+       switch(type->getTypeID()) {
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       case Type::ArrayTyID:
+         return GetBasicType(type->getContainedType(0));
+       default:
+@@ -188,7 +188,7 @@
+     }
+
+     int GetComponentCount(const Type* type)  {
+-      if (type && type->getTypeID() == Type::VectorTyID)
++      if (type && type->getTypeID() == Type::FixedVectorTyID)
+         return llvm::dyn_cast<VectorType>(type)->getNumElements();
+       else
+         return 1;
+@@ -652,13 +652,12 @@
+           break;
+         }
+       } else {
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(call);
+-        CallSite::arg_iterator CI = CS.arg_begin() + 1;
++        User::op_iterator CI = call->arg_begin() + 1;
+
+         switch (genIntrinsicID) {
+           case GEN_OCL_NOT_FOUND:
+@@ -729,7 +728,7 @@
+             extractFromVector(call);
+             break;
+           case GEN_OCL_PRINTF:
+-            for (; CI != CS.arg_end(); ++CI)
++            for (; CI != call->arg_end(); ++CI)
+               if ((*CI)->getType()->isVectorTy())
+                 *CI = InsertToVector(call, *CI);
+             break;
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index a7b6dff107f..e37102ce14f 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=8
+revision=9
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From ac2b1aa3b14ff877264e6ff13e4846fed29cf248 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 20:11:17 +0100
Subject: [PATCH 23/24] discord: rebuild for libcxx-11.0.0

---
 srcpkgs/discord/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/discord/template b/srcpkgs/discord/template
index a84b25f0300..f5f928abda2 100644
--- a/srcpkgs/discord/template
+++ b/srcpkgs/discord/template
@@ -1,7 +1,7 @@
 # Template file for 'discord'
 pkgname=discord
 version=0.0.12
-revision=2
+revision=3
 archs="x86_64"
 wrksrc="Discord"
 depends="alsa-lib dbus-glib gtk+3 libnotify nss libXtst libcxx libatomic"

From 3e462d567dec8c2faef3d25734fec92510769d4f Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 20:11:35 +0100
Subject: [PATCH 24/24] discord-ptb: rebuild for libcxx-11.0.0

---
 srcpkgs/discord-ptb/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/discord-ptb/template b/srcpkgs/discord-ptb/template
index 867ba7e5dca..a3bed95d8c1 100644
--- a/srcpkgs/discord-ptb/template
+++ b/srcpkgs/discord-ptb/template
@@ -1,7 +1,7 @@
 # Template file for 'discord-ptb'
 pkgname=discord-ptb
 version=0.0.22
-revision=1
+revision=2
 archs="x86_64"
 wrksrc="DiscordPTB"
 hostmakedepends="w3m"

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (24 preceding siblings ...)
  2020-11-09 19:11 ` Snektron
@ 2020-11-09 19:52 ` Snektron
  2020-11-09 20:03 ` Snektron
                   ` (6 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 19:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 165889 bytes --]

From 52a260f4a9e961424a92fcb30c1c604b4232730c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:10 +0100
Subject: [PATCH 01/22] new package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 ...h~b2110e270 (codelite: rebuild for llvm11) |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 747 insertions(+), 13 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index 12ade7a11ac..ef2400dd2ef 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11) b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
new file mode 100644
index 00000000000..5be8de4f068
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)	
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -153,7 +153,7 @@
+
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From a0da2fbf82386b9dd4590287edcc9190ad3b621b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:23 +0100
Subject: [PATCH 02/22] llvm: update to 11.0.0

---
 srcpkgs/llvm/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 6d16e98f895e340e826ae160519639af739f92c3 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 03/22] llvm10: rebuild standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 5ce860e47ae647dee6f12a85d444bb28d06c5b17 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 04/22] llvm-libunwind: update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 855b1e78b094003cf20534ba521882813117a3c2 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 05/22] libcxxabi: update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From ecc37be2127da750ee3f8584070301903fa2b56a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 06/22] libcxx: update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From b79366c5e56f25ce3af534fc635ed2223cba2671 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 07/22] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From 55dfbbe344a6c0fe74cc1f63f1642675eede0932 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 08/22] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 72a1716259d16440ce5b23c8ccbaa6c73756d6a4 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 09/22] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 247ae03fcafbe7145fca4180e0421776be654a96 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 10/22] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From 9039929902d69eaf6637558913ae4f9402f6c7a5 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 11/22] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From 8cd2e2026b0c14c8bdbf6534ad6208a865b4444b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 12/22] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 2d21d4b84717cb66b15e782e494afba7c04ccd52 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 13/22] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From 03aaa6306dc2c3184b476937d65c37eab8d81d09 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 14/22] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From 9365a6f16f079b600b39c34114aee1209a34b670 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 15/22] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From b674578c892fd01168126d3fe3d7da5d3ad2171b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 16/22] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index 1eb6d9bafc7..35a73955e11 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20201025
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From d871410d6f50cef031983657ceaaf75846c8e208 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 17/22] ispc: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

From 80806fcc24c0b3fb9134225af392ca2b888796bf Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:24:20 +0100
Subject: [PATCH 18/22] zig: update to 0.7.0

---
 srcpkgs/zig/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index e34d6471728..727a675383a 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,16 +1,16 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.6.0
-revision=2
+version=0.7.0
+revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
-makedepends="clang llvm10 lld-devel"
+makedepends="clang llvm11 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="MIT"
 homepage="https://ziglang.org/"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204
+checksum=0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83
 nopie=yes
 nocross=yes
 

From 1f0b5174e873d207778eebe336414e7e9212b866 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:41:53 +0100
Subject: [PATCH 19/22] clazy: rebuild for llvm11

---
 .../files/clazy-001-llvm11-stringref.patch    | 343 ++++++++++++++++++
 .../files/clazy-002-llvm11-stringref.patch    |  28 ++
 srcpkgs/clazy/template                        |   8 +-
 3 files changed, 378 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch

diff --git a/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..48049fa594a
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
@@ -0,0 +1,343 @@
+From 30d6a2b64f5a05722fdc5d8e3754dbf13425cd62 Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Thu, 4 Jun 2020 17:10:21 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+Also included header file clang/Basic/FileManager.h in src/MiniDumper
+because without this header, class clang::FileEntry in incomplete class
+---
+ src/FixItExporter.cpp                                 | 5 +++--
+ src/MiniAstDumper.cpp                                 | 1 +
+ src/Utils.cpp                                         | 2 +-
+ src/checkbase.cpp                                     | 2 +-
+ src/checks/detachingbase.cpp                          | 2 +-
+ src/checks/level0/qenums.cpp                          | 2 +-
+ src/checks/level0/qt-macros.cpp                       | 4 ++--
+ src/checks/level0/unused-non-trivial-variable.cpp     | 2 +-
+ src/checks/level1/detaching-temporary.cpp             | 2 +-
+ src/checks/level1/non-pod-global-static.cpp           | 2 +-
+ src/checks/level1/qproperty-without-notify.cpp        | 2 +-
+ src/checks/level2/missing-typeinfo.cpp                | 2 +-
+ src/checks/level2/old-style-connect.cpp               | 6 +++---
+ src/checks/level2/rule-of-three.cpp                   | 2 +-
+ src/checks/manuallevel/ifndef-define-typo.cpp         | 6 +++---
+ src/checks/manuallevel/qproperty-type-mismatch.cpp    | 2 +-
+ src/checks/manuallevel/qrequiredresult-candidates.cpp | 2 +-
+ src/checks/manuallevel/qt-keywords.cpp                | 4 ++--
+ src/checks/manuallevel/reserve-candidates.cpp         | 3 ++-
+ 19 files changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/src/FixItExporter.cpp b/src/FixItExporter.cpp
+index f3af2e54..44240cf5 100644
+--- a/src/FixItExporter.cpp
++++ b/src/FixItExporter.cpp
+@@ -68,7 +68,7 @@ void FixItExporter::BeginSourceFile(const LangOptions &LangOpts, const Preproces
+ 
+     const auto id = SourceMgr.getMainFileID();
+     const auto entry = SourceMgr.getFileEntryForID(id);
+-    getTuDiag().MainSourceFile = entry->getName();
++    getTuDiag().MainSourceFile = static_cast<std::string>(entry->getName());
+ }
+ 
+ bool FixItExporter::IncludeInDiagnosticCounts() const
+@@ -89,7 +89,8 @@ tooling::Diagnostic FixItExporter::ConvertDiagnostic(const Diagnostic &Info)
+     // TODO: This returns an empty string: DiagEngine->getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
+     // HACK: capture it at the end of the message: Message text [check-name]
+ 
+-    std::string checkName = DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
++    std::string checkName =
++        static_cast<std::string>(DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID()));
+     std::string messageText;
+ 
+     if (checkName.empty()) {
+diff --git a/src/MiniAstDumper.cpp b/src/MiniAstDumper.cpp
+index 47661749..6124e6e8 100644
+--- a/src/MiniAstDumper.cpp
++++ b/src/MiniAstDumper.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <clang/Frontend/CompilerInstance.h>
+ #include <clang/Frontend/FrontendPluginRegistry.h>
++#include <clang/Basic/FileManager.h>
+ 
+ using namespace clang;
+ using namespace std;
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index 001ced98..b0812fe3 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -878,7 +878,7 @@ string Utils::filenameForLoc(SourceLocation loc, const clang::SourceManager &sm)
+     if (loc.isMacroID())
+         loc = sm.getExpansionLoc(loc);
+ 
+-    const string filename = sm.getFilename(loc);
++    const string filename = static_cast<std::string>(sm.getFilename(loc));
+     auto splitted = clazy::splitString(filename, '/');
+     if (splitted.empty())
+         return {};
+diff --git a/src/checkbase.cpp b/src/checkbase.cpp
+index 8b40e19d..22a426cf 100644
+--- a/src/checkbase.cpp
++++ b/src/checkbase.cpp
+@@ -188,7 +188,7 @@ bool CheckBase::shouldIgnoreFile(SourceLocation loc) const
+     if (!loc.isValid())
+         return true;
+ 
+-    string filename = sm().getFilename(loc);
++    string filename = static_cast<std::string>(sm().getFilename(loc));
+ 
+     return clazy::any_of(m_filesToIgnore, [filename](const std::string &ignored) {
+         return clazy::contains(filename, ignored);
+diff --git a/src/checks/detachingbase.cpp b/src/checks/detachingbase.cpp
+index 70311f42..1b094ee7 100644
+--- a/src/checks/detachingbase.cpp
++++ b/src/checks/detachingbase.cpp
+@@ -57,7 +57,7 @@ bool DetachingBase::isDetachingMethod(CXXMethodDecl *method, DetachingMethodType
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = detachingMethodType == DetachingMethod ? clazy::detachingMethods()
+                                                                                                                      : clazy::detachingMethodsWithConstCounterParts();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     if (it != methodsByType.cend()) {
+         const auto &methods = it->second;
+         if (clazy::contains(methods, clazy::name(method)))
+diff --git a/src/checks/level0/qenums.cpp b/src/checks/level0/qenums.cpp
+index 00075b5c..db8910f2 100644
+--- a/src/checks/level0/qenums.cpp
++++ b/src/checks/level0/qenums.cpp
+@@ -59,7 +59,7 @@ void QEnums::VisitMacroExpands(const Token &MacroNameTok, const SourceRange &ran
+         // We simply check if :: is present because it's very cumbersome to to check for different classes when dealing with the pre-processor
+ 
+         CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+-        string text = Lexer::getSourceText(crange, sm(), lo());
++        string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+         if (clazy::contains(text, "::"))
+             return;
+     }
+diff --git a/src/checks/level0/qt-macros.cpp b/src/checks/level0/qt-macros.cpp
+index d3a587cb..ab8e9f52 100644
+--- a/src/checks/level0/qt-macros.cpp
++++ b/src/checks/level0/qt-macros.cpp
+@@ -44,7 +44,7 @@ void QtMacros::VisitMacroDefined(const Token &MacroNameTok)
+         return;
+ 
+     IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
+-    if (ii && clazy::startsWith(ii->getName(), "Q_OS_"))
++    if (ii && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_"))
+         m_OSMacroExists = true;
+ }
+ 
+@@ -58,7 +58,7 @@ void QtMacros::checkIfDef(const Token &macroNameTok, SourceLocation Loc)
+     if (preProcessorVisitor && preProcessorVisitor->qtVersion() < 51204 && ii->getName() == "Q_OS_WINDOWS") {
+         // Q_OS_WINDOWS was introduced in 5.12.4
+         emitWarning(Loc, "Q_OS_WINDOWS was only introduced in Qt 5.12.4, use Q_OS_WIN instead");
+-    } else if (!m_OSMacroExists && clazy::startsWith(ii->getName(), "Q_OS_")) {
++    } else if (!m_OSMacroExists && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_")) {
+         emitWarning(Loc, "Include qglobal.h before testing Q_OS_ macros");
+     }
+ }
+diff --git a/src/checks/level0/unused-non-trivial-variable.cpp b/src/checks/level0/unused-non-trivial-variable.cpp
+index 4e4b8303..93815f27 100644
+--- a/src/checks/level0/unused-non-trivial-variable.cpp
++++ b/src/checks/level0/unused-non-trivial-variable.cpp
+@@ -91,7 +91,7 @@ bool UnusedNonTrivialVariable::isUninterestingType(const CXXRecordDecl *record)
+     static const vector<StringRef> blacklistedTemplates = { "QScopedPointer", "QSetValueOnDestroy", "QScopedValueRollback" };
+     StringRef className = clazy::name(record);
+     for (StringRef templateName : blacklistedTemplates) {
+-        if (clazy::startsWith(className, templateName))
++        if (clazy::startsWith(static_cast<std::string>(className), static_cast<std::string>(templateName)))
+             return true;
+     }
+ 
+diff --git a/src/checks/level1/detaching-temporary.cpp b/src/checks/level1/detaching-temporary.cpp
+index fedfc81c..60c75532 100644
+--- a/src/checks/level1/detaching-temporary.cpp
++++ b/src/checks/level1/detaching-temporary.cpp
+@@ -140,7 +140,7 @@ void DetachingTemporary::VisitStmt(clang::Stmt *stm)
+     StringRef className = clazy::name(classDecl);
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = clazy::detachingMethods();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     auto it2 = m_writeMethodsByType.find(className);
+ 
+     std::vector<StringRef> allowedFunctions;
+diff --git a/src/checks/level1/non-pod-global-static.cpp b/src/checks/level1/non-pod-global-static.cpp
+index 5879bff8..433b5c5f 100644
+--- a/src/checks/level1/non-pod-global-static.cpp
++++ b/src/checks/level1/non-pod-global-static.cpp
+@@ -74,7 +74,7 @@ void NonPodGlobalStatic::VisitStmt(clang::Stmt *stm)
+     const SourceLocation declStart = clazy::getLocStart(varDecl);
+ 
+     if (declStart.isMacroID()) {
+-        auto macroName = Lexer::getImmediateMacroName(declStart, sm(), lo());
++        auto macroName = static_cast<std::string>(Lexer::getImmediateMacroName(declStart, sm(), lo()));
+         if (clazy::startsWithAny(macroName, { "Q_IMPORT_PLUGIN", "Q_CONSTRUCTOR_FUNCTION", "Q_DESTRUCTOR_FUNCTION"})) // Don't warn on these
+             return;
+     }
+diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp
+index e1d6db4a..3af9fee2 100644
+--- a/src/checks/level1/qproperty-without-notify.cpp
++++ b/src/checks/level1/qproperty-without-notify.cpp
+@@ -69,7 +69,7 @@ void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok,
+         return;
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/level2/missing-typeinfo.cpp b/src/checks/level2/missing-typeinfo.cpp
+index 98df2cd4..03b44e06 100644
+--- a/src/checks/level2/missing-typeinfo.cpp
++++ b/src/checks/level2/missing-typeinfo.cpp
+@@ -74,7 +74,7 @@ void MissingTypeInfo::VisitDecl(clang::Decl *decl)
+         if (sm().isInSystemHeader(clazy::getLocStart(record)))
+             return;
+ 
+-        std::string typeName = clazy::name(record);
++        std::string typeName = static_cast<std::string>(clazy::name(record));
+         if (typeName == "QPair") // QPair doesn't use Q_DECLARE_TYPEINFO, but rather a explicit QTypeInfo.
+             return;
+ 
+diff --git a/src/checks/level2/old-style-connect.cpp b/src/checks/level2/old-style-connect.cpp
+index 0fe68c13..396cb703 100644
+--- a/src/checks/level2/old-style-connect.cpp
++++ b/src/checks/level2/old-style-connect.cpp
+@@ -274,7 +274,7 @@ void OldStyleConnect::VisitMacroExpands(const Token &macroNameTok, const SourceR
+         return;
+ 
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(Q_PRIVATE_SLOT\s*\((.*)\s*,\s*.*\s+(.*)\(.*)");
+     smatch match;
+@@ -293,7 +293,7 @@ string OldStyleConnect::signalOrSlotNameFromMacro(SourceLocation macroLoc)
+     CharSourceRange expansionRange = clazy::getImmediateExpansionRange(macroLoc, sm());
+     SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(\s*(SIGNAL|SLOT)\s*\(\s*(.+)\s*\(.*)");
+ 
+@@ -315,7 +315,7 @@ bool OldStyleConnect::isSignalOrSlot(SourceLocation loc, string &macroName) cons
+     if (!loc.isMacroID() || loc.isInvalid())
+         return false;
+ 
+-    macroName = Lexer::getImmediateMacroName(loc, sm(), lo());
++    macroName = static_cast<std::string>(Lexer::getImmediateMacroName(loc, sm(), lo()));
+     return macroName == "SIGNAL" || macroName == "SLOT";
+ }
+ 
+diff --git a/src/checks/level2/rule-of-three.cpp b/src/checks/level2/rule-of-three.cpp
+index 8db55d53..7583fcc5 100644
+--- a/src/checks/level2/rule-of-three.cpp
++++ b/src/checks/level2/rule-of-three.cpp
+@@ -140,7 +140,7 @@ void RuleOfThree::VisitDecl(clang::Decl *decl)
+ 
+     const string className = record->getNameAsString();
+     const string classQualifiedName = record->getQualifiedNameAsString();
+-    const string filename = sm().getFilename(recordStart);
++    const string filename = static_cast<std::string>(sm().getFilename(recordStart));
+     if (clazy::endsWith(className, "Private") && clazy::endsWithAny(filename, { ".cpp", ".cxx", "_p.h" }))
+         return; // Lots of RAII classes fall into this category. And even Private (d-pointer) classes, warning in that case would just be noise
+ 
+diff --git a/src/checks/manuallevel/ifndef-define-typo.cpp b/src/checks/manuallevel/ifndef-define-typo.cpp
+index edb6cdf4..e9c50a45 100644
+--- a/src/checks/manuallevel/ifndef-define-typo.cpp
++++ b/src/checks/manuallevel/ifndef-define-typo.cpp
+@@ -44,7 +44,7 @@ void IfndefDefineTypo::VisitMacroDefined(const Token &macroNameTok)
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -53,7 +53,7 @@ void IfndefDefineTypo::VisitDefined(const Token &macroNameTok, const SourceRange
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -66,7 +66,7 @@ void IfndefDefineTypo::VisitIfdef(SourceLocation, const Token &)
+ void IfndefDefineTypo::VisitIfndef(SourceLocation, const Token &macroNameTok)
+ {
+     if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo())
+-        m_lastIfndef = ii->getName();
++        m_lastIfndef = static_cast<std::string>(ii->getName());
+ }
+ 
+ void IfndefDefineTypo::VisitIf(SourceLocation, SourceRange, PPCallbacks::ConditionValueKind)
+diff --git a/src/checks/manuallevel/qproperty-type-mismatch.cpp b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+index f91159cb..952d9f1d 100644
+--- a/src/checks/manuallevel/qproperty-type-mismatch.cpp
++++ b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+@@ -237,7 +237,7 @@ void QPropertyTypeMismatch::VisitMacroExpands(const clang::Token &MacroNameTok,
+ 
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (!text.empty() && text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/manuallevel/qrequiredresult-candidates.cpp b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+index 912dbaa0..6375bd7b 100644
+--- a/src/checks/manuallevel/qrequiredresult-candidates.cpp
++++ b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+@@ -65,7 +65,7 @@ void QRequiredResultCandidates::VisitDecl(clang::Decl *decl)
+ 
+ 
+     if (returnClass == classDecl) {
+-        const std::string methodName = clazy::name(method);
++        const std::string methodName = static_cast<std::string>(clazy::name(method));
+         if (methodName.empty()) // fixes assert
+             return;
+ 
+diff --git a/src/checks/manuallevel/qt-keywords.cpp b/src/checks/manuallevel/qt-keywords.cpp
+index e792e95a..b60752c9 100644
+--- a/src/checks/manuallevel/qt-keywords.cpp
++++ b/src/checks/manuallevel/qt-keywords.cpp
+@@ -59,12 +59,12 @@ void QtKeywords::VisitMacroExpands(const Token &macroNameTok, const SourceRange
+     }
+ 
+     static const vector<StringRef> keywords = { "foreach", "signals", "slots", "emit" };
+-    std::string name = ii->getName();
++    std::string name = static_cast<std::string>(ii->getName());
+     if (!clazy::contains(keywords, name))
+         return;
+ 
+     // Make sure the macro is Qt's. It must be defined in Qt's headers, not 3rdparty
+-    std::string qtheader = sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc()));
++    std::string qtheader = static_cast<std::string>(sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc())));
+     if (!clazy::endsWith(qtheader, "qglobal.h") && !clazy::endsWith(qtheader, "qobjectdefs.h"))
+         return;
+ 
+diff --git a/src/checks/manuallevel/reserve-candidates.cpp b/src/checks/manuallevel/reserve-candidates.cpp
+index 389cac5a..92e4491c 100644
+--- a/src/checks/manuallevel/reserve-candidates.cpp
++++ b/src/checks/manuallevel/reserve-candidates.cpp
+@@ -78,7 +78,8 @@ static bool isCandidateMethod(CXXMethodDecl *methodDecl)
+     if (!classDecl)
+         return false;
+ 
+-    if (!clazy::equalsAny(clazy::name(methodDecl), { "append", "push_back", "push", "operator<<", "operator+=" }))
++    if (!clazy::equalsAny(static_cast<std::string>(clazy::name(methodDecl)),
++                 { "append", "push_back", "push", "operator<<", "operator+=" }))
+         return false;
+ 
+     if (!clazy::isAReserveClass(classDecl))
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
new file mode 100644
index 00000000000..28cbb60b091
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
@@ -0,0 +1,28 @@
+From 25aa102cc49def9573ffbed88155589cd60a2e8f Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Fri, 5 Jun 2020 16:52:53 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10 (clazy-standalone)
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+---
+ src/checks/manuallevel/jnisignatures.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/checks/manuallevel/jnisignatures.cpp b/src/checks/manuallevel/jnisignatures.cpp
+index 81e61d48..5d4fe203 100644
+--- a/src/checks/manuallevel/jnisignatures.cpp
++++ b/src/checks/manuallevel/jnisignatures.cpp
+@@ -103,7 +103,7 @@ void JniSignatures::checkFunctionCall(Stmt *stm)
+         return;
+     }
+ 
+-    const std::string name = clazy::name(funDecl);
++    const std::string name = static_cast<std::string>(clazy::name(funDecl));
+ 
+     if (name == "callObjectMethod" || name == "callMethod") {
+         checkArgAt(callExpr, 0, methodNameRegex, "Invalid method name");
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 4d8557be669..5af2b918e14 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.7
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"
@@ -12,3 +12,9 @@ homepage="https://cgit.kde.org/clazy.git/about/"
 distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
 checksum=754da5815f769dd6b72a040a2430525c93f294eb7769c78271603df9614f1b21
 nocross="Clang cannot be installed as makedep"
+
+post_extract() {
+	for i in ${FILESDIR}/clazy-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}

From 707f6512d487fee86031eb7e189df1eccc27e175 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 15:19:37 +0100
Subject: [PATCH 20/22] include-what-you-use: rebuild for llvm11

---
 ...de-what-you-use-001-llvm11-stringref.patch | 146 ++++++++++++++++++
 ...ude-what-you-use-002-clang-astdumper.patch |  54 +++++++
 srcpkgs/include-what-you-use/template         |   8 +-
 3 files changed, 207 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch

diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..171dca28e34
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
@@ -0,0 +1,146 @@
+From 53487d209729d5781007dc0fd6076dc585cb3727 Mon Sep 17 00:00:00 2001
+From: Andrea Bocci <andrea.bocci@cern.ch>
+Date: Fri, 28 Feb 2020 17:45:03 +0100
+Subject: [PATCH] Add explicit conversion from llvm::StringRef to std::string
+
+llvm/llvm-project@777180a makes the llvm::StringRef conversion operator
+to std::string explicit.
+These changes add a call to the str() method to perform the conversion.
+
+Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
+---
+ iwyu_driver.cc       | 2 +-
+ iwyu_globals.cc      | 4 ++--
+ iwyu_lexer_utils.cc  | 2 +-
+ iwyu_location_util.h | 2 +-
+ iwyu_output.cc       | 2 +-
+ iwyu_path_util.cc    | 6 +++---
+ iwyu_preprocessor.cc | 4 ++--
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/iwyu_driver.cc b/iwyu_driver.cc
+index bd163144..42fea35b 100644
+--- a/iwyu_driver.cc
++++ b/iwyu_driver.cc
+@@ -79,7 +79,7 @@ std::string GetExecutablePath(const char *Argv0) {
+ }
+ 
+ const char *SaveStringInSet(std::set<std::string> &SavedStrings, StringRef S) {
+-  return SavedStrings.insert(S).first->c_str();
++  return SavedStrings.insert(S.str()).first->c_str();
+ }
+ 
+ void ExpandArgsFromBuf(const char *Arg,
+diff --git a/iwyu_globals.cc b/iwyu_globals.cc
+index 0f58b4dc..26998966 100644
+--- a/iwyu_globals.cc
++++ b/iwyu_globals.cc
+@@ -293,7 +293,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+   for (auto it = header_search->system_dir_begin();
+        it != header_search->system_dir_end(); ++it) {
+     if (const DirectoryEntry* entry = it->getDir()) {
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map[path] = HeaderSearchPath::kSystemPath;
+     }
+   }
+@@ -303,7 +303,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+       // search_dir_begin()/end() includes both system and user paths.
+       // If it's a system path, it's already in the map, so everything
+       // new is a user path.  The insert only 'takes' for new entries.
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map.insert(make_pair(path, HeaderSearchPath::kUserPath));
+     }
+   }
+diff --git a/iwyu_lexer_utils.cc b/iwyu_lexer_utils.cc
+index fcea2d28..648c9da8 100644
+--- a/iwyu_lexer_utils.cc
++++ b/iwyu_lexer_utils.cc
+@@ -70,7 +70,7 @@ SourceLocation GetLocationAfter(
+ string GetIncludeNameAsWritten(
+     SourceLocation include_loc,
+     const CharacterDataGetterInterface& data_getter) {
+-  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter);
++  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter).str();
+   if (data.empty())
+     return data;
+   string::size_type endpos = string::npos;
+diff --git a/iwyu_location_util.h b/iwyu_location_util.h
+index 3892a424..6f8cf81c 100644
+--- a/iwyu_location_util.h
++++ b/iwyu_location_util.h
+@@ -89,7 +89,7 @@ bool IsInScratchSpace(clang::SourceLocation loc);
+ 
+ inline string GetFilePath(const clang::FileEntry* file) {
+   return (IsBuiltinFile(file) ? "<built-in>" :
+-          NormalizeFilePath(file->getName()));
++          NormalizeFilePath(file->getName().str()));
+ }
+ 
+ //------------------------------------------------------------
+diff --git a/iwyu_output.cc b/iwyu_output.cc
+index ca145710..8666c26c 100644
+--- a/iwyu_output.cc
++++ b/iwyu_output.cc
+@@ -168,7 +168,7 @@ string GetKindName(const clang::TagDecl* tag_decl) {
+   if (const FakeNamedDecl* fake = FakeNamedDeclIfItIsOne(named_decl)) {
+     return fake->kind_name();
+   }
+-  return tag_decl->getKindName();
++  return tag_decl->getKindName().str();
+ }
+ 
+ string GetQualifiedNameAsString(const clang::NamedDecl* named_decl) {
+diff --git a/iwyu_path_util.cc b/iwyu_path_util.cc
+index ab4fc800..9987ea47 100644
+--- a/iwyu_path_util.cc
++++ b/iwyu_path_util.cc
+@@ -134,7 +134,7 @@ string NormalizeFilePath(const string& path) {
+   std::replace(normalized.begin(), normalized.end(), '\\', '/');
+ #endif
+ 
+-  return normalized.str();
++  return normalized.str().str();
+ }
+ 
+ string NormalizeDirPath(const string& path) {
+@@ -154,14 +154,14 @@ string MakeAbsolutePath(const string& path) {
+   std::error_code error = llvm::sys::fs::make_absolute(absolute_path);
+   CHECK_(!error);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string MakeAbsolutePath(const string& base_path, const string& relative_path) {
+   llvm::SmallString<128> absolute_path(base_path);
+   llvm::sys::path::append(absolute_path, relative_path);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string GetParentPath(const string& path) {
+diff --git a/iwyu_preprocessor.cc b/iwyu_preprocessor.cc
+index 58e78595..88b93144 100644
+--- a/iwyu_preprocessor.cc
++++ b/iwyu_preprocessor.cc
+@@ -313,7 +313,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+       break;
+     }
+     const string filename = GetSourceTextUntilEndOfLine(current_loc,
+-                                                        DefaultDataGetter());
++                                                        DefaultDataGetter()).str();
+     // Use "" or <> based on where the file lives.
+     string quoted_private_include;
+     if (IsSystemIncludeFile(GetFilePath(current_loc)))
+@@ -332,7 +332,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+     }
+ 
+     string after_text = GetSourceTextUntilEndOfLine(current_loc,
+-                                                    DefaultDataGetter());
++                                                    DefaultDataGetter()).str();
+     const string::size_type close_brace_pos = after_text.find('}');
+     if (close_brace_pos == string::npos) {
+       Warn(current_loc, "@headername directive missing a closing brace");
diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
new file mode 100644
index 00000000000..663a883fa91
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
@@ -0,0 +1,54 @@
+From 30549c6931972456d1e09ff5dbeecd258a8df72b Mon Sep 17 00:00:00 2001
+From: Kim Grasman <kim.grasman@gmail.com>
+Date: Thu, 9 Jul 2020 18:47:56 +0200
+Subject: [PATCH] Implement Stmt printing with ASTDumper
+
+The Clang API changed in commit 473fbc90d1fbf17e so that Stmt::dump
+takes an ASTContext instead of a SourceManager.
+
+Rather than wire a global ASTContext, reimplement PrintableStmt and
+PrintStmt to duplicate the most trivial implementations not requiring
+ASTContext.
+
+No functional change.
+---
+ iwyu_ast_util.cc | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/iwyu_ast_util.cc b/iwyu_ast_util.cc
+index d3d4dd1f..b19a11fb 100644
+--- a/iwyu_ast_util.cc
++++ b/iwyu_ast_util.cc
+@@ -25,6 +25,7 @@
+ #include "llvm/Support/Casting.h"
+ #include "llvm/Support/raw_ostream.h"
+ #include "clang/AST/ASTContext.h"
++#include "clang/AST/ASTDumper.h"
+ #include "clang/AST/CanonicalType.h"
+ #include "clang/AST/Decl.h"
+ #include "clang/AST/DeclBase.h"
+@@ -46,6 +47,7 @@ namespace clang {
+ class FileEntry;
+ }  // namespace clang
+ 
++using clang::ASTDumper;
+ using clang::BlockPointerType;
+ using clang::CXXConstructExpr;
+ using clang::CXXConstructorDecl;
+@@ -450,12 +452,14 @@ string PrintableDecl(const Decl* decl, bool terse/*=true*/) {
+ string PrintableStmt(const Stmt* stmt) {
+   std::string buffer;
+   raw_string_ostream ostream(buffer);
+-  stmt->dump(ostream, *GlobalSourceManager());
++  ASTDumper dumper(ostream, /*ShowColors=*/false);
++  dumper.Visit(stmt);
+   return ostream.str();
+ }
+ 
+ void PrintStmt(const Stmt* stmt) {
+-  stmt->dump(*GlobalSourceManager());  // This prints to errs().
++  ASTDumper dumper(llvm::errs(), /*ShowColors=*/false);
++  dumper.Visit(stmt);
+ }
+ 
+ string PrintableType(const Type* type) {
diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 22c9d09d091..3811309bdde 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.14
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
@@ -15,6 +15,12 @@ distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.
 checksum=43184397db57660c32e3298a6b1fd5ab82e808a1f5ab0591d6745f8d256200ef
 python_version=3
 
+post_extract() {
+	for i in ${FILESDIR}/include-what-you-use-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
+
 post_install() {
 	vlicense LICENSE.TXT
 }

From f932b52169f6a182b2e3645017e70bff9e00016c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 16:17:54 +0100
Subject: [PATCH 21/22] bpftrace: update to 0.11.2

---
 ...trace-001-six-args-bpf_attach_uprobe.patch | 126 +++++++++++++++
 ...ace-002-seven-args-bpf_attach_uprobe.patch | 148 ++++++++++++++++++
 srcpkgs/bpftrace/template                     |  10 +-
 3 files changed, 282 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch

diff --git a/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..e2b1ad1351b
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
@@ -0,0 +1,126 @@
+From 52fb793c6423c19696e07cc14ad5f9182f7eca0e Mon Sep 17 00:00:00 2001
+From: Viktor Malik <viktor.malik@gmail.com>
+Date: Wed, 12 Aug 2020 09:45:29 +0200
+Subject: [PATCH] Feature-detect bpf_attach_kprobe signature
+
+The function has 6 parameters in current versions of BCC and 5
+parameters in older versions.
+
+This is detected in CMake using CHECK_CXX_SOURCE_COMPILES. For static
+compilation, we also need to retrieve and link static libbpf, libelf,
+and libz. This may cause libbpf, libelf and libz to be searched for
+twice, but it should be fine since CMake caches results.
+
+Fixes iovisor#1027.
+---
+ cmake/FindLibBcc.cmake | 24 ++++++++++++++++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 31 ++++++++++++++-----------------
+ tests/CMakeLists.txt   |  3 +++
+ 4 files changed, 44 insertions(+), 17 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 9d30b04bc..ec216271d 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -70,3 +70,27 @@ include (FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBcc "Please install the bcc library package, which is required. Depending on your distro, it may be called bpfcclib or bcclib (Ubuntu), bcc-devel (Fedora), or something else. If unavailable, install bcc from source (github.com/iovisor/bcc)."
+   LIBBCC_LIBRARIES
+   LIBBCC_INCLUDE_DIRS)
++
++# Check bpf_attach_kprobe signature
++if(${LIBBCC_FOUND})
++if(STATIC_LINKING)
++  # libbcc.a is not statically linked with libbpf.a, libelf.a, and libz.a.
++  # If we do a static bpftrace build, we must link them in.
++  find_package(LibBpf)
++  find_package(LibElf)
++  find_package(LibZ)
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_BPF_LIBRARY_STATIC} ${LIBBPF_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBZ_LIBRARIES})
++else()
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_LIBRARIES})
++endif()
++INCLUDE(CheckCXXSourceCompiles)
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_kprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++SET(CMAKE_REQUIRED_LIBRARIES)
++endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 647a23f1c..448a045fc 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -80,6 +80,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 587a11576..afad9ed18 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -754,26 +754,23 @@ void AttachedProbe::load_prog()
+   }
+ }
+ 
+-// XXX(mmarchini): bcc changed the signature of bpf_attach_kprobe, adding a new
+-// int parameter at the end. Since there's no reliable way to feature-detect
+-// this, we create a function pointer with the long signature and cast
+-// bpf_attach_kprobe to this function pointer. If we're on an older bcc
+-// version, bpf_attach_kprobe call will be augmented with an extra register
+-// being used for the last parameter, even though this register won't be used
+-// inside the function. Since the register won't be used this is kinda safe,
+-// although not ideal.
+-typedef int (*attach_probe_wrapper_signature)(int, enum bpf_probe_attach_type, const char*, const char*, uint64_t, int);
+-
+ void AttachedProbe::attach_kprobe(bool safe_mode)
+ {
+   resolve_offset_kprobe(safe_mode);
+-  int perf_event_fd = cast_signature<attach_probe_wrapper_signature>(
+-      &bpf_attach_kprobe)(progfd_,
+-                          attachtype(probe_.type),
+-                          eventname().c_str(),
+-                          probe_.attach_point.c_str(),
+-                          offset_,
+-                          0);
++#ifdef LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_,
++                                        0);
++#else
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_);
++#endif
+ 
+   if (perf_event_fd < 0) {
+     if (probe_.orig_name != probe_.name) {
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 3688b8487..84daeb2aa 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -102,6 +102,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace_test ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..2cc55c86555
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
@@ -0,0 +1,148 @@
+From c7dbab451484b96178da1a8c43330154ce4c9d7a Mon Sep 17 00:00:00 2001
+From: Daniel Xu <dxu@dxuuu.xyz>
+Date: Wed, 14 Oct 2020 17:09:46 -0700
+Subject: [PATCH] Detect 7 arg bpf_attach_uprobe() API
+
+The 7th arg allows us to specify the usdt semaphore location.
+---
+ cmake/FindLibBcc.cmake | 11 +++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 42 ++++++++++++++++++++++++++++++++++--------
+ src/main.cpp           |  6 ++++++
+ tests/CMakeLists.txt   |  3 +++
+ 5 files changed, 57 insertions(+), 8 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 4c09a8ca2..92cedab5e 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -7,6 +7,8 @@
+ #  LIBBCC_DEFINITIONS - Compiler switches required for using libbcc
+ #  LIBBCC_BPF_LIBRARY_STATIC - libbpf static library (for static compilation)
+ #  LIBBCC_LOADER_LIBRARY_STATIC - libbcc helper static library (for static compilation)
++#  LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++#  LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ #
+ # Note that the shared libbcc binary has libbpf and bcc_loader already compiled in but
+ # the static doesn't. So when creating a static build those have to be included too.
+@@ -94,6 +96,15 @@ int main(void) {
+   return 0;
+ }
+ " LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_uprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ SET(CMAKE_REQUIRED_INCLUDES)
+ endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 9162356e3..cef94d144 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -88,6 +88,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 93fbfa876..a5d8bc56d 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -698,12 +698,23 @@ void AttachedProbe::attach_uprobe(bool safe_mode)
+ {
+   resolve_offset_uprobe(safe_mode);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_,
+-                                        attachtype(probe_.type),
+-                                        eventname().c_str(),
+-                                        probe_.path.c_str(),
+-                                        offset_,
+-                                        probe_.pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+     throw std::runtime_error("Error attaching probe: " + probe_.name);
+@@ -812,8 +823,23 @@ void AttachedProbe::attach_usdt(int pid)
+ 
+   offset_ = resolve_offset(probe_.path, probe_.attach_point, probe_.loc);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_, attachtype(probe_.type),
+-      eventname().c_str(), probe_.path.c_str(), offset_, pid == 0 ? -1 : pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+   {
+diff --git a/src/main.cpp b/src/main.cpp
+index 48fcf5aa0..09f4d9677 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -162,6 +162,12 @@ static int info()
+             << "yes" << std::endl;
+ #else
+             << "no" << std::endl;
++#endif
++  std::cerr << "  bcc bpf_attach_uprobe refcount: "
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++            << "yes" << std::endl;
++#else
++            << "no" << std::endl;
+ #endif
+   std::cerr << "  libbpf: "
+ #ifdef HAVE_LIBBPF
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index ace5ff106..332eba2b5 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -116,6 +116,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index d8367fa5c03..44e6c174107 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,6 +1,6 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
-version=0.11.1
+version=0.11.2
 revision=1
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
@@ -12,7 +12,13 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="Apache-2.0"
 homepage="https://github.com/iovisor/bpftrace/"
 distfiles="https://github.com/iovisor/bpftrace/archive/v${version}.tar.gz"
-checksum=98efc9396451bc1a4f73378cec4755e07e7718cb5d698472606f5ffc2b9e48e8
+checksum=1f0fc30073547e3b285e1a373aa469bb18d3ba27f8c05f91016df0ca84f77f90
+
+post_extract() {
+	for i in ${FILESDIR}/bpftrace-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
 
 post_install() {
 	# clashes with bcc-tools

From 33c9bc04ccf3d1af0e58db890dc8d6c9443d0324 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 19:29:15 +0100
Subject: [PATCH 22/22] beignet: rebuild for llvm11

---
 srcpkgs/beignet/patches/llvm11.patch | 945 +++++++++++++++++++++++++++
 srcpkgs/beignet/template             |   2 +-
 2 files changed, 946 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/beignet/patches/llvm11.patch

diff --git a/srcpkgs/beignet/patches/llvm11.patch b/srcpkgs/beignet/patches/llvm11.patch
new file mode 100644
index 00000000000..9f328267698
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm11.patch
@@ -0,0 +1,945 @@
+Source: Snektron
+
+There were a few changes required for LLVM 11:
+* llvm::StringRef requires .str(), implicit conversion was removed
+* llvm::CallSite was removed, but the required methods are available on llvm::CallInst
+* VectorTyID was split into FixedVectorTyID and ScalableVectorTyID, FixedVectorTyID was used
+* CallInst::getCalledValue() was renamed to CallInst::getCalledOperand()
+* Implicit conversion from MaybeAlign to Align was removed, so MaybeAlign::valueOrOne was used instead.
+
+--- backend/src/llvm/StripAttributes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/StripAttributes.cpp	2020-11-09 19:04:19.641897141 +0100
+@@ -107,9 +107,8 @@
+        BB != E; ++BB) {
+     for (BasicBlock::iterator Inst = BB->begin(), E = BB->end();
+          Inst != E; ++Inst) {
+-      CallSite Call(&*Inst);
+-      if (Call)
+-        Call.setCallingConv(CallingConv::C);
++      if (CallInst* callInst = dyn_cast<CallInst>(&*Inst))
++        callInst->setCallingConv(CallingConv::C);
+     }
+   }
+
+--- backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 17:04:09.633753428 +0100
+@@ -98,7 +98,7 @@
+         if (callFunc && callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        std::string fnName = call->getCalledValue()->stripPointerCasts()->getName();
++        std::string fnName = call->getCalledOperand()->stripPointerCasts()->getName().str();
+
+         if (!MFS.insert(fnName).second) {
+           continue;
+--- backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 19:01:49.201915008 +0100
+@@ -45,7 +45,7 @@
+       return NULL;
+
+     /* This is a fake, to check the function bitcast is for block or not */
+-    std::string fnName = Fn->getName();
++    std::string fnName = Fn->getName().str();
+     if(fnName.find("_invoke") == std::string::npos)
+       return NULL;
+
+@@ -119,18 +119,18 @@
+       ParamTys.push_back(ty);
+     }
+     FunctionType* NewFT = FunctionType::get(Fn->getReturnType(), ParamTys, false);
+-    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName());
++    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName().str());
+     SmallVector<ReturnInst*, 8> Returns;
+
+     Function::arg_iterator NewFnArgIt = NewFn->arg_begin();
+     for (Function::arg_iterator I = Fn->arg_begin(), E = Fn->arg_end(); I != E; ++I) {
+-      std::string ArgName = I->getName();
++      std::string ArgName = I->getName().str();
+       NewFnArgIt->setName(ArgName);
+       VMap[&*I] = &(*NewFnArgIt++);
+     }
+     CloneFunctionInto(NewFn, Fn, VMap, /*ModuleLevelChanges=*/true, Returns);
+
+-    Fn->setName("__d" + Fn->getName());
++    Fn->setName("__d" + Fn->getName().str());
+     mod->getFunctionList().push_back(NewFn);
+     //mod->getOrInsertFunction(NewFn->getName(), NewFn->getFunctionType(),
+     //                         NewFn->getAttributes());
+@@ -147,7 +147,7 @@
+       argTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argBaseTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argTypeQuals.push_back(llvm::MDString::get(Context, ""));
+-      argNames.push_back(llvm::MDString::get(Context, I->getName()));
++      argNames.push_back(llvm::MDString::get(Context, I->getName().str()));
+     }
+
+     //If run to here, llvm version always > 3.9, add the version check just for build.
+@@ -198,7 +198,7 @@
+            * invoke pointer to store the index in the unit's block functions index.*/
+           Function *Fn = dyn_cast<Function>(bt->getOperand(0));
+
+-          std::string fnName = Fn->getName();
++          std::string fnName = Fn->getName().str();
+           int index = -1;
+           for(size_t i=0; i<unit.blockFuncs.size(); i++) {
+             if(unit.blockFuncs[i] == fnName) {
+@@ -241,7 +241,7 @@
+             //unnamed call function, parse the use to find the define of called function
+             SmallVector<Value*, 16> args(CI->op_begin(), CI->op_end()-1);
+
+-            Value *v = CI->getCalledValue();
++            Value *v = CI->getCalledOperand();
+             BitCastInst* bt = dyn_cast<BitCastInst>(v);
+             if(bt == NULL)
+               continue;
+@@ -316,7 +316,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+
+@@ -332,7 +332,7 @@
+           } else {
+             //handle enqueue_kernel function call
+             Function *fn = CI->getCalledFunction();
+-            if (fn->getName().find("enqueue_kernel") == std::string::npos)
++            if (fn->getName().str().find("enqueue_kernel") == std::string::npos)
+               continue;
+
+             //block parameter's index, 3 or 6
+@@ -361,7 +361,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+             } else if(isa<AllocaInst>(block)) {
+--- backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 18:33:50.919114327 +0100
+@@ -376,7 +376,7 @@
+           GBE_ASSERT(index == 0);
+           return this->_newScalar(value, key, type, index, uniform);
+           break;
+-        case Type::VectorTyID:
++        case Type::FixedVectorTyID:
+         {
+           auto vectorType = cast<VectorType>(type);
+           auto elementType = vectorType->getElementType();
+@@ -743,20 +743,20 @@
+ #undef DECL_VISIT_FN
+
+     // Emit rounding instructions from gen native function
+-    void emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode);
++    void emitRoundingCallInst(CallInst &I, ir::Opcode opcode);
+     // Emit unary instructions from gen native function
+-    void emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
++    void emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
+     // Emit unary instructions from gen native function
+-    void emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode);
++    void emitAtomicInst(CallInst &I, ir::AtomicOps opcode);
+     // Emit workgroup instructions
+-    void emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+-    void emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+
+-    uint8_t appendSampler(CallSite::arg_iterator AI);
++    uint8_t appendSampler(User::op_iterator AI);
+     uint8_t getImageID(CallInst &I);
+
+     // These instructions are not supported at all
+@@ -1320,13 +1320,13 @@
+ #endif
+
+       if(typeNameNode) {
+-        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+       }
+       if(typeBaseNameNode) {
+-        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+       }
+-      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
+-      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
++      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+       bool isImage = llvmInfo.isImageType();
+       bool isPipe = llvmInfo.isPipeType();
+       if (I->getType()->isPointerTy() || isImage || isPipe) {
+@@ -1531,7 +1531,7 @@
+             EltTy = getEltType(EltTy, TypeIndex);
+         }
+
+-        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName());
++        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName().str());
+         unsigned int defOffset = cc.getOffset();
+         relocs.push_back(ir::RelocEntry(offset, defOffset + constantOffset));
+
+@@ -1546,7 +1546,7 @@
+       return;
+     }
+     if (isa<GlobalVariable>(c)) {
+-      ir::Constant cc = unit.getConstantSet().getConstant(c->getName());
++      ir::Constant cc = unit.getConstantSet().getConstant(c->getName().str());
+       unsigned int defOffset = cc.getOffset();
+
+       relocs.push_back(ir::RelocEntry(offset, defOffset));
+@@ -1609,7 +1609,7 @@
+           }
+           break;
+         }
+-      case Type::TypeID::VectorTyID:
++      case Type::TypeID::FixedVectorTyID:
+         {
+           const ConstantDataSequential *cds = dyn_cast<ConstantDataSequential>(c);
+           const VectorType *vecTy = cast<VectorType>(type);
+@@ -1936,7 +1936,7 @@
+       case Type::PointerTyID:
+         regTranslator.newScalar(value, key, 0, uniform);
+         break;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         auto vectorType = cast<VectorType>(type);
+         const uint32_t elemNum = vectorType->getNumElements();
+@@ -2395,7 +2395,7 @@
+ #endif
+         }
+         if(typeNameNode) {
+-          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+           //LLVM 3.9 image's type name include access qual, don't match OpenCL spec, erase them.
+           std::vector<std::string> filters = {"__read_only ", "__write_only "};
+           for (uint32_t i = 0; i < filters.size(); i++) {
+@@ -2406,16 +2406,16 @@
+           }
+         }
+         if(typeBaseNameNode){
+-          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+         }
+         if(accessQualNode) {
+-          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString();
++          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString().str();
+         }
+         if(typeQualNode) {
+-          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+         }
+         if(argNameNode){
+-          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString();
++          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString().str();
+         }
+
+         // function arguments are uniform values.
+@@ -3010,7 +3010,7 @@
+         } else {
+           this->newRegister(const_cast<GlobalVariable*>(&v));
+           ir::Register reg = regTranslator.getScalar(const_cast<GlobalVariable*>(&v), 0);
+-          ir::Constant &con = unit.getConstantSet().getConstant(v.getName());
++          ir::Constant &con = unit.getConstantSet().getConstant(v.getName().str());
+           if (!legacyMode) {
+             ir::Register regload = ctx.reg(getFamily(getType(ctx, v.getType())));
+             ctx.LOADI(getType(ctx, v.getType()), regload, ctx.newIntegerImmediate(con.getOffset(), getType(ctx, v.getType())));
+@@ -3212,7 +3212,7 @@
+         GBE_ASSERTM(false, "Unsupported calling convention");
+     }
+
+-    ctx.startFunction(F.getName());
++    ctx.startFunction(F.getName().str());
+
+     ir::Function &fn = ctx.getFunction();
+     this->regTranslator.clear();
+@@ -3810,9 +3810,9 @@
+
+   void GenWriter::regAllocateCallInst(CallInst &I) {
+     Value *dst = &I;
+-    Value *Callee = I.getCalledValue();
++    Value *Callee = I.getCalledOperand();
+     GBE_ASSERT(ctx.getFunction().getProfile() == ir::PROFILE_OCL);
+-    GBE_ASSERT(isa<InlineAsm>(I.getCalledValue()) == false);
++    GBE_ASSERT(isa<InlineAsm>(I.getCalledOperand()) == false);
+     if(I.getNumArgOperands()) GBE_ASSERT(I.hasStructRetAttr() == false);
+
+     // We only support a small number of intrinsics right now
+@@ -3870,7 +3870,7 @@
+       }
+     }
+     // Get the name of the called function and handle it
+-    const std::string fnName = Callee->stripPointerCasts()->getName();
++    const std::string fnName = Callee->stripPointerCasts()->getName().str();
+     auto genIntrinsicID = intrinsicMap.find(fnName);
+     switch (genIntrinsicID) {
+       case GEN_OCL_GET_GROUP_ID0:
+@@ -4166,7 +4166,7 @@
+     };
+   }
+
+-  void GenWriter::emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode) {
++  void GenWriter::emitRoundingCallInst(CallInst &I, ir::Opcode opcode) {
+     if (I.getType()->isHalfTy()) {
+       const ir::Register src = this->getRegister(I.getOperand(0));
+       const ir::Register srcFloat = ctx.reg(ir::FAMILY_DWORD);
+@@ -4177,14 +4177,14 @@
+       ctx.F32TO16(ir::TYPE_U16, ir::TYPE_FLOAT, dst, dstFloat);
+     } else {
+       GBE_ASSERT(I.getType()->isFloatTy());
+-      this->emitUnaryCallInst(I,CS,opcode);
++      this->emitUnaryCallInst(I,opcode);
+     }
+   }
+
+-  void GenWriter::emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
++  void GenWriter::emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+     GBE_ASSERT(AI != AE);
+     const ir::Register src = this->getRegister(*AI);
+@@ -4293,9 +4293,9 @@
+     this->emitAtomicInstHelper(opcode, type, dst, llvmPtr, payloadTuple);
+   }
+
+-  void GenWriter::emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitAtomicInst(CallInst &I, ir::AtomicOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+     Value *llvmPtr = *AI;
+     ir::AddressSpace addrSpace = addressSpaceLLVMToGen(llvmPtr->getType()->getPointerAddressSpace());
+@@ -4348,7 +4348,7 @@
+     }
+   }
+
+-  void GenWriter::emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
++  void GenWriter::emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
+     ir::Function &f = ctx.getFunction();
+
+     if (f.getwgBroadcastSLM() < 0 && opcode == ir::WORKGROUP_OP_BROADCAST) {
+@@ -4378,8 +4378,8 @@
+       GBE_ASSERT(f.gettidMapSLM() >= 0);
+     }
+
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4391,14 +4391,14 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 3);
+       ctx.WORKGROUP(opcode, (uint32_t)f.gettidMapSLM(), getRegister(&I), srcTuple, 3, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+         src[i] = this->getRegister(*(AI++));
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.WORKGROUP(ir::WORKGROUP_OP_BROADCAST, (uint32_t)f.getwgBroadcastSLM(), getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4423,9 +4423,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4435,7 +4435,7 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 1);
+       ctx.SUBGROUP(opcode, getRegister(&I), srcTuple, 1, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       GBE_ASSERT(argNum == 2);
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+@@ -4443,7 +4443,7 @@
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.SUBGROUP(ir::WORKGROUP_OP_BROADCAST, getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4466,9 +4466,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     Value *llvmPtr = *(AI++);
+@@ -4522,9 +4522,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     const uint8_t imageID = getImageID(I);
+@@ -4557,7 +4557,7 @@
+
+   /* append a new sampler. should be called before any reference to
+    * a sampler_t value. */
+-  uint8_t GenWriter::appendSampler(CallSite::arg_iterator AI) {
++  uint8_t GenWriter::appendSampler(User::op_iterator AI) {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+     CallInst *TC = dyn_cast<CallInst>(*AI);
+     Constant *CPV = TC ? dyn_cast<Constant>(TC->getOperand(0)) : NULL;
+@@ -4595,10 +4595,9 @@
+         const ir::Function &fn = ctx.getFunction();
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+         switch (F->getIntrinsicID()) {
+           case Intrinsic::stacksave:
+@@ -4764,17 +4763,17 @@
+             ctx.MAD(srcType, dst, src0, src1, src2);
+           }
+           break;
+-          case Intrinsic::sqrt: this->emitUnaryCallInst(I,CS,ir::OP_SQR); break;
+-          case Intrinsic::ceil: this->emitRoundingCallInst(I,CS,ir::OP_RNDU); break;
+-          case Intrinsic::trunc: this->emitRoundingCallInst(I,CS,ir::OP_RNDZ); break;
+-          case Intrinsic::rint: this->emitRoundingCallInst(I,CS,ir::OP_RNDE); break;
+-          case Intrinsic::floor: this->emitRoundingCallInst(I,CS,ir::OP_RNDD); break;
+-          case Intrinsic::sin: this->emitUnaryCallInst(I,CS,ir::OP_SIN); break;
+-          case Intrinsic::cos: this->emitUnaryCallInst(I,CS,ir::OP_COS); break;
+-          case Intrinsic::log2: this->emitUnaryCallInst(I,CS,ir::OP_LOG); break;
+-          case Intrinsic::exp2: this->emitUnaryCallInst(I,CS,ir::OP_EXP); break;
++          case Intrinsic::sqrt: this->emitUnaryCallInst(I,ir::OP_SQR); break;
++          case Intrinsic::ceil: this->emitRoundingCallInst(I,ir::OP_RNDU); break;
++          case Intrinsic::trunc: this->emitRoundingCallInst(I,ir::OP_RNDZ); break;
++          case Intrinsic::rint: this->emitRoundingCallInst(I,ir::OP_RNDE); break;
++          case Intrinsic::floor: this->emitRoundingCallInst(I,ir::OP_RNDD); break;
++          case Intrinsic::sin: this->emitUnaryCallInst(I,ir::OP_SIN); break;
++          case Intrinsic::cos: this->emitUnaryCallInst(I,ir::OP_COS); break;
++          case Intrinsic::log2: this->emitUnaryCallInst(I,ir::OP_LOG); break;
++          case Intrinsic::exp2: this->emitUnaryCallInst(I,ir::OP_EXP); break;
+           case Intrinsic::bswap:
+-            this->emitUnaryCallInst(I,CS,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
++            this->emitUnaryCallInst(I,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
+           case Intrinsic::pow:
+           {
+             const ir::Register src0 = this->getRegister(*AI); ++AI;
+@@ -4794,21 +4793,20 @@
+         }
+       } else {
+         // Get the name of the called function and handle it
+-        Value *Callee = I.getCalledValue();
+-        const std::string fnName = Callee->stripPointerCasts()->getName();
++        Value *Callee = I.getCalledOperand();
++        const std::string fnName = Callee->stripPointerCasts()->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+
+         switch (genIntrinsicID) {
+-          case GEN_OCL_FBH: this->emitUnaryCallInst(I,CS,ir::OP_FBH, ir::TYPE_U32); break;
+-          case GEN_OCL_FBL: this->emitUnaryCallInst(I,CS,ir::OP_FBL, ir::TYPE_U32); break;
+-          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,CS,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
++          case GEN_OCL_FBH: this->emitUnaryCallInst(I,ir::OP_FBH, ir::TYPE_U32); break;
++          case GEN_OCL_FBL: this->emitUnaryCallInst(I,ir::OP_FBL, ir::TYPE_U32); break;
++          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
+           case GEN_OCL_ABS:
+           {
+             const ir::Register src = this->getRegister(*AI);
+@@ -4915,8 +4913,8 @@
+             ctx.REGION(dst, src, x.getIntegerValue());
+             break;
+           }
+-          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,CS,ir::OP_RSQ); break;
+-          case GEN_OCL_RCP: this->emitUnaryCallInst(I,CS,ir::OP_RCP); break;
++          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,ir::OP_RSQ); break;
++          case GEN_OCL_RCP: this->emitUnaryCallInst(I,ir::OP_RCP); break;
+           case GEN_OCL_FORCE_SIMD8: ctx.setSimdWidth(8); break;
+           case GEN_OCL_FORCE_SIMD16: ctx.setSimdWidth(16); break;
+           case GEN_OCL_LBARRIER: ctx.SYNC(ir::syncLocalBarrier); break;
+@@ -4947,31 +4945,31 @@
+             break;
+           }
+           case GEN_OCL_ATOMIC_ADD0:
+-          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_ADD); break;
++          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,ir::ATOMIC_OP_ADD); break;
+           case GEN_OCL_ATOMIC_SUB0:
+-          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_SUB); break;
++          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,ir::ATOMIC_OP_SUB); break;
+           case GEN_OCL_ATOMIC_AND0:
+-          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_AND); break;
++          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,ir::ATOMIC_OP_AND); break;
+           case GEN_OCL_ATOMIC_OR0:
+-          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_OR); break;
++          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,ir::ATOMIC_OP_OR); break;
+           case GEN_OCL_ATOMIC_XOR0:
+-          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XOR); break;
++          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,ir::ATOMIC_OP_XOR); break;
+           case GEN_OCL_ATOMIC_XCHG0:
+-          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XCHG); break;
++          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_XCHG); break;
+           case GEN_OCL_ATOMIC_INC0:
+-          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_INC); break;
++          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,ir::ATOMIC_OP_INC); break;
+           case GEN_OCL_ATOMIC_DEC0:
+-          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_DEC); break;
++          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,ir::ATOMIC_OP_DEC); break;
+           case GEN_OCL_ATOMIC_UMIN0:
+-          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMIN); break;
++          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMIN); break;
+           case GEN_OCL_ATOMIC_UMAX0:
+-          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMAX); break;
++          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMAX); break;
+           case GEN_OCL_ATOMIC_IMIN0:
+-          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMIN); break;
++          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMIN); break;
+           case GEN_OCL_ATOMIC_IMAX0:
+-          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMAX); break;
++          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMAX); break;
+           case GEN_OCL_ATOMIC_CMPXCHG0:
+-          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_CMPXCHG); break;
++          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_CMPXCHG); break;
+           case GEN_OCL_GET_IMAGE_WIDTH:
+           case GEN_OCL_GET_IMAGE_HEIGHT:
+           case GEN_OCL_GET_IMAGE_DEPTH:
+@@ -5429,48 +5427,48 @@
+             ctx.WAIT();
+             break;
+           }
+-          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ALL); break;
+-          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ANY); break;
++          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ALL); break;
++          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ANY); break;
+           case GEN_OCL_WORK_GROUP_BROADCAST:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_BROADCAST:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_LRP:
+           {
+             const ir::Register dst  = this->getRegister(&I);
+@@ -5484,69 +5482,69 @@
+             break;
+           }
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteMemInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteMemInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteMemInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteMemInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteMemInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteMemInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteMemInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteMemInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteImageInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteImageInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteImageInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteImageInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteImageInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteImageInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteImageInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteImageInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_GET_PIPE:
+           case GEN_OCL_MAKE_RID:
+           case GEN_OCL_GET_RID:
+--- backend/src/llvm/llvm_includes.hpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_includes.hpp	2020-11-09 19:00:09.955926795 +0100
+@@ -103,7 +103,6 @@
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+ #include "llvm/IR/Mangler.h"
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #include "llvm/IR/InstVisitor.h"
+ #include "llvm/IR/IRPrintingPasses.h"
+--- backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 19:10:37.141852308 +0100
+@@ -160,7 +160,7 @@
+     Value *vecPtr = Builder.CreateBitCast(ld->getPointerOperand(),
+                                         PointerType::get(vecTy, addrSpace));
+     LoadInst *vecValue = Builder.CreateLoad(vecPtr);
+-    vecValue->setAlignment(align);
++    vecValue->setAlignment(align.valueOrOne());
+
+     for (unsigned i = 0; i < size; ++i) {
+       Value *S = Builder.CreateExtractElement(vecValue, Builder.getInt32(i));
+@@ -251,7 +251,7 @@
+       return;
+     Value *newPtr = Builder.CreateBitCast(stPointer, PointerType::get(vecTy, addrSpace));
+     StoreInst *newST = Builder.CreateStore(parent, newPtr);
+-    newST->setAlignment(align);
++    newST->setAlignment(align.valueOrOne());
+   }
+
+   // Find the safe iterator we can point to. If reorder happens, we need to
+--- backend/src/llvm/llvm_passes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_passes.cpp	2020-11-09 18:48:55.997006837 +0100
+@@ -87,14 +87,14 @@
+   }
+
+   int32_t getPadding(int32_t offset, int32_t align) {
+-    return (align - (offset % align)) % align;
++    return (align - (offset % align)) % align;
+   }
+
+   uint32_t getAlignmentByte(const ir::Unit &unit, Type* Ty)
+   {
+     switch (Ty->getTypeID()) {
+       case Type::VoidTyID: NOT_SUPPORTED;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t elemNum = VecTy->getNumElements();
+@@ -138,7 +138,7 @@
+       case Type::HalfTyID:    return 16;
+       case Type::FloatTyID:   return 32;
+       case Type::DoubleTyID:  return 64;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t numElem = VecTy->getNumElements();
+@@ -184,10 +184,12 @@
+     Type *elementType = NULL;
+     if (PointerType* ptrType = dyn_cast<PointerType>(eltTy))
+       elementType = ptrType->getElementType();
+-    else if(SequentialType * seqType = dyn_cast<SequentialType>(eltTy))
+-      elementType = seqType->getElementType();
+-    else if(CompositeType * compTy= dyn_cast<CompositeType>(eltTy))
+-      elementType = compTy->getTypeAtIndex(index);
++    else if (ArrayType * arrType = dyn_cast<ArrayType>(eltTy))
++      elementType = arrType->getElementType();
++    else if(VectorType * vecType = dyn_cast<VectorType>(eltTy))
++      elementType = vecType->getElementType();
++    else if(StructType * structType = dyn_cast<StructType>(eltTy))
++      elementType = structType->getTypeAtIndex(index);
+     GBE_ASSERT(elementType);
+     return elementType;
+   }
+--- backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 18:57:52.618943105 +0100
+@@ -323,8 +323,7 @@
+
+   bool PrintfParser::parseOnePrintfInstruction(CallInst * call)
+   {
+-    CallSite CS(call);
+-    CallSite::arg_iterator CI_FMT = CS.arg_begin();
++    User::op_iterator CI_FMT = call->arg_begin();
+     int param_num = 0;
+
+     llvm::Constant* arg0 = dyn_cast<llvm::ConstantExpr>(*CI_FMT);
+@@ -341,7 +340,7 @@
+       return false;
+     }
+
+-    std::string fmt = fmt_arg->getAsCString();
++    std::string fmt = fmt_arg->getAsCString().str();
+     if (fmt.size() == 0)
+       return false;
+
+@@ -437,8 +436,8 @@
+         if ( callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+
+         if (fnName != "__gen_ocl_printf_stub" && fnName != "__gen_ocl_puts_stub")
+           continue;
+@@ -582,7 +581,7 @@
+             if (!fmt_arg || !fmt_arg->isCString()) {
+               return false;
+             }
+-            slot.state.str = fmt_arg->getAsCString();
++            slot.state.str = fmt_arg->getAsCString().str();
+             return true;
+           }
+           case PRINTF_CONVERSION_P: {
+@@ -595,10 +594,10 @@
+
+         break;
+
+-      case Type::VectorTyID: {
+-        Type* vect_type = arg->getType();
+-        Type* elt_type = vect_type->getVectorElementType();
+-        int vec_num = vect_type->getVectorNumElements();
++      case Type::FixedVectorTyID: {
++        VectorType* vect_type = dyn_cast<VectorType>(arg->getType());
++        Type* elt_type = vect_type->getElementType();
++        int vec_num = vect_type->getNumElements();
+         bool sign = false;
+
+         if (vec_num != slot.state.vector_n) {
+--- backend/src/llvm/llvm_profiling.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_profiling.cpp	2020-11-09 18:59:50.120929150 +0100
+@@ -35,7 +35,6 @@
+ #include "llvm/IR/IRBuilder.h"
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #else
+ #include "llvm/Support/CallSite.h"
+--- backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 17:01:09.407774832 +0100
+@@ -45,8 +45,8 @@
+     bool visitCallInst(CallInst *I) {
+       if(!I)
+         return false;
+-      Value *Callee = I->getCalledValue();
+-      const std::string fnName = Callee->getName();
++      Value *Callee = I->getCalledOperand();
++      const std::string fnName = Callee->getName().str();
+       bool changed = false;
+       Type *boolTy = IntegerType::get(I->getContext(), 1);
+       Type *i32Ty = IntegerType::get(I->getContext(), 32);
+@@ -59,7 +59,7 @@
+         Value *needFixVal;
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+@@ -113,7 +113,7 @@
+         Value *needFixVal;
+  #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+--- backend/src/llvm/llvm_scalarize.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_scalarize.cpp	2020-11-09 18:51:16.888990104 +0100
+@@ -178,7 +178,7 @@
+       if(!type)
+         return type;
+       switch(type->getTypeID()) {
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       case Type::ArrayTyID:
+         return GetBasicType(type->getContainedType(0));
+       default:
+@@ -188,7 +188,7 @@
+     }
+
+     int GetComponentCount(const Type* type)  {
+-      if (type && type->getTypeID() == Type::VectorTyID)
++      if (type && type->getTypeID() == Type::FixedVectorTyID)
+         return llvm::dyn_cast<VectorType>(type)->getNumElements();
+       else
+         return 1;
+@@ -652,13 +652,12 @@
+           break;
+         }
+       } else {
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(call);
+-        CallSite::arg_iterator CI = CS.arg_begin() + 1;
++        User::op_iterator CI = call->arg_begin() + 1;
+
+         switch (genIntrinsicID) {
+           case GEN_OCL_NOT_FOUND:
+@@ -729,7 +728,7 @@
+             extractFromVector(call);
+             break;
+           case GEN_OCL_PRINTF:
+-            for (; CI != CS.arg_end(); ++CI)
++            for (; CI != call->arg_end(); ++CI)
+               if ((*CI)->getType()->isVectorTy())
+                 *CI = InsertToVector(call, *CI);
+             break;
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index a7b6dff107f..e37102ce14f 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=8
+revision=9
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (25 preceding siblings ...)
  2020-11-09 19:52 ` Snektron
@ 2020-11-09 20:03 ` Snektron
  2020-11-09 20:32 ` Snektron
                   ` (5 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 20:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

[WIP] llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 166895 bytes --]

From 52a260f4a9e961424a92fcb30c1c604b4232730c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:10 +0100
Subject: [PATCH 01/23] new package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 ...h~b2110e270 (codelite: rebuild for llvm11) |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 747 insertions(+), 13 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index 12ade7a11ac..ef2400dd2ef 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11) b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
new file mode 100644
index 00000000000..5be8de4f068
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)	
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -153,7 +153,7 @@
+
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From a0da2fbf82386b9dd4590287edcc9190ad3b621b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:23 +0100
Subject: [PATCH 02/23] llvm: update to 11.0.0

---
 srcpkgs/llvm/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 6d16e98f895e340e826ae160519639af739f92c3 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 03/23] llvm10: rebuild standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 5ce860e47ae647dee6f12a85d444bb28d06c5b17 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 04/23] llvm-libunwind: update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 855b1e78b094003cf20534ba521882813117a3c2 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 05/23] libcxxabi: update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From ecc37be2127da750ee3f8584070301903fa2b56a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 06/23] libcxx: update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From b79366c5e56f25ce3af534fc635ed2223cba2671 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 07/23] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From 55dfbbe344a6c0fe74cc1f63f1642675eede0932 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 08/23] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 72a1716259d16440ce5b23c8ccbaa6c73756d6a4 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 09/23] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 247ae03fcafbe7145fca4180e0421776be654a96 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 10/23] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From 9039929902d69eaf6637558913ae4f9402f6c7a5 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 11/23] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From 8cd2e2026b0c14c8bdbf6534ad6208a865b4444b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 12/23] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 2d21d4b84717cb66b15e782e494afba7c04ccd52 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 13/23] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From 03aaa6306dc2c3184b476937d65c37eab8d81d09 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 14/23] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From 9365a6f16f079b600b39c34114aee1209a34b670 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 15/23] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From b674578c892fd01168126d3fe3d7da5d3ad2171b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 16/23] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index 1eb6d9bafc7..35a73955e11 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20201025
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From d871410d6f50cef031983657ceaaf75846c8e208 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 17/23] ispc: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

From 80806fcc24c0b3fb9134225af392ca2b888796bf Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:24:20 +0100
Subject: [PATCH 18/23] zig: update to 0.7.0

---
 srcpkgs/zig/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index e34d6471728..727a675383a 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,16 +1,16 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.6.0
-revision=2
+version=0.7.0
+revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
-makedepends="clang llvm10 lld-devel"
+makedepends="clang llvm11 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="MIT"
 homepage="https://ziglang.org/"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204
+checksum=0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83
 nopie=yes
 nocross=yes
 

From 1f0b5174e873d207778eebe336414e7e9212b866 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:41:53 +0100
Subject: [PATCH 19/23] clazy: rebuild for llvm11

---
 .../files/clazy-001-llvm11-stringref.patch    | 343 ++++++++++++++++++
 .../files/clazy-002-llvm11-stringref.patch    |  28 ++
 srcpkgs/clazy/template                        |   8 +-
 3 files changed, 378 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch

diff --git a/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..48049fa594a
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
@@ -0,0 +1,343 @@
+From 30d6a2b64f5a05722fdc5d8e3754dbf13425cd62 Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Thu, 4 Jun 2020 17:10:21 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+Also included header file clang/Basic/FileManager.h in src/MiniDumper
+because without this header, class clang::FileEntry in incomplete class
+---
+ src/FixItExporter.cpp                                 | 5 +++--
+ src/MiniAstDumper.cpp                                 | 1 +
+ src/Utils.cpp                                         | 2 +-
+ src/checkbase.cpp                                     | 2 +-
+ src/checks/detachingbase.cpp                          | 2 +-
+ src/checks/level0/qenums.cpp                          | 2 +-
+ src/checks/level0/qt-macros.cpp                       | 4 ++--
+ src/checks/level0/unused-non-trivial-variable.cpp     | 2 +-
+ src/checks/level1/detaching-temporary.cpp             | 2 +-
+ src/checks/level1/non-pod-global-static.cpp           | 2 +-
+ src/checks/level1/qproperty-without-notify.cpp        | 2 +-
+ src/checks/level2/missing-typeinfo.cpp                | 2 +-
+ src/checks/level2/old-style-connect.cpp               | 6 +++---
+ src/checks/level2/rule-of-three.cpp                   | 2 +-
+ src/checks/manuallevel/ifndef-define-typo.cpp         | 6 +++---
+ src/checks/manuallevel/qproperty-type-mismatch.cpp    | 2 +-
+ src/checks/manuallevel/qrequiredresult-candidates.cpp | 2 +-
+ src/checks/manuallevel/qt-keywords.cpp                | 4 ++--
+ src/checks/manuallevel/reserve-candidates.cpp         | 3 ++-
+ 19 files changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/src/FixItExporter.cpp b/src/FixItExporter.cpp
+index f3af2e54..44240cf5 100644
+--- a/src/FixItExporter.cpp
++++ b/src/FixItExporter.cpp
+@@ -68,7 +68,7 @@ void FixItExporter::BeginSourceFile(const LangOptions &LangOpts, const Preproces
+ 
+     const auto id = SourceMgr.getMainFileID();
+     const auto entry = SourceMgr.getFileEntryForID(id);
+-    getTuDiag().MainSourceFile = entry->getName();
++    getTuDiag().MainSourceFile = static_cast<std::string>(entry->getName());
+ }
+ 
+ bool FixItExporter::IncludeInDiagnosticCounts() const
+@@ -89,7 +89,8 @@ tooling::Diagnostic FixItExporter::ConvertDiagnostic(const Diagnostic &Info)
+     // TODO: This returns an empty string: DiagEngine->getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
+     // HACK: capture it at the end of the message: Message text [check-name]
+ 
+-    std::string checkName = DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
++    std::string checkName =
++        static_cast<std::string>(DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID()));
+     std::string messageText;
+ 
+     if (checkName.empty()) {
+diff --git a/src/MiniAstDumper.cpp b/src/MiniAstDumper.cpp
+index 47661749..6124e6e8 100644
+--- a/src/MiniAstDumper.cpp
++++ b/src/MiniAstDumper.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <clang/Frontend/CompilerInstance.h>
+ #include <clang/Frontend/FrontendPluginRegistry.h>
++#include <clang/Basic/FileManager.h>
+ 
+ using namespace clang;
+ using namespace std;
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index 001ced98..b0812fe3 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -878,7 +878,7 @@ string Utils::filenameForLoc(SourceLocation loc, const clang::SourceManager &sm)
+     if (loc.isMacroID())
+         loc = sm.getExpansionLoc(loc);
+ 
+-    const string filename = sm.getFilename(loc);
++    const string filename = static_cast<std::string>(sm.getFilename(loc));
+     auto splitted = clazy::splitString(filename, '/');
+     if (splitted.empty())
+         return {};
+diff --git a/src/checkbase.cpp b/src/checkbase.cpp
+index 8b40e19d..22a426cf 100644
+--- a/src/checkbase.cpp
++++ b/src/checkbase.cpp
+@@ -188,7 +188,7 @@ bool CheckBase::shouldIgnoreFile(SourceLocation loc) const
+     if (!loc.isValid())
+         return true;
+ 
+-    string filename = sm().getFilename(loc);
++    string filename = static_cast<std::string>(sm().getFilename(loc));
+ 
+     return clazy::any_of(m_filesToIgnore, [filename](const std::string &ignored) {
+         return clazy::contains(filename, ignored);
+diff --git a/src/checks/detachingbase.cpp b/src/checks/detachingbase.cpp
+index 70311f42..1b094ee7 100644
+--- a/src/checks/detachingbase.cpp
++++ b/src/checks/detachingbase.cpp
+@@ -57,7 +57,7 @@ bool DetachingBase::isDetachingMethod(CXXMethodDecl *method, DetachingMethodType
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = detachingMethodType == DetachingMethod ? clazy::detachingMethods()
+                                                                                                                      : clazy::detachingMethodsWithConstCounterParts();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     if (it != methodsByType.cend()) {
+         const auto &methods = it->second;
+         if (clazy::contains(methods, clazy::name(method)))
+diff --git a/src/checks/level0/qenums.cpp b/src/checks/level0/qenums.cpp
+index 00075b5c..db8910f2 100644
+--- a/src/checks/level0/qenums.cpp
++++ b/src/checks/level0/qenums.cpp
+@@ -59,7 +59,7 @@ void QEnums::VisitMacroExpands(const Token &MacroNameTok, const SourceRange &ran
+         // We simply check if :: is present because it's very cumbersome to to check for different classes when dealing with the pre-processor
+ 
+         CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+-        string text = Lexer::getSourceText(crange, sm(), lo());
++        string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+         if (clazy::contains(text, "::"))
+             return;
+     }
+diff --git a/src/checks/level0/qt-macros.cpp b/src/checks/level0/qt-macros.cpp
+index d3a587cb..ab8e9f52 100644
+--- a/src/checks/level0/qt-macros.cpp
++++ b/src/checks/level0/qt-macros.cpp
+@@ -44,7 +44,7 @@ void QtMacros::VisitMacroDefined(const Token &MacroNameTok)
+         return;
+ 
+     IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
+-    if (ii && clazy::startsWith(ii->getName(), "Q_OS_"))
++    if (ii && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_"))
+         m_OSMacroExists = true;
+ }
+ 
+@@ -58,7 +58,7 @@ void QtMacros::checkIfDef(const Token &macroNameTok, SourceLocation Loc)
+     if (preProcessorVisitor && preProcessorVisitor->qtVersion() < 51204 && ii->getName() == "Q_OS_WINDOWS") {
+         // Q_OS_WINDOWS was introduced in 5.12.4
+         emitWarning(Loc, "Q_OS_WINDOWS was only introduced in Qt 5.12.4, use Q_OS_WIN instead");
+-    } else if (!m_OSMacroExists && clazy::startsWith(ii->getName(), "Q_OS_")) {
++    } else if (!m_OSMacroExists && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_")) {
+         emitWarning(Loc, "Include qglobal.h before testing Q_OS_ macros");
+     }
+ }
+diff --git a/src/checks/level0/unused-non-trivial-variable.cpp b/src/checks/level0/unused-non-trivial-variable.cpp
+index 4e4b8303..93815f27 100644
+--- a/src/checks/level0/unused-non-trivial-variable.cpp
++++ b/src/checks/level0/unused-non-trivial-variable.cpp
+@@ -91,7 +91,7 @@ bool UnusedNonTrivialVariable::isUninterestingType(const CXXRecordDecl *record)
+     static const vector<StringRef> blacklistedTemplates = { "QScopedPointer", "QSetValueOnDestroy", "QScopedValueRollback" };
+     StringRef className = clazy::name(record);
+     for (StringRef templateName : blacklistedTemplates) {
+-        if (clazy::startsWith(className, templateName))
++        if (clazy::startsWith(static_cast<std::string>(className), static_cast<std::string>(templateName)))
+             return true;
+     }
+ 
+diff --git a/src/checks/level1/detaching-temporary.cpp b/src/checks/level1/detaching-temporary.cpp
+index fedfc81c..60c75532 100644
+--- a/src/checks/level1/detaching-temporary.cpp
++++ b/src/checks/level1/detaching-temporary.cpp
+@@ -140,7 +140,7 @@ void DetachingTemporary::VisitStmt(clang::Stmt *stm)
+     StringRef className = clazy::name(classDecl);
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = clazy::detachingMethods();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     auto it2 = m_writeMethodsByType.find(className);
+ 
+     std::vector<StringRef> allowedFunctions;
+diff --git a/src/checks/level1/non-pod-global-static.cpp b/src/checks/level1/non-pod-global-static.cpp
+index 5879bff8..433b5c5f 100644
+--- a/src/checks/level1/non-pod-global-static.cpp
++++ b/src/checks/level1/non-pod-global-static.cpp
+@@ -74,7 +74,7 @@ void NonPodGlobalStatic::VisitStmt(clang::Stmt *stm)
+     const SourceLocation declStart = clazy::getLocStart(varDecl);
+ 
+     if (declStart.isMacroID()) {
+-        auto macroName = Lexer::getImmediateMacroName(declStart, sm(), lo());
++        auto macroName = static_cast<std::string>(Lexer::getImmediateMacroName(declStart, sm(), lo()));
+         if (clazy::startsWithAny(macroName, { "Q_IMPORT_PLUGIN", "Q_CONSTRUCTOR_FUNCTION", "Q_DESTRUCTOR_FUNCTION"})) // Don't warn on these
+             return;
+     }
+diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp
+index e1d6db4a..3af9fee2 100644
+--- a/src/checks/level1/qproperty-without-notify.cpp
++++ b/src/checks/level1/qproperty-without-notify.cpp
+@@ -69,7 +69,7 @@ void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok,
+         return;
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/level2/missing-typeinfo.cpp b/src/checks/level2/missing-typeinfo.cpp
+index 98df2cd4..03b44e06 100644
+--- a/src/checks/level2/missing-typeinfo.cpp
++++ b/src/checks/level2/missing-typeinfo.cpp
+@@ -74,7 +74,7 @@ void MissingTypeInfo::VisitDecl(clang::Decl *decl)
+         if (sm().isInSystemHeader(clazy::getLocStart(record)))
+             return;
+ 
+-        std::string typeName = clazy::name(record);
++        std::string typeName = static_cast<std::string>(clazy::name(record));
+         if (typeName == "QPair") // QPair doesn't use Q_DECLARE_TYPEINFO, but rather a explicit QTypeInfo.
+             return;
+ 
+diff --git a/src/checks/level2/old-style-connect.cpp b/src/checks/level2/old-style-connect.cpp
+index 0fe68c13..396cb703 100644
+--- a/src/checks/level2/old-style-connect.cpp
++++ b/src/checks/level2/old-style-connect.cpp
+@@ -274,7 +274,7 @@ void OldStyleConnect::VisitMacroExpands(const Token &macroNameTok, const SourceR
+         return;
+ 
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(Q_PRIVATE_SLOT\s*\((.*)\s*,\s*.*\s+(.*)\(.*)");
+     smatch match;
+@@ -293,7 +293,7 @@ string OldStyleConnect::signalOrSlotNameFromMacro(SourceLocation macroLoc)
+     CharSourceRange expansionRange = clazy::getImmediateExpansionRange(macroLoc, sm());
+     SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(\s*(SIGNAL|SLOT)\s*\(\s*(.+)\s*\(.*)");
+ 
+@@ -315,7 +315,7 @@ bool OldStyleConnect::isSignalOrSlot(SourceLocation loc, string &macroName) cons
+     if (!loc.isMacroID() || loc.isInvalid())
+         return false;
+ 
+-    macroName = Lexer::getImmediateMacroName(loc, sm(), lo());
++    macroName = static_cast<std::string>(Lexer::getImmediateMacroName(loc, sm(), lo()));
+     return macroName == "SIGNAL" || macroName == "SLOT";
+ }
+ 
+diff --git a/src/checks/level2/rule-of-three.cpp b/src/checks/level2/rule-of-three.cpp
+index 8db55d53..7583fcc5 100644
+--- a/src/checks/level2/rule-of-three.cpp
++++ b/src/checks/level2/rule-of-three.cpp
+@@ -140,7 +140,7 @@ void RuleOfThree::VisitDecl(clang::Decl *decl)
+ 
+     const string className = record->getNameAsString();
+     const string classQualifiedName = record->getQualifiedNameAsString();
+-    const string filename = sm().getFilename(recordStart);
++    const string filename = static_cast<std::string>(sm().getFilename(recordStart));
+     if (clazy::endsWith(className, "Private") && clazy::endsWithAny(filename, { ".cpp", ".cxx", "_p.h" }))
+         return; // Lots of RAII classes fall into this category. And even Private (d-pointer) classes, warning in that case would just be noise
+ 
+diff --git a/src/checks/manuallevel/ifndef-define-typo.cpp b/src/checks/manuallevel/ifndef-define-typo.cpp
+index edb6cdf4..e9c50a45 100644
+--- a/src/checks/manuallevel/ifndef-define-typo.cpp
++++ b/src/checks/manuallevel/ifndef-define-typo.cpp
+@@ -44,7 +44,7 @@ void IfndefDefineTypo::VisitMacroDefined(const Token &macroNameTok)
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -53,7 +53,7 @@ void IfndefDefineTypo::VisitDefined(const Token &macroNameTok, const SourceRange
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -66,7 +66,7 @@ void IfndefDefineTypo::VisitIfdef(SourceLocation, const Token &)
+ void IfndefDefineTypo::VisitIfndef(SourceLocation, const Token &macroNameTok)
+ {
+     if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo())
+-        m_lastIfndef = ii->getName();
++        m_lastIfndef = static_cast<std::string>(ii->getName());
+ }
+ 
+ void IfndefDefineTypo::VisitIf(SourceLocation, SourceRange, PPCallbacks::ConditionValueKind)
+diff --git a/src/checks/manuallevel/qproperty-type-mismatch.cpp b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+index f91159cb..952d9f1d 100644
+--- a/src/checks/manuallevel/qproperty-type-mismatch.cpp
++++ b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+@@ -237,7 +237,7 @@ void QPropertyTypeMismatch::VisitMacroExpands(const clang::Token &MacroNameTok,
+ 
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (!text.empty() && text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/manuallevel/qrequiredresult-candidates.cpp b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+index 912dbaa0..6375bd7b 100644
+--- a/src/checks/manuallevel/qrequiredresult-candidates.cpp
++++ b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+@@ -65,7 +65,7 @@ void QRequiredResultCandidates::VisitDecl(clang::Decl *decl)
+ 
+ 
+     if (returnClass == classDecl) {
+-        const std::string methodName = clazy::name(method);
++        const std::string methodName = static_cast<std::string>(clazy::name(method));
+         if (methodName.empty()) // fixes assert
+             return;
+ 
+diff --git a/src/checks/manuallevel/qt-keywords.cpp b/src/checks/manuallevel/qt-keywords.cpp
+index e792e95a..b60752c9 100644
+--- a/src/checks/manuallevel/qt-keywords.cpp
++++ b/src/checks/manuallevel/qt-keywords.cpp
+@@ -59,12 +59,12 @@ void QtKeywords::VisitMacroExpands(const Token &macroNameTok, const SourceRange
+     }
+ 
+     static const vector<StringRef> keywords = { "foreach", "signals", "slots", "emit" };
+-    std::string name = ii->getName();
++    std::string name = static_cast<std::string>(ii->getName());
+     if (!clazy::contains(keywords, name))
+         return;
+ 
+     // Make sure the macro is Qt's. It must be defined in Qt's headers, not 3rdparty
+-    std::string qtheader = sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc()));
++    std::string qtheader = static_cast<std::string>(sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc())));
+     if (!clazy::endsWith(qtheader, "qglobal.h") && !clazy::endsWith(qtheader, "qobjectdefs.h"))
+         return;
+ 
+diff --git a/src/checks/manuallevel/reserve-candidates.cpp b/src/checks/manuallevel/reserve-candidates.cpp
+index 389cac5a..92e4491c 100644
+--- a/src/checks/manuallevel/reserve-candidates.cpp
++++ b/src/checks/manuallevel/reserve-candidates.cpp
+@@ -78,7 +78,8 @@ static bool isCandidateMethod(CXXMethodDecl *methodDecl)
+     if (!classDecl)
+         return false;
+ 
+-    if (!clazy::equalsAny(clazy::name(methodDecl), { "append", "push_back", "push", "operator<<", "operator+=" }))
++    if (!clazy::equalsAny(static_cast<std::string>(clazy::name(methodDecl)),
++                 { "append", "push_back", "push", "operator<<", "operator+=" }))
+         return false;
+ 
+     if (!clazy::isAReserveClass(classDecl))
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
new file mode 100644
index 00000000000..28cbb60b091
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
@@ -0,0 +1,28 @@
+From 25aa102cc49def9573ffbed88155589cd60a2e8f Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Fri, 5 Jun 2020 16:52:53 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10 (clazy-standalone)
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+---
+ src/checks/manuallevel/jnisignatures.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/checks/manuallevel/jnisignatures.cpp b/src/checks/manuallevel/jnisignatures.cpp
+index 81e61d48..5d4fe203 100644
+--- a/src/checks/manuallevel/jnisignatures.cpp
++++ b/src/checks/manuallevel/jnisignatures.cpp
+@@ -103,7 +103,7 @@ void JniSignatures::checkFunctionCall(Stmt *stm)
+         return;
+     }
+ 
+-    const std::string name = clazy::name(funDecl);
++    const std::string name = static_cast<std::string>(clazy::name(funDecl));
+ 
+     if (name == "callObjectMethod" || name == "callMethod") {
+         checkArgAt(callExpr, 0, methodNameRegex, "Invalid method name");
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 4d8557be669..5af2b918e14 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.7
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"
@@ -12,3 +12,9 @@ homepage="https://cgit.kde.org/clazy.git/about/"
 distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
 checksum=754da5815f769dd6b72a040a2430525c93f294eb7769c78271603df9614f1b21
 nocross="Clang cannot be installed as makedep"
+
+post_extract() {
+	for i in ${FILESDIR}/clazy-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}

From 707f6512d487fee86031eb7e189df1eccc27e175 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 15:19:37 +0100
Subject: [PATCH 20/23] include-what-you-use: rebuild for llvm11

---
 ...de-what-you-use-001-llvm11-stringref.patch | 146 ++++++++++++++++++
 ...ude-what-you-use-002-clang-astdumper.patch |  54 +++++++
 srcpkgs/include-what-you-use/template         |   8 +-
 3 files changed, 207 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch

diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..171dca28e34
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
@@ -0,0 +1,146 @@
+From 53487d209729d5781007dc0fd6076dc585cb3727 Mon Sep 17 00:00:00 2001
+From: Andrea Bocci <andrea.bocci@cern.ch>
+Date: Fri, 28 Feb 2020 17:45:03 +0100
+Subject: [PATCH] Add explicit conversion from llvm::StringRef to std::string
+
+llvm/llvm-project@777180a makes the llvm::StringRef conversion operator
+to std::string explicit.
+These changes add a call to the str() method to perform the conversion.
+
+Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
+---
+ iwyu_driver.cc       | 2 +-
+ iwyu_globals.cc      | 4 ++--
+ iwyu_lexer_utils.cc  | 2 +-
+ iwyu_location_util.h | 2 +-
+ iwyu_output.cc       | 2 +-
+ iwyu_path_util.cc    | 6 +++---
+ iwyu_preprocessor.cc | 4 ++--
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/iwyu_driver.cc b/iwyu_driver.cc
+index bd163144..42fea35b 100644
+--- a/iwyu_driver.cc
++++ b/iwyu_driver.cc
+@@ -79,7 +79,7 @@ std::string GetExecutablePath(const char *Argv0) {
+ }
+ 
+ const char *SaveStringInSet(std::set<std::string> &SavedStrings, StringRef S) {
+-  return SavedStrings.insert(S).first->c_str();
++  return SavedStrings.insert(S.str()).first->c_str();
+ }
+ 
+ void ExpandArgsFromBuf(const char *Arg,
+diff --git a/iwyu_globals.cc b/iwyu_globals.cc
+index 0f58b4dc..26998966 100644
+--- a/iwyu_globals.cc
++++ b/iwyu_globals.cc
+@@ -293,7 +293,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+   for (auto it = header_search->system_dir_begin();
+        it != header_search->system_dir_end(); ++it) {
+     if (const DirectoryEntry* entry = it->getDir()) {
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map[path] = HeaderSearchPath::kSystemPath;
+     }
+   }
+@@ -303,7 +303,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+       // search_dir_begin()/end() includes both system and user paths.
+       // If it's a system path, it's already in the map, so everything
+       // new is a user path.  The insert only 'takes' for new entries.
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map.insert(make_pair(path, HeaderSearchPath::kUserPath));
+     }
+   }
+diff --git a/iwyu_lexer_utils.cc b/iwyu_lexer_utils.cc
+index fcea2d28..648c9da8 100644
+--- a/iwyu_lexer_utils.cc
++++ b/iwyu_lexer_utils.cc
+@@ -70,7 +70,7 @@ SourceLocation GetLocationAfter(
+ string GetIncludeNameAsWritten(
+     SourceLocation include_loc,
+     const CharacterDataGetterInterface& data_getter) {
+-  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter);
++  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter).str();
+   if (data.empty())
+     return data;
+   string::size_type endpos = string::npos;
+diff --git a/iwyu_location_util.h b/iwyu_location_util.h
+index 3892a424..6f8cf81c 100644
+--- a/iwyu_location_util.h
++++ b/iwyu_location_util.h
+@@ -89,7 +89,7 @@ bool IsInScratchSpace(clang::SourceLocation loc);
+ 
+ inline string GetFilePath(const clang::FileEntry* file) {
+   return (IsBuiltinFile(file) ? "<built-in>" :
+-          NormalizeFilePath(file->getName()));
++          NormalizeFilePath(file->getName().str()));
+ }
+ 
+ //------------------------------------------------------------
+diff --git a/iwyu_output.cc b/iwyu_output.cc
+index ca145710..8666c26c 100644
+--- a/iwyu_output.cc
++++ b/iwyu_output.cc
+@@ -168,7 +168,7 @@ string GetKindName(const clang::TagDecl* tag_decl) {
+   if (const FakeNamedDecl* fake = FakeNamedDeclIfItIsOne(named_decl)) {
+     return fake->kind_name();
+   }
+-  return tag_decl->getKindName();
++  return tag_decl->getKindName().str();
+ }
+ 
+ string GetQualifiedNameAsString(const clang::NamedDecl* named_decl) {
+diff --git a/iwyu_path_util.cc b/iwyu_path_util.cc
+index ab4fc800..9987ea47 100644
+--- a/iwyu_path_util.cc
++++ b/iwyu_path_util.cc
+@@ -134,7 +134,7 @@ string NormalizeFilePath(const string& path) {
+   std::replace(normalized.begin(), normalized.end(), '\\', '/');
+ #endif
+ 
+-  return normalized.str();
++  return normalized.str().str();
+ }
+ 
+ string NormalizeDirPath(const string& path) {
+@@ -154,14 +154,14 @@ string MakeAbsolutePath(const string& path) {
+   std::error_code error = llvm::sys::fs::make_absolute(absolute_path);
+   CHECK_(!error);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string MakeAbsolutePath(const string& base_path, const string& relative_path) {
+   llvm::SmallString<128> absolute_path(base_path);
+   llvm::sys::path::append(absolute_path, relative_path);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string GetParentPath(const string& path) {
+diff --git a/iwyu_preprocessor.cc b/iwyu_preprocessor.cc
+index 58e78595..88b93144 100644
+--- a/iwyu_preprocessor.cc
++++ b/iwyu_preprocessor.cc
+@@ -313,7 +313,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+       break;
+     }
+     const string filename = GetSourceTextUntilEndOfLine(current_loc,
+-                                                        DefaultDataGetter());
++                                                        DefaultDataGetter()).str();
+     // Use "" or <> based on where the file lives.
+     string quoted_private_include;
+     if (IsSystemIncludeFile(GetFilePath(current_loc)))
+@@ -332,7 +332,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+     }
+ 
+     string after_text = GetSourceTextUntilEndOfLine(current_loc,
+-                                                    DefaultDataGetter());
++                                                    DefaultDataGetter()).str();
+     const string::size_type close_brace_pos = after_text.find('}');
+     if (close_brace_pos == string::npos) {
+       Warn(current_loc, "@headername directive missing a closing brace");
diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
new file mode 100644
index 00000000000..663a883fa91
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
@@ -0,0 +1,54 @@
+From 30549c6931972456d1e09ff5dbeecd258a8df72b Mon Sep 17 00:00:00 2001
+From: Kim Grasman <kim.grasman@gmail.com>
+Date: Thu, 9 Jul 2020 18:47:56 +0200
+Subject: [PATCH] Implement Stmt printing with ASTDumper
+
+The Clang API changed in commit 473fbc90d1fbf17e so that Stmt::dump
+takes an ASTContext instead of a SourceManager.
+
+Rather than wire a global ASTContext, reimplement PrintableStmt and
+PrintStmt to duplicate the most trivial implementations not requiring
+ASTContext.
+
+No functional change.
+---
+ iwyu_ast_util.cc | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/iwyu_ast_util.cc b/iwyu_ast_util.cc
+index d3d4dd1f..b19a11fb 100644
+--- a/iwyu_ast_util.cc
++++ b/iwyu_ast_util.cc
+@@ -25,6 +25,7 @@
+ #include "llvm/Support/Casting.h"
+ #include "llvm/Support/raw_ostream.h"
+ #include "clang/AST/ASTContext.h"
++#include "clang/AST/ASTDumper.h"
+ #include "clang/AST/CanonicalType.h"
+ #include "clang/AST/Decl.h"
+ #include "clang/AST/DeclBase.h"
+@@ -46,6 +47,7 @@ namespace clang {
+ class FileEntry;
+ }  // namespace clang
+ 
++using clang::ASTDumper;
+ using clang::BlockPointerType;
+ using clang::CXXConstructExpr;
+ using clang::CXXConstructorDecl;
+@@ -450,12 +452,14 @@ string PrintableDecl(const Decl* decl, bool terse/*=true*/) {
+ string PrintableStmt(const Stmt* stmt) {
+   std::string buffer;
+   raw_string_ostream ostream(buffer);
+-  stmt->dump(ostream, *GlobalSourceManager());
++  ASTDumper dumper(ostream, /*ShowColors=*/false);
++  dumper.Visit(stmt);
+   return ostream.str();
+ }
+ 
+ void PrintStmt(const Stmt* stmt) {
+-  stmt->dump(*GlobalSourceManager());  // This prints to errs().
++  ASTDumper dumper(llvm::errs(), /*ShowColors=*/false);
++  dumper.Visit(stmt);
+ }
+ 
+ string PrintableType(const Type* type) {
diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 22c9d09d091..3811309bdde 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.14
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
@@ -15,6 +15,12 @@ distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.
 checksum=43184397db57660c32e3298a6b1fd5ab82e808a1f5ab0591d6745f8d256200ef
 python_version=3
 
+post_extract() {
+	for i in ${FILESDIR}/include-what-you-use-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
+
 post_install() {
 	vlicense LICENSE.TXT
 }

From f932b52169f6a182b2e3645017e70bff9e00016c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 16:17:54 +0100
Subject: [PATCH 21/23] bpftrace: update to 0.11.2

---
 ...trace-001-six-args-bpf_attach_uprobe.patch | 126 +++++++++++++++
 ...ace-002-seven-args-bpf_attach_uprobe.patch | 148 ++++++++++++++++++
 srcpkgs/bpftrace/template                     |  10 +-
 3 files changed, 282 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch

diff --git a/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..e2b1ad1351b
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
@@ -0,0 +1,126 @@
+From 52fb793c6423c19696e07cc14ad5f9182f7eca0e Mon Sep 17 00:00:00 2001
+From: Viktor Malik <viktor.malik@gmail.com>
+Date: Wed, 12 Aug 2020 09:45:29 +0200
+Subject: [PATCH] Feature-detect bpf_attach_kprobe signature
+
+The function has 6 parameters in current versions of BCC and 5
+parameters in older versions.
+
+This is detected in CMake using CHECK_CXX_SOURCE_COMPILES. For static
+compilation, we also need to retrieve and link static libbpf, libelf,
+and libz. This may cause libbpf, libelf and libz to be searched for
+twice, but it should be fine since CMake caches results.
+
+Fixes iovisor#1027.
+---
+ cmake/FindLibBcc.cmake | 24 ++++++++++++++++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 31 ++++++++++++++-----------------
+ tests/CMakeLists.txt   |  3 +++
+ 4 files changed, 44 insertions(+), 17 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 9d30b04bc..ec216271d 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -70,3 +70,27 @@ include (FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBcc "Please install the bcc library package, which is required. Depending on your distro, it may be called bpfcclib or bcclib (Ubuntu), bcc-devel (Fedora), or something else. If unavailable, install bcc from source (github.com/iovisor/bcc)."
+   LIBBCC_LIBRARIES
+   LIBBCC_INCLUDE_DIRS)
++
++# Check bpf_attach_kprobe signature
++if(${LIBBCC_FOUND})
++if(STATIC_LINKING)
++  # libbcc.a is not statically linked with libbpf.a, libelf.a, and libz.a.
++  # If we do a static bpftrace build, we must link them in.
++  find_package(LibBpf)
++  find_package(LibElf)
++  find_package(LibZ)
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_BPF_LIBRARY_STATIC} ${LIBBPF_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBZ_LIBRARIES})
++else()
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_LIBRARIES})
++endif()
++INCLUDE(CheckCXXSourceCompiles)
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_kprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++SET(CMAKE_REQUIRED_LIBRARIES)
++endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 647a23f1c..448a045fc 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -80,6 +80,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 587a11576..afad9ed18 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -754,26 +754,23 @@ void AttachedProbe::load_prog()
+   }
+ }
+ 
+-// XXX(mmarchini): bcc changed the signature of bpf_attach_kprobe, adding a new
+-// int parameter at the end. Since there's no reliable way to feature-detect
+-// this, we create a function pointer with the long signature and cast
+-// bpf_attach_kprobe to this function pointer. If we're on an older bcc
+-// version, bpf_attach_kprobe call will be augmented with an extra register
+-// being used for the last parameter, even though this register won't be used
+-// inside the function. Since the register won't be used this is kinda safe,
+-// although not ideal.
+-typedef int (*attach_probe_wrapper_signature)(int, enum bpf_probe_attach_type, const char*, const char*, uint64_t, int);
+-
+ void AttachedProbe::attach_kprobe(bool safe_mode)
+ {
+   resolve_offset_kprobe(safe_mode);
+-  int perf_event_fd = cast_signature<attach_probe_wrapper_signature>(
+-      &bpf_attach_kprobe)(progfd_,
+-                          attachtype(probe_.type),
+-                          eventname().c_str(),
+-                          probe_.attach_point.c_str(),
+-                          offset_,
+-                          0);
++#ifdef LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_,
++                                        0);
++#else
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_);
++#endif
+ 
+   if (perf_event_fd < 0) {
+     if (probe_.orig_name != probe_.name) {
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 3688b8487..84daeb2aa 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -102,6 +102,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace_test ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..2cc55c86555
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
@@ -0,0 +1,148 @@
+From c7dbab451484b96178da1a8c43330154ce4c9d7a Mon Sep 17 00:00:00 2001
+From: Daniel Xu <dxu@dxuuu.xyz>
+Date: Wed, 14 Oct 2020 17:09:46 -0700
+Subject: [PATCH] Detect 7 arg bpf_attach_uprobe() API
+
+The 7th arg allows us to specify the usdt semaphore location.
+---
+ cmake/FindLibBcc.cmake | 11 +++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 42 ++++++++++++++++++++++++++++++++++--------
+ src/main.cpp           |  6 ++++++
+ tests/CMakeLists.txt   |  3 +++
+ 5 files changed, 57 insertions(+), 8 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 4c09a8ca2..92cedab5e 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -7,6 +7,8 @@
+ #  LIBBCC_DEFINITIONS - Compiler switches required for using libbcc
+ #  LIBBCC_BPF_LIBRARY_STATIC - libbpf static library (for static compilation)
+ #  LIBBCC_LOADER_LIBRARY_STATIC - libbcc helper static library (for static compilation)
++#  LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++#  LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ #
+ # Note that the shared libbcc binary has libbpf and bcc_loader already compiled in but
+ # the static doesn't. So when creating a static build those have to be included too.
+@@ -94,6 +96,15 @@ int main(void) {
+   return 0;
+ }
+ " LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_uprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ SET(CMAKE_REQUIRED_INCLUDES)
+ endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 9162356e3..cef94d144 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -88,6 +88,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 93fbfa876..a5d8bc56d 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -698,12 +698,23 @@ void AttachedProbe::attach_uprobe(bool safe_mode)
+ {
+   resolve_offset_uprobe(safe_mode);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_,
+-                                        attachtype(probe_.type),
+-                                        eventname().c_str(),
+-                                        probe_.path.c_str(),
+-                                        offset_,
+-                                        probe_.pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+     throw std::runtime_error("Error attaching probe: " + probe_.name);
+@@ -812,8 +823,23 @@ void AttachedProbe::attach_usdt(int pid)
+ 
+   offset_ = resolve_offset(probe_.path, probe_.attach_point, probe_.loc);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_, attachtype(probe_.type),
+-      eventname().c_str(), probe_.path.c_str(), offset_, pid == 0 ? -1 : pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+   {
+diff --git a/src/main.cpp b/src/main.cpp
+index 48fcf5aa0..09f4d9677 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -162,6 +162,12 @@ static int info()
+             << "yes" << std::endl;
+ #else
+             << "no" << std::endl;
++#endif
++  std::cerr << "  bcc bpf_attach_uprobe refcount: "
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++            << "yes" << std::endl;
++#else
++            << "no" << std::endl;
+ #endif
+   std::cerr << "  libbpf: "
+ #ifdef HAVE_LIBBPF
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index ace5ff106..332eba2b5 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -116,6 +116,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index d8367fa5c03..44e6c174107 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,6 +1,6 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
-version=0.11.1
+version=0.11.2
 revision=1
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
@@ -12,7 +12,13 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="Apache-2.0"
 homepage="https://github.com/iovisor/bpftrace/"
 distfiles="https://github.com/iovisor/bpftrace/archive/v${version}.tar.gz"
-checksum=98efc9396451bc1a4f73378cec4755e07e7718cb5d698472606f5ffc2b9e48e8
+checksum=1f0fc30073547e3b285e1a373aa469bb18d3ba27f8c05f91016df0ca84f77f90
+
+post_extract() {
+	for i in ${FILESDIR}/bpftrace-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
 
 post_install() {
 	# clashes with bcc-tools

From 33c9bc04ccf3d1af0e58db890dc8d6c9443d0324 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 19:29:15 +0100
Subject: [PATCH 22/23] beignet: rebuild for llvm11

---
 srcpkgs/beignet/patches/llvm11.patch | 945 +++++++++++++++++++++++++++
 srcpkgs/beignet/template             |   2 +-
 2 files changed, 946 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/beignet/patches/llvm11.patch

diff --git a/srcpkgs/beignet/patches/llvm11.patch b/srcpkgs/beignet/patches/llvm11.patch
new file mode 100644
index 00000000000..9f328267698
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm11.patch
@@ -0,0 +1,945 @@
+Source: Snektron
+
+There were a few changes required for LLVM 11:
+* llvm::StringRef requires .str(), implicit conversion was removed
+* llvm::CallSite was removed, but the required methods are available on llvm::CallInst
+* VectorTyID was split into FixedVectorTyID and ScalableVectorTyID, FixedVectorTyID was used
+* CallInst::getCalledValue() was renamed to CallInst::getCalledOperand()
+* Implicit conversion from MaybeAlign to Align was removed, so MaybeAlign::valueOrOne was used instead.
+
+--- backend/src/llvm/StripAttributes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/StripAttributes.cpp	2020-11-09 19:04:19.641897141 +0100
+@@ -107,9 +107,8 @@
+        BB != E; ++BB) {
+     for (BasicBlock::iterator Inst = BB->begin(), E = BB->end();
+          Inst != E; ++Inst) {
+-      CallSite Call(&*Inst);
+-      if (Call)
+-        Call.setCallingConv(CallingConv::C);
++      if (CallInst* callInst = dyn_cast<CallInst>(&*Inst))
++        callInst->setCallingConv(CallingConv::C);
+     }
+   }
+
+--- backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 17:04:09.633753428 +0100
+@@ -98,7 +98,7 @@
+         if (callFunc && callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        std::string fnName = call->getCalledValue()->stripPointerCasts()->getName();
++        std::string fnName = call->getCalledOperand()->stripPointerCasts()->getName().str();
+
+         if (!MFS.insert(fnName).second) {
+           continue;
+--- backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 19:01:49.201915008 +0100
+@@ -45,7 +45,7 @@
+       return NULL;
+
+     /* This is a fake, to check the function bitcast is for block or not */
+-    std::string fnName = Fn->getName();
++    std::string fnName = Fn->getName().str();
+     if(fnName.find("_invoke") == std::string::npos)
+       return NULL;
+
+@@ -119,18 +119,18 @@
+       ParamTys.push_back(ty);
+     }
+     FunctionType* NewFT = FunctionType::get(Fn->getReturnType(), ParamTys, false);
+-    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName());
++    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName().str());
+     SmallVector<ReturnInst*, 8> Returns;
+
+     Function::arg_iterator NewFnArgIt = NewFn->arg_begin();
+     for (Function::arg_iterator I = Fn->arg_begin(), E = Fn->arg_end(); I != E; ++I) {
+-      std::string ArgName = I->getName();
++      std::string ArgName = I->getName().str();
+       NewFnArgIt->setName(ArgName);
+       VMap[&*I] = &(*NewFnArgIt++);
+     }
+     CloneFunctionInto(NewFn, Fn, VMap, /*ModuleLevelChanges=*/true, Returns);
+
+-    Fn->setName("__d" + Fn->getName());
++    Fn->setName("__d" + Fn->getName().str());
+     mod->getFunctionList().push_back(NewFn);
+     //mod->getOrInsertFunction(NewFn->getName(), NewFn->getFunctionType(),
+     //                         NewFn->getAttributes());
+@@ -147,7 +147,7 @@
+       argTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argBaseTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argTypeQuals.push_back(llvm::MDString::get(Context, ""));
+-      argNames.push_back(llvm::MDString::get(Context, I->getName()));
++      argNames.push_back(llvm::MDString::get(Context, I->getName().str()));
+     }
+
+     //If run to here, llvm version always > 3.9, add the version check just for build.
+@@ -198,7 +198,7 @@
+            * invoke pointer to store the index in the unit's block functions index.*/
+           Function *Fn = dyn_cast<Function>(bt->getOperand(0));
+
+-          std::string fnName = Fn->getName();
++          std::string fnName = Fn->getName().str();
+           int index = -1;
+           for(size_t i=0; i<unit.blockFuncs.size(); i++) {
+             if(unit.blockFuncs[i] == fnName) {
+@@ -241,7 +241,7 @@
+             //unnamed call function, parse the use to find the define of called function
+             SmallVector<Value*, 16> args(CI->op_begin(), CI->op_end()-1);
+
+-            Value *v = CI->getCalledValue();
++            Value *v = CI->getCalledOperand();
+             BitCastInst* bt = dyn_cast<BitCastInst>(v);
+             if(bt == NULL)
+               continue;
+@@ -316,7 +316,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+
+@@ -332,7 +332,7 @@
+           } else {
+             //handle enqueue_kernel function call
+             Function *fn = CI->getCalledFunction();
+-            if (fn->getName().find("enqueue_kernel") == std::string::npos)
++            if (fn->getName().str().find("enqueue_kernel") == std::string::npos)
+               continue;
+
+             //block parameter's index, 3 or 6
+@@ -361,7 +361,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+             } else if(isa<AllocaInst>(block)) {
+--- backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 18:33:50.919114327 +0100
+@@ -376,7 +376,7 @@
+           GBE_ASSERT(index == 0);
+           return this->_newScalar(value, key, type, index, uniform);
+           break;
+-        case Type::VectorTyID:
++        case Type::FixedVectorTyID:
+         {
+           auto vectorType = cast<VectorType>(type);
+           auto elementType = vectorType->getElementType();
+@@ -743,20 +743,20 @@
+ #undef DECL_VISIT_FN
+
+     // Emit rounding instructions from gen native function
+-    void emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode);
++    void emitRoundingCallInst(CallInst &I, ir::Opcode opcode);
+     // Emit unary instructions from gen native function
+-    void emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
++    void emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
+     // Emit unary instructions from gen native function
+-    void emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode);
++    void emitAtomicInst(CallInst &I, ir::AtomicOps opcode);
+     // Emit workgroup instructions
+-    void emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+-    void emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+
+-    uint8_t appendSampler(CallSite::arg_iterator AI);
++    uint8_t appendSampler(User::op_iterator AI);
+     uint8_t getImageID(CallInst &I);
+
+     // These instructions are not supported at all
+@@ -1320,13 +1320,13 @@
+ #endif
+
+       if(typeNameNode) {
+-        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+       }
+       if(typeBaseNameNode) {
+-        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+       }
+-      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
+-      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
++      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+       bool isImage = llvmInfo.isImageType();
+       bool isPipe = llvmInfo.isPipeType();
+       if (I->getType()->isPointerTy() || isImage || isPipe) {
+@@ -1531,7 +1531,7 @@
+             EltTy = getEltType(EltTy, TypeIndex);
+         }
+
+-        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName());
++        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName().str());
+         unsigned int defOffset = cc.getOffset();
+         relocs.push_back(ir::RelocEntry(offset, defOffset + constantOffset));
+
+@@ -1546,7 +1546,7 @@
+       return;
+     }
+     if (isa<GlobalVariable>(c)) {
+-      ir::Constant cc = unit.getConstantSet().getConstant(c->getName());
++      ir::Constant cc = unit.getConstantSet().getConstant(c->getName().str());
+       unsigned int defOffset = cc.getOffset();
+
+       relocs.push_back(ir::RelocEntry(offset, defOffset));
+@@ -1609,7 +1609,7 @@
+           }
+           break;
+         }
+-      case Type::TypeID::VectorTyID:
++      case Type::TypeID::FixedVectorTyID:
+         {
+           const ConstantDataSequential *cds = dyn_cast<ConstantDataSequential>(c);
+           const VectorType *vecTy = cast<VectorType>(type);
+@@ -1936,7 +1936,7 @@
+       case Type::PointerTyID:
+         regTranslator.newScalar(value, key, 0, uniform);
+         break;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         auto vectorType = cast<VectorType>(type);
+         const uint32_t elemNum = vectorType->getNumElements();
+@@ -2395,7 +2395,7 @@
+ #endif
+         }
+         if(typeNameNode) {
+-          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+           //LLVM 3.9 image's type name include access qual, don't match OpenCL spec, erase them.
+           std::vector<std::string> filters = {"__read_only ", "__write_only "};
+           for (uint32_t i = 0; i < filters.size(); i++) {
+@@ -2406,16 +2406,16 @@
+           }
+         }
+         if(typeBaseNameNode){
+-          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+         }
+         if(accessQualNode) {
+-          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString();
++          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString().str();
+         }
+         if(typeQualNode) {
+-          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+         }
+         if(argNameNode){
+-          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString();
++          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString().str();
+         }
+
+         // function arguments are uniform values.
+@@ -3010,7 +3010,7 @@
+         } else {
+           this->newRegister(const_cast<GlobalVariable*>(&v));
+           ir::Register reg = regTranslator.getScalar(const_cast<GlobalVariable*>(&v), 0);
+-          ir::Constant &con = unit.getConstantSet().getConstant(v.getName());
++          ir::Constant &con = unit.getConstantSet().getConstant(v.getName().str());
+           if (!legacyMode) {
+             ir::Register regload = ctx.reg(getFamily(getType(ctx, v.getType())));
+             ctx.LOADI(getType(ctx, v.getType()), regload, ctx.newIntegerImmediate(con.getOffset(), getType(ctx, v.getType())));
+@@ -3212,7 +3212,7 @@
+         GBE_ASSERTM(false, "Unsupported calling convention");
+     }
+
+-    ctx.startFunction(F.getName());
++    ctx.startFunction(F.getName().str());
+
+     ir::Function &fn = ctx.getFunction();
+     this->regTranslator.clear();
+@@ -3810,9 +3810,9 @@
+
+   void GenWriter::regAllocateCallInst(CallInst &I) {
+     Value *dst = &I;
+-    Value *Callee = I.getCalledValue();
++    Value *Callee = I.getCalledOperand();
+     GBE_ASSERT(ctx.getFunction().getProfile() == ir::PROFILE_OCL);
+-    GBE_ASSERT(isa<InlineAsm>(I.getCalledValue()) == false);
++    GBE_ASSERT(isa<InlineAsm>(I.getCalledOperand()) == false);
+     if(I.getNumArgOperands()) GBE_ASSERT(I.hasStructRetAttr() == false);
+
+     // We only support a small number of intrinsics right now
+@@ -3870,7 +3870,7 @@
+       }
+     }
+     // Get the name of the called function and handle it
+-    const std::string fnName = Callee->stripPointerCasts()->getName();
++    const std::string fnName = Callee->stripPointerCasts()->getName().str();
+     auto genIntrinsicID = intrinsicMap.find(fnName);
+     switch (genIntrinsicID) {
+       case GEN_OCL_GET_GROUP_ID0:
+@@ -4166,7 +4166,7 @@
+     };
+   }
+
+-  void GenWriter::emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode) {
++  void GenWriter::emitRoundingCallInst(CallInst &I, ir::Opcode opcode) {
+     if (I.getType()->isHalfTy()) {
+       const ir::Register src = this->getRegister(I.getOperand(0));
+       const ir::Register srcFloat = ctx.reg(ir::FAMILY_DWORD);
+@@ -4177,14 +4177,14 @@
+       ctx.F32TO16(ir::TYPE_U16, ir::TYPE_FLOAT, dst, dstFloat);
+     } else {
+       GBE_ASSERT(I.getType()->isFloatTy());
+-      this->emitUnaryCallInst(I,CS,opcode);
++      this->emitUnaryCallInst(I,opcode);
+     }
+   }
+
+-  void GenWriter::emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
++  void GenWriter::emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+     GBE_ASSERT(AI != AE);
+     const ir::Register src = this->getRegister(*AI);
+@@ -4293,9 +4293,9 @@
+     this->emitAtomicInstHelper(opcode, type, dst, llvmPtr, payloadTuple);
+   }
+
+-  void GenWriter::emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitAtomicInst(CallInst &I, ir::AtomicOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+     Value *llvmPtr = *AI;
+     ir::AddressSpace addrSpace = addressSpaceLLVMToGen(llvmPtr->getType()->getPointerAddressSpace());
+@@ -4348,7 +4348,7 @@
+     }
+   }
+
+-  void GenWriter::emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
++  void GenWriter::emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
+     ir::Function &f = ctx.getFunction();
+
+     if (f.getwgBroadcastSLM() < 0 && opcode == ir::WORKGROUP_OP_BROADCAST) {
+@@ -4378,8 +4378,8 @@
+       GBE_ASSERT(f.gettidMapSLM() >= 0);
+     }
+
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4391,14 +4391,14 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 3);
+       ctx.WORKGROUP(opcode, (uint32_t)f.gettidMapSLM(), getRegister(&I), srcTuple, 3, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+         src[i] = this->getRegister(*(AI++));
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.WORKGROUP(ir::WORKGROUP_OP_BROADCAST, (uint32_t)f.getwgBroadcastSLM(), getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4423,9 +4423,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4435,7 +4435,7 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 1);
+       ctx.SUBGROUP(opcode, getRegister(&I), srcTuple, 1, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       GBE_ASSERT(argNum == 2);
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+@@ -4443,7 +4443,7 @@
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.SUBGROUP(ir::WORKGROUP_OP_BROADCAST, getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4466,9 +4466,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     Value *llvmPtr = *(AI++);
+@@ -4522,9 +4522,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     const uint8_t imageID = getImageID(I);
+@@ -4557,7 +4557,7 @@
+
+   /* append a new sampler. should be called before any reference to
+    * a sampler_t value. */
+-  uint8_t GenWriter::appendSampler(CallSite::arg_iterator AI) {
++  uint8_t GenWriter::appendSampler(User::op_iterator AI) {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+     CallInst *TC = dyn_cast<CallInst>(*AI);
+     Constant *CPV = TC ? dyn_cast<Constant>(TC->getOperand(0)) : NULL;
+@@ -4595,10 +4595,9 @@
+         const ir::Function &fn = ctx.getFunction();
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+         switch (F->getIntrinsicID()) {
+           case Intrinsic::stacksave:
+@@ -4764,17 +4763,17 @@
+             ctx.MAD(srcType, dst, src0, src1, src2);
+           }
+           break;
+-          case Intrinsic::sqrt: this->emitUnaryCallInst(I,CS,ir::OP_SQR); break;
+-          case Intrinsic::ceil: this->emitRoundingCallInst(I,CS,ir::OP_RNDU); break;
+-          case Intrinsic::trunc: this->emitRoundingCallInst(I,CS,ir::OP_RNDZ); break;
+-          case Intrinsic::rint: this->emitRoundingCallInst(I,CS,ir::OP_RNDE); break;
+-          case Intrinsic::floor: this->emitRoundingCallInst(I,CS,ir::OP_RNDD); break;
+-          case Intrinsic::sin: this->emitUnaryCallInst(I,CS,ir::OP_SIN); break;
+-          case Intrinsic::cos: this->emitUnaryCallInst(I,CS,ir::OP_COS); break;
+-          case Intrinsic::log2: this->emitUnaryCallInst(I,CS,ir::OP_LOG); break;
+-          case Intrinsic::exp2: this->emitUnaryCallInst(I,CS,ir::OP_EXP); break;
++          case Intrinsic::sqrt: this->emitUnaryCallInst(I,ir::OP_SQR); break;
++          case Intrinsic::ceil: this->emitRoundingCallInst(I,ir::OP_RNDU); break;
++          case Intrinsic::trunc: this->emitRoundingCallInst(I,ir::OP_RNDZ); break;
++          case Intrinsic::rint: this->emitRoundingCallInst(I,ir::OP_RNDE); break;
++          case Intrinsic::floor: this->emitRoundingCallInst(I,ir::OP_RNDD); break;
++          case Intrinsic::sin: this->emitUnaryCallInst(I,ir::OP_SIN); break;
++          case Intrinsic::cos: this->emitUnaryCallInst(I,ir::OP_COS); break;
++          case Intrinsic::log2: this->emitUnaryCallInst(I,ir::OP_LOG); break;
++          case Intrinsic::exp2: this->emitUnaryCallInst(I,ir::OP_EXP); break;
+           case Intrinsic::bswap:
+-            this->emitUnaryCallInst(I,CS,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
++            this->emitUnaryCallInst(I,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
+           case Intrinsic::pow:
+           {
+             const ir::Register src0 = this->getRegister(*AI); ++AI;
+@@ -4794,21 +4793,20 @@
+         }
+       } else {
+         // Get the name of the called function and handle it
+-        Value *Callee = I.getCalledValue();
+-        const std::string fnName = Callee->stripPointerCasts()->getName();
++        Value *Callee = I.getCalledOperand();
++        const std::string fnName = Callee->stripPointerCasts()->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+
+         switch (genIntrinsicID) {
+-          case GEN_OCL_FBH: this->emitUnaryCallInst(I,CS,ir::OP_FBH, ir::TYPE_U32); break;
+-          case GEN_OCL_FBL: this->emitUnaryCallInst(I,CS,ir::OP_FBL, ir::TYPE_U32); break;
+-          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,CS,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
++          case GEN_OCL_FBH: this->emitUnaryCallInst(I,ir::OP_FBH, ir::TYPE_U32); break;
++          case GEN_OCL_FBL: this->emitUnaryCallInst(I,ir::OP_FBL, ir::TYPE_U32); break;
++          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
+           case GEN_OCL_ABS:
+           {
+             const ir::Register src = this->getRegister(*AI);
+@@ -4915,8 +4913,8 @@
+             ctx.REGION(dst, src, x.getIntegerValue());
+             break;
+           }
+-          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,CS,ir::OP_RSQ); break;
+-          case GEN_OCL_RCP: this->emitUnaryCallInst(I,CS,ir::OP_RCP); break;
++          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,ir::OP_RSQ); break;
++          case GEN_OCL_RCP: this->emitUnaryCallInst(I,ir::OP_RCP); break;
+           case GEN_OCL_FORCE_SIMD8: ctx.setSimdWidth(8); break;
+           case GEN_OCL_FORCE_SIMD16: ctx.setSimdWidth(16); break;
+           case GEN_OCL_LBARRIER: ctx.SYNC(ir::syncLocalBarrier); break;
+@@ -4947,31 +4945,31 @@
+             break;
+           }
+           case GEN_OCL_ATOMIC_ADD0:
+-          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_ADD); break;
++          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,ir::ATOMIC_OP_ADD); break;
+           case GEN_OCL_ATOMIC_SUB0:
+-          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_SUB); break;
++          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,ir::ATOMIC_OP_SUB); break;
+           case GEN_OCL_ATOMIC_AND0:
+-          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_AND); break;
++          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,ir::ATOMIC_OP_AND); break;
+           case GEN_OCL_ATOMIC_OR0:
+-          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_OR); break;
++          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,ir::ATOMIC_OP_OR); break;
+           case GEN_OCL_ATOMIC_XOR0:
+-          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XOR); break;
++          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,ir::ATOMIC_OP_XOR); break;
+           case GEN_OCL_ATOMIC_XCHG0:
+-          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XCHG); break;
++          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_XCHG); break;
+           case GEN_OCL_ATOMIC_INC0:
+-          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_INC); break;
++          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,ir::ATOMIC_OP_INC); break;
+           case GEN_OCL_ATOMIC_DEC0:
+-          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_DEC); break;
++          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,ir::ATOMIC_OP_DEC); break;
+           case GEN_OCL_ATOMIC_UMIN0:
+-          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMIN); break;
++          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMIN); break;
+           case GEN_OCL_ATOMIC_UMAX0:
+-          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMAX); break;
++          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMAX); break;
+           case GEN_OCL_ATOMIC_IMIN0:
+-          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMIN); break;
++          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMIN); break;
+           case GEN_OCL_ATOMIC_IMAX0:
+-          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMAX); break;
++          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMAX); break;
+           case GEN_OCL_ATOMIC_CMPXCHG0:
+-          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_CMPXCHG); break;
++          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_CMPXCHG); break;
+           case GEN_OCL_GET_IMAGE_WIDTH:
+           case GEN_OCL_GET_IMAGE_HEIGHT:
+           case GEN_OCL_GET_IMAGE_DEPTH:
+@@ -5429,48 +5427,48 @@
+             ctx.WAIT();
+             break;
+           }
+-          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ALL); break;
+-          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ANY); break;
++          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ALL); break;
++          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ANY); break;
+           case GEN_OCL_WORK_GROUP_BROADCAST:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_BROADCAST:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_LRP:
+           {
+             const ir::Register dst  = this->getRegister(&I);
+@@ -5484,69 +5482,69 @@
+             break;
+           }
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteMemInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteMemInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteMemInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteMemInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteMemInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteMemInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteMemInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteMemInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteImageInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteImageInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteImageInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteImageInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteImageInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteImageInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteImageInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteImageInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_GET_PIPE:
+           case GEN_OCL_MAKE_RID:
+           case GEN_OCL_GET_RID:
+--- backend/src/llvm/llvm_includes.hpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_includes.hpp	2020-11-09 19:00:09.955926795 +0100
+@@ -103,7 +103,6 @@
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+ #include "llvm/IR/Mangler.h"
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #include "llvm/IR/InstVisitor.h"
+ #include "llvm/IR/IRPrintingPasses.h"
+--- backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 19:10:37.141852308 +0100
+@@ -160,7 +160,7 @@
+     Value *vecPtr = Builder.CreateBitCast(ld->getPointerOperand(),
+                                         PointerType::get(vecTy, addrSpace));
+     LoadInst *vecValue = Builder.CreateLoad(vecPtr);
+-    vecValue->setAlignment(align);
++    vecValue->setAlignment(align.valueOrOne());
+
+     for (unsigned i = 0; i < size; ++i) {
+       Value *S = Builder.CreateExtractElement(vecValue, Builder.getInt32(i));
+@@ -251,7 +251,7 @@
+       return;
+     Value *newPtr = Builder.CreateBitCast(stPointer, PointerType::get(vecTy, addrSpace));
+     StoreInst *newST = Builder.CreateStore(parent, newPtr);
+-    newST->setAlignment(align);
++    newST->setAlignment(align.valueOrOne());
+   }
+
+   // Find the safe iterator we can point to. If reorder happens, we need to
+--- backend/src/llvm/llvm_passes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_passes.cpp	2020-11-09 18:48:55.997006837 +0100
+@@ -87,14 +87,14 @@
+   }
+
+   int32_t getPadding(int32_t offset, int32_t align) {
+-    return (align - (offset % align)) % align;
++    return (align - (offset % align)) % align;
+   }
+
+   uint32_t getAlignmentByte(const ir::Unit &unit, Type* Ty)
+   {
+     switch (Ty->getTypeID()) {
+       case Type::VoidTyID: NOT_SUPPORTED;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t elemNum = VecTy->getNumElements();
+@@ -138,7 +138,7 @@
+       case Type::HalfTyID:    return 16;
+       case Type::FloatTyID:   return 32;
+       case Type::DoubleTyID:  return 64;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t numElem = VecTy->getNumElements();
+@@ -184,10 +184,12 @@
+     Type *elementType = NULL;
+     if (PointerType* ptrType = dyn_cast<PointerType>(eltTy))
+       elementType = ptrType->getElementType();
+-    else if(SequentialType * seqType = dyn_cast<SequentialType>(eltTy))
+-      elementType = seqType->getElementType();
+-    else if(CompositeType * compTy= dyn_cast<CompositeType>(eltTy))
+-      elementType = compTy->getTypeAtIndex(index);
++    else if (ArrayType * arrType = dyn_cast<ArrayType>(eltTy))
++      elementType = arrType->getElementType();
++    else if(VectorType * vecType = dyn_cast<VectorType>(eltTy))
++      elementType = vecType->getElementType();
++    else if(StructType * structType = dyn_cast<StructType>(eltTy))
++      elementType = structType->getTypeAtIndex(index);
+     GBE_ASSERT(elementType);
+     return elementType;
+   }
+--- backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 18:57:52.618943105 +0100
+@@ -323,8 +323,7 @@
+
+   bool PrintfParser::parseOnePrintfInstruction(CallInst * call)
+   {
+-    CallSite CS(call);
+-    CallSite::arg_iterator CI_FMT = CS.arg_begin();
++    User::op_iterator CI_FMT = call->arg_begin();
+     int param_num = 0;
+
+     llvm::Constant* arg0 = dyn_cast<llvm::ConstantExpr>(*CI_FMT);
+@@ -341,7 +340,7 @@
+       return false;
+     }
+
+-    std::string fmt = fmt_arg->getAsCString();
++    std::string fmt = fmt_arg->getAsCString().str();
+     if (fmt.size() == 0)
+       return false;
+
+@@ -437,8 +436,8 @@
+         if ( callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+
+         if (fnName != "__gen_ocl_printf_stub" && fnName != "__gen_ocl_puts_stub")
+           continue;
+@@ -582,7 +581,7 @@
+             if (!fmt_arg || !fmt_arg->isCString()) {
+               return false;
+             }
+-            slot.state.str = fmt_arg->getAsCString();
++            slot.state.str = fmt_arg->getAsCString().str();
+             return true;
+           }
+           case PRINTF_CONVERSION_P: {
+@@ -595,10 +594,10 @@
+
+         break;
+
+-      case Type::VectorTyID: {
+-        Type* vect_type = arg->getType();
+-        Type* elt_type = vect_type->getVectorElementType();
+-        int vec_num = vect_type->getVectorNumElements();
++      case Type::FixedVectorTyID: {
++        VectorType* vect_type = dyn_cast<VectorType>(arg->getType());
++        Type* elt_type = vect_type->getElementType();
++        int vec_num = vect_type->getNumElements();
+         bool sign = false;
+
+         if (vec_num != slot.state.vector_n) {
+--- backend/src/llvm/llvm_profiling.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_profiling.cpp	2020-11-09 18:59:50.120929150 +0100
+@@ -35,7 +35,6 @@
+ #include "llvm/IR/IRBuilder.h"
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #else
+ #include "llvm/Support/CallSite.h"
+--- backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 17:01:09.407774832 +0100
+@@ -45,8 +45,8 @@
+     bool visitCallInst(CallInst *I) {
+       if(!I)
+         return false;
+-      Value *Callee = I->getCalledValue();
+-      const std::string fnName = Callee->getName();
++      Value *Callee = I->getCalledOperand();
++      const std::string fnName = Callee->getName().str();
+       bool changed = false;
+       Type *boolTy = IntegerType::get(I->getContext(), 1);
+       Type *i32Ty = IntegerType::get(I->getContext(), 32);
+@@ -59,7 +59,7 @@
+         Value *needFixVal;
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+@@ -113,7 +113,7 @@
+         Value *needFixVal;
+  #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+--- backend/src/llvm/llvm_scalarize.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_scalarize.cpp	2020-11-09 18:51:16.888990104 +0100
+@@ -178,7 +178,7 @@
+       if(!type)
+         return type;
+       switch(type->getTypeID()) {
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       case Type::ArrayTyID:
+         return GetBasicType(type->getContainedType(0));
+       default:
+@@ -188,7 +188,7 @@
+     }
+
+     int GetComponentCount(const Type* type)  {
+-      if (type && type->getTypeID() == Type::VectorTyID)
++      if (type && type->getTypeID() == Type::FixedVectorTyID)
+         return llvm::dyn_cast<VectorType>(type)->getNumElements();
+       else
+         return 1;
+@@ -652,13 +652,12 @@
+           break;
+         }
+       } else {
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(call);
+-        CallSite::arg_iterator CI = CS.arg_begin() + 1;
++        User::op_iterator CI = call->arg_begin() + 1;
+
+         switch (genIntrinsicID) {
+           case GEN_OCL_NOT_FOUND:
+@@ -729,7 +728,7 @@
+             extractFromVector(call);
+             break;
+           case GEN_OCL_PRINTF:
+-            for (; CI != CS.arg_end(); ++CI)
++            for (; CI != call->arg_end(); ++CI)
+               if ((*CI)->getType()->isVectorTy())
+                 *CI = InsertToVector(call, *CI);
+             break;
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index a7b6dff107f..e37102ce14f 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=8
+revision=9
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From 48581839cfc004126cdc8af4c92d51eb623c411b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 21:03:06 +0100
Subject: [PATCH 23/23] ldc: rebuild for llvm11

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index 63e5c52db87..45d5c7f7be0 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.24.0
-revision=1
+revision=2
 wrksrc="ldc-${version}-src"
 build_style=cmake
 configure_args="
@@ -10,7 +10,7 @@ configure_args="
  -DCMAKE_BUILD_TYPE=RelWithDebInfo
  -DBASH_COMPLETION_COMPLETIONSDIR=/usr/share/bash-completion"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm10 perl pkg-config"
+hostmakedepends="dmd llvm11 perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel"
 depends="ldc-runtime"
 short_desc="Portable D programming language compiler based on LLVM"

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (26 preceding siblings ...)
  2020-11-09 20:03 ` Snektron
@ 2020-11-09 20:32 ` Snektron
  2020-11-09 20:32 ` Snektron
                   ` (4 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 20:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

New comment by Snektron on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#issuecomment-724261473

Comment:
All that seems to be left are Crystal and Rust. Crystal does not seem to be llvm 11 compatible yet (see https://github.com/crystal-lang/crystal/pull/9829), so i think this should be about ready.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [WIP] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (27 preceding siblings ...)
  2020-11-09 20:32 ` Snektron
@ 2020-11-09 20:32 ` Snektron
  2020-11-11 11:20 ` Snektron
                   ` (3 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-09 20:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

New comment by Snektron on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#issuecomment-724261473

Comment:
All that seems to be left is Crystal and Rust. Crystal does not seem to be llvm 11 compatible yet (see https://github.com/crystal-lang/crystal/pull/9829), so i think this should be about ready.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (28 preceding siblings ...)
  2020-11-09 20:32 ` Snektron
@ 2020-11-11 11:20 ` Snektron
  2020-11-12  6:22 ` fosslinux
                   ` (2 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-11 11:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 173 bytes --]

New comment by Snektron on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#issuecomment-725366483

Comment:
What should i do about this CI?

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (29 preceding siblings ...)
  2020-11-11 11:20 ` Snektron
@ 2020-11-12  6:22 ` fosslinux
  2020-11-12 14:06 ` [PR PATCH] [Updated] " Snektron
  2020-11-17  3:16 ` [PR PATCH] [Closed]: " q66
  32 siblings, 0 replies; 34+ messages in thread
From: fosslinux @ 2020-11-12  6:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/26231#issuecomment-725866220

Comment:
Add `[ci skip]` to the last commit.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Updated] llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (30 preceding siblings ...)
  2020-11-12  6:22 ` fosslinux
@ 2020-11-12 14:06 ` Snektron
  2020-11-17  3:16 ` [PR PATCH] [Closed]: " q66
  32 siblings, 0 replies; 34+ messages in thread
From: Snektron @ 2020-11-12 14:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1224 bytes --]

There is an updated pull request by Snektron against master on the void-packages repository

https://github.com/Snektron/void-packages master
https://github.com/void-linux/void-packages/pull/26231

llvm: Update to 11.0.0
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


A patch file from https://github.com/void-linux/void-packages/pull/26231.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-26231.patch --]
[-- Type: text/x-diff, Size: 166905 bytes --]

From 52a260f4a9e961424a92fcb30c1c604b4232730c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:10 +0100
Subject: [PATCH 01/23] new package: llvm11-11.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libllvm11                             |   1 +
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 .../llvm11/files/llvm-Config-llvm-config.h    |   9 +
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 +++
 .../clang/clang-002-add-musl-triples.patch    |  91 +++++
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 +
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ++
 .../compiler-rt/compiler-rt-armv5.patch       |  11 +
 srcpkgs/llvm11/files/patches/lldb/musl.patch  |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  26 ++
 .../patches/llvm/llvm-003-ppc-secureplt.patch |  11 +
 ...h~b2110e270 (codelite: rebuild for llvm11) |  11 +
 .../patches/llvm/llvm-004-override-opt.patch  |  18 +
 .../patches/llvm/llvm-005-ppc-bigpic.patch    |  38 +++
 .../llvm/llvm-006-aarch64-mf_exec.patch       |  25 ++
 srcpkgs/llvm11/template                       | 310 ++++++++++++++++++
 srcpkgs/llvm11/update                         |   2 +
 27 files changed, 747 insertions(+), 13 deletions(-)
 create mode 120000 srcpkgs/libllvm11
 create mode 100644 srcpkgs/llvm11/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
 create mode 100644 srcpkgs/llvm11/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm11/template
 create mode 100644 srcpkgs/llvm11/update

diff --git a/common/shlibs b/common/shlibs
index 12ade7a11ac..ef2400dd2ef 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1028,10 +1028,10 @@ libuchardet.so.0 uchardet-0.0.6_1
 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1
 libyajl.so.2 yajl-2.0.1_1
 libconfuse.so.2 confuse-3.2.1_1
-liblldb.so.10 lldb-10.0.0_1
-libclang.so.10 libclang-10.0.0_3
-libclang-cpp.so.10 libclang-cpp-10.0.0_3
-libLLVM-10.so libllvm10-10.0.0_1
+liblldb.so.11 lldb-11.0.0_1
+libclang.so.11 libclang-11.0.0_1
+libclang-cpp.so.11 libclang-cpp-11.0.0_1
+libLLVM-11.so libllvm11-11.0.0_1
 libisofs.so.6 libisofs-0.6.24_1
 libmpack.so.0 libmpack-1.0.5_1
 libGeoIP.so.1 libgeoip-1.4.8_1
diff --git a/srcpkgs/clang b/srcpkgs/clang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/libllvm11 b/srcpkgs/libllvm11
new file mode 120000
index 00000000000..decc3806c95
--- /dev/null
+++ b/srcpkgs/libllvm11
@@ -0,0 +1 @@
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index 59f26575cb3..decc3806c95 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm10
\ No newline at end of file
+llvm11
\ No newline at end of file
diff --git a/srcpkgs/llvm11/files/llvm-Config-llvm-config.h b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm11/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "llvm-config-32.h"
+#elif __WORDSIZE == 64
+#include "llvm-config-64.h"
+#else
+#error "Unknown word size"
+#endif
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/lib/Headers/unwind.h
++++ b/lib/Headers/unwind.h
+@@ -9,9 +9,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,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+ 
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+ 
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+ 
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+ 
+-#endif /* __CLANG_UNWIND_H */
+-- 
+2.5.1
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-002-add-musl-triples.patch
@@ -0,0 +1,91 @@
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                              "armv7hl-redhat-linux-gnueabi",
+                                              "armv6hl-suse-linux-gnueabi",
+-                                             "armv7hl-suse-linux-gnueabi"};
++                                             "armv7hl-suse-linux-gnueabi",
++                                             "armv7l-linux-gnueabihf"};
+   static const char *const ARMebLibDirs[] = {"/lib"};
+   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+                                              "armeb-linux-androideabi"};
+@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+     return;
+   }
+ 
++  if (TargetTriple.isMusl()) {
++    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++    static const char *const ARMHFMuslTriples[] = {
++        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++    };
++    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++    static const char *const MIPSMuslTriples[] = {
++        "mips-linux-musl", "mipsel-linux-musl",
++        "mipsel-linux-muslhf", "mips-linux-muslhf"
++    };
++    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++    switch (TargetTriple.getArch()) {
++    case llvm::Triple::aarch64:
++      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++      break;
++    case llvm::Triple::arm:
++      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++      } else {
++        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++      }
++      break;
++    case llvm::Triple::x86_64:
++      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      break;
++    case llvm::Triple::x86:
++      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++      break;
++    case llvm::Triple::mips:
++      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++      break;
++    case llvm::Triple::ppc:
++      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      break;
++    case llvm::Triple::ppc64:
++      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++      break;
++    case llvm::Triple::ppc64le:
++      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++      break;
++    default:
++      break;
++    }
++    TripleAliases.push_back(TargetTriple.str());
++    if (TargetTriple.str() != BiarchTriple.str())
++      BiarchTripleAliases.push_back(BiarchTriple.str());
++    return;
++  }
++
+   // Android targets should not use GNU/Linux tools or libraries.
+   if (TargetTriple.isAndroid()) {
+     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
@@ -0,0 +1,18 @@
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+     Loader = "ld.so.1";
+     break;
+   case llvm::Triple::ppc64:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+-        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
+   case llvm::Triple::ppc64le:
+-    LibDir = "lib64";
++    LibDir = "lib";
+     Loader =
+         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+     break;
diff --git a/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..2d6731d3b53
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,30 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -408,11 +408,10 @@
+       SuitableAlign = 64;
+     } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+       resetDataLayout("e-m:e-i64:64-n32:64");
+-      ABI = "elfv2";
+     } else {
+       resetDataLayout("E-m:e-i64:64-n32:64");
+-      ABI = "elfv1";
+     }
++    ABI = "elfv2";
+
+     if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+         Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1883,11 +1883,7 @@
+         ABIName = "elfv1-qpx";
+         break;
+       }
+-      if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
+-          T.isOSOpenBSD() || T.isMusl())
+-        ABIName = "elfv2";
+-      else
+-        ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
new file mode 100644
index 00000000000..893dd244c5b
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/compiler-rt/compiler-rt-armv5.patch
@@ -0,0 +1,11 @@
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
+@@ -428,8 +428,6 @@
+ )
+ set(arm_Thumb1_SOURCES
+   ${arm_Thumb1_JT_SOURCES}
+-  ${arm_Thumb1_SjLj_EH_SOURCES}
+-  ${arm_Thumb1_VFPv2_SOURCES}
+   ${arm_Thumb1_icache_SOURCES}
+ )
+ 
diff --git a/srcpkgs/llvm11/files/patches/lldb/musl.patch b/srcpkgs/llvm11/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/lldb/musl.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp            | 2 +-
+ lib/Support/Unix/Signals.inc              | 6 +++---
+ utils/unittest/googletest/src/gtest.cc    | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index e0a1ee3..465b65a 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+ 
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ 
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index 5780764..1d548c1 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
+-- 
+2.5.1
+
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+ 
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+-   if (!strcmp(SymbolName, #SYM)) return &SYM
++   if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+ 
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..93ccdf8dec6
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,26 @@
+This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
+need this because unlike most distros we use ELFv2 for both glibc and musl
+on big endian ppc64.
+
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -214,9 +214,8 @@
+
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    return PPCTargetMachine::PPC_ABI_ELFv2;
+   default:
+     return PPCTargetMachine::PPC_ABI_UNKNOWN;
+   }
+--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
++++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
new file mode 100644
index 00000000000..fcbaba86335
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+ 
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11) b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)
new file mode 100644
index 00000000000..5be8de4f068
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch~b2110e270 (codelite: rebuild for llvm11)	
@@ -0,0 +1,11 @@
+--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -153,7 +153,7 @@
+
+   if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
+       TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++      isTargetLinux())
+     SecurePlt = true;
+
+   if (HasSPE && IsPPC64)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..aaaefc963de
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -999,6 +999,12 @@
+     ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++    llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000..4e0045d97d3
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,38 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 10:57:27 -0600
+Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified
+
+---
+ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp  | 2 +-
+ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index 269b84b4e8d..03246a5242c 100644
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() &&
+-      M->getPICLevel() == PICLevel::BigPIC)
++      M->getPICLevel() != PICLevel::SmallPIC)
+     TlsRef = MCBinaryExpr::createAdd(
+         TlsRef, MCConstantExpr::create(32768, OutContext), OutContext);
+   const MachineOperand &MO = MI->getOperand(2);
+diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 027e6bd1ba0..ae461f4eea9 100644
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -116,7 +116,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
+   // If -msecure-plt -fPIC, add 32768 to symbol.
+   if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
+-      M->getPICLevel() == PICLevel::BigPIC &&
++      M->getPICLevel() != PICLevel::SmallPIC &&
+       MO.getTargetFlags() == PPCII::MO_PLT)
+     Expr =
+         MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx);
+-- 
+2.23.0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000..a64a317ee6c
--- /dev/null
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-006-aarch64-mf_exec.patch
@@ -0,0 +1,25 @@
+Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:
+
+    Failing Tests (8):
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
+        LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3
+
+Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+
+--- a/lib/Support/Unix/Memory.inc
++++ b/lib/Support/Unix/Memory.inc
+@@ -59,7 +59,7 @@
+     return PROT_READ | PROT_WRITE | PROT_EXEC;
+   case llvm::sys::Memory::MF_EXEC:
+ #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \
+-     defined(_POWER) || defined(_ARCH_PPC))
++     defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__)))
+     // On PowerPC, having an executable page that has no read permission
+     // can have unintended consequences.  The function InvalidateInstruction-
+     // Cache uses instructions dcbf and icbi, both of which are treated by
diff --git a/srcpkgs/llvm11/template b/srcpkgs/llvm11/template
new file mode 100644
index 00000000000..78937672a47
--- /dev/null
+++ b/srcpkgs/llvm11/template
@@ -0,0 +1,310 @@
+# Template file for 'llvm11'
+pkgname=llvm11
+version=11.0.0
+revision=1
+wrksrc="llvm-${version}.src"
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BINUTILS_INCDIR=/usr/include"
+hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
+makedepends="python3-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm11"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforce.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
+checksum="
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469
+ 8570c09f57399e21e0eea0dcd66ae0231d47eafc7a04d6fe5c4951b13c4d2c72
+ efe7be4a7b7cdc6f3bcf222827c6f837439e6e656d12d6c885d5c8a80ff4fd1c
+ 0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209
+ fed318f75d560d0e0ae728e2fb8abce71e9d0c60dd120c9baac118522ce76c09
+ 374aff82ff573a449f9aabbd330a5d0a441181c535a3599996127378112db234"
+lib32disabled=yes
+python_version=3
+
+_lldb_enable=yes
+
+if [ "$CROSS_BUILD" ]; then
+	_lldb_enable=no
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*) _lldb_enable=no ;;
+esac
+
+subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm11"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+post_patch() {
+	# patches
+	cd ${XBPS_BUILDDIR}/llvm-${version}.src
+	for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
+		msg_normal "Applying $i to llvm\n"
+		patch -sNp1 -i ${i}
+	done
+
+	cd ${XBPS_BUILDDIR}/clang-${version}.src
+	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
+		msg_normal "Applying $i to clang\n"
+		patch -sNp1 -i ${i}
+	done
+
+	case "$XBPS_TARGET_MACHINE" in
+	armv5*)
+		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
+		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
+			msg_normal "Applying $i to compiler-rt\n"
+			patch -sNp1 -i ${i}
+		done
+		;;
+	esac
+
+	if [ "$_lldb_enable" = "yes" ]; then
+		cd ${XBPS_BUILDDIR}/lldb-${version}.src
+		for i in ${FILESDIR}/patches/lldb/*.patch; do
+			msg_normal "Applying $i to lldb\n"
+			patch -sNp1 -i ${i}
+		done
+		case "$XBPS_TARGET_MACHINE" in
+			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
+		esac
+	fi
+
+	# Move clang files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
+	fi
+	# Move clang-tools-extra files into llvm source.
+	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
+	fi
+	# Move lld files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
+	fi
+	# Move lldb files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		if [ "$_lldb_enable" = "yes" ]; then
+			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+		else
+			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
+		fi
+	fi
+	# Move compiler-rt files into the llvm source.
+	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
+	fi
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			# Disable sanitizers
+			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
+			;;
+	esac
+
+}
+
+pre_configure() {
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+
+	# since gcc9, the build likes to blow up for ppc32 apparently because
+	# of clang being too large for a 24-bit relative call to the PLT, so
+	# optimize for size instead
+	case "$XBPS_TARGET_MACHINE" in
+		mips*-musl|ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
+		cd ../..
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		i686*) _arch="X86";;
+		x86_64*) _arch="X86";;
+		armv5*) _arch="Armv5te";;
+		armv6*) _arch="Armv6";;
+		armv7*) _arch="Armv7";;
+		aarch64*) _arch="AArch64";;
+		mips*) _arch="Mips";;
+		ppc*) _arch="PowerPC";;
+	esac
+	configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+	configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
+}
+
+do_install() {
+	vlicense LICENSE.TXT
+
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# Fix permissions of static libs
+	chmod -x ${DESTDIR}/usr/lib/*.a
+
+	# Required for multilib.
+	if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
+		for _header in llvm-config; do
+			mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
+			vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
+				usr/include/llvm/Config ${_header}.h
+		done
+	fi
+
+	# Remove llvm-config-host in cross builds.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${DESTDIR}/usr/bin/llvm-config-host
+	fi
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove usr/share/man/man1/scan-build.1
+		vmove "/usr/bin/scan-*"
+		vmove "/usr/share/scan-*"
+		vmove "/usr/libexec/*analyzer"
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${version}_${revision} python3"
+	short_desc+=" - Extra Clang tools"
+	homepage="https://clang.llvm.org/extra/"
+	pkg_install() {
+		vmove usr/bin/clang-apply-replacements
+		vmove usr/bin/clang-query
+		vmove usr/bin/clang-rename
+		vmove usr/bin/clang-tidy
+		vmove usr/bin/diagtool
+		vmove usr/bin/find-all-symbols
+		vmove usr/bin/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/bin/sancov
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/share/clang/*tidy*"
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove "usr/share/clang"
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/bin/lld*
+		vmove usr/bin/wasm-ld
+		vmove usr/bin/ld.lld*
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm11_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm11/update b/srcpkgs/llvm11/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm11/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From a0da2fbf82386b9dd4590287edcc9190ad3b621b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 18:13:23 +0100
Subject: [PATCH 02/23] llvm: update to 11.0.0

---
 srcpkgs/llvm/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index 84c8d3a8e6e..eb71e7d67fa 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,10 +1,10 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=10.0.0
-revision=2
+version=11.0.0
+revision=1
 build_style=meta
-depends="llvm10"
-replaces="llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+depends="llvm11"
+replaces="llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 6d16e98f895e340e826ae160519639af739f92c3 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:21:16 +0100
Subject: [PATCH 03/23] llvm10: rebuild standalone

---
 srcpkgs/llvm10/files/llvm-Config-config.h     |   9 -
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ----
 .../clang/clang-002-add-musl-triples.patch    |  91 --------
 .../clang-003-ppc64-dynamic-linker-path.patch |  18 --
 .../clang/clang-004-ppc64-musl-elfv2.patch    |  30 ---
 .../compiler-rt/compiler-rt-armv5.patch       |  11 -
 srcpkgs/llvm10/files/patches/lldb/musl.patch  |  31 ---
 srcpkgs/llvm10/template                       | 211 +-----------------
 8 files changed, 5 insertions(+), 440 deletions(-)
 delete mode 100644 srcpkgs/llvm10/files/llvm-Config-config.h
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
 delete mode 100644 srcpkgs/llvm10/files/patches/lldb/musl.patch

diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h
deleted file mode 100644
index c369b4551f7..00000000000
--- a/srcpkgs/llvm10/files/llvm-Config-config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 32
-#include "config-32.h"
-#elif __WORDSIZE == 64
-#include "config-64.h"
-#else
-#error "Unknown word size"
-#endif
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
deleted file mode 100644
index 04244bcc274..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
-From: Andrea Brancaleoni <miwaxe@gmail.com>
-Date: Tue, 8 Sep 2015 22:14:57 +0200
-Subject: [PATCH 2/7] fix unwind chain inclusion
-
----
- lib/Headers/unwind.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
-index 303d792..44e10cc 100644
---- a/lib/Headers/unwind.h
-+++ b/lib/Headers/unwind.h
-@@ -9,9 +9,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,
-@@ -39,6 +36,9 @@
- # endif
- #else
- 
-+#ifndef __CLANG_UNWIND_H
-+#define __CLANG_UNWIND_H
-+
- #include <stdint.h>
- 
- #ifdef __cplusplus
-@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
- }
- #endif
- 
-+#endif /* __CLANG_UNWIND_H */
-+
- #endif
- 
--#endif /* __CLANG_UNWIND_H */
--- 
-2.5.1
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
deleted file mode 100644
index aefc88d48f5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch
+++ /dev/null
@@ -1,91 +0,0 @@
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -1938,7 +1938,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
-                                              "armv7hl-redhat-linux-gnueabi",
-                                              "armv6hl-suse-linux-gnueabi",
--                                             "armv7hl-suse-linux-gnueabi"};
-+                                             "armv7hl-suse-linux-gnueabi",
-+                                             "armv7l-linux-gnueabihf"};
-   static const char *const ARMebLibDirs[] = {"/lib"};
-   static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
-                                              "armeb-linux-androideabi"};
-@@ -2077,6 +2078,78 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
-     return;
-   }
- 
-+  if (TargetTriple.isMusl()) {
-+    static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
-+    static const char *const ARMHFMuslTriples[] = {
-+        "arm-linux-musleabihf", "armv7l-linux-musleabihf"
-+    };
-+    static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
-+    static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
-+    static const char *const X86MuslTriples[] = {"i686-linux-musl"};
-+    static const char *const MIPSMuslTriples[] = {
-+        "mips-linux-musl", "mipsel-linux-musl",
-+        "mipsel-linux-muslhf", "mips-linux-muslhf"
-+    };
-+    static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
-+    static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
-+    static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
-+
-+    switch (TargetTriple.getArch()) {
-+    case llvm::Triple::aarch64:
-+      LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
-+      BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
-+      break;
-+    case llvm::Triple::arm:
-+      LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
-+      if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
-+        TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
-+      } else {
-+        TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
-+      }
-+      break;
-+    case llvm::Triple::x86_64:
-+      LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      break;
-+    case llvm::Triple::x86:
-+      LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
-+      TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
-+      BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
-+      BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
-+      break;
-+    case llvm::Triple::mips:
-+      LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
-+      TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
-+      break;
-+    case llvm::Triple::ppc:
-+      LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      break;
-+    case llvm::Triple::ppc64:
-+      LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
-+      TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
-+      BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
-+      BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
-+      break;
-+    case llvm::Triple::ppc64le:
-+      LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
-+      TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
-+      break;
-+    default:
-+      break;
-+    }
-+    TripleAliases.push_back(TargetTriple.str());
-+    if (TargetTriple.str() != BiarchTriple.str())
-+      BiarchTripleAliases.push_back(BiarchTriple.str());
-+    return;
-+  }
-+
-   // Android targets should not use GNU/Linux tools or libraries.
-   if (TargetTriple.isAndroid()) {
-     static const char *const AArch64AndroidTriples[] = {
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
deleted file mode 100644
index 4b9b0b891d5..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -593,12 +593,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
-     Loader = "ld.so.1";
-     break;
-   case llvm::Triple::ppc64:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
--        (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
-+        (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
-   case llvm::Triple::ppc64le:
--    LibDir = "lib64";
-+    LibDir = "lib";
-     Loader =
-         (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
-     break;
diff --git a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
deleted file mode 100644
index f1af1b79b5f..00000000000
--- a/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -386,11 +386,10 @@ public:
- 
-     if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-       resetDataLayout("e-m:e-i64:64-n32:64");
--      ABI = "elfv2";
-     } else {
-       resetDataLayout("E-m:e-i64:64-n32:64");
--      ABI = "elfv1";
-     }
-+    ABI = "elfv2";
- 
-     if (Triple.getOS() == llvm::Triple::AIX)
-       SuitableAlign = 64;
---- a/lib/Driver/ToolChains/Clang.cpp
-+++ b/lib/Driver/ToolChains/Clang.cpp
-@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
-         ABIName = "elfv1-qpx";
-         break;
-       }
--
--      if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
--        ABIName = "elfv2";
--      else
--        ABIName = "elfv1";
-+      ABIName = "elfv2";
-       break;
-     }
-     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
deleted file mode 100644
index 893dd244c5b..00000000000
--- a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-+++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt
-@@ -428,8 +428,6 @@
- )
- set(arm_Thumb1_SOURCES
-   ${arm_Thumb1_JT_SOURCES}
--  ${arm_Thumb1_SjLj_EH_SOURCES}
--  ${arm_Thumb1_VFPv2_SOURCES}
-   ${arm_Thumb1_icache_SOURCES}
- )
- 
diff --git a/srcpkgs/llvm10/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch
deleted file mode 100644
index 37416bb478d..00000000000
--- a/srcpkgs/llvm10/files/patches/lldb/musl.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -10,21 +10,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template
index bfbddb48127..b800da58d1c 100644
--- a/srcpkgs/llvm10/template
+++ b/srcpkgs/llvm10/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm10'
 pkgname=llvm10
 version=10.0.0
-revision=6
+revision=7
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
 maintainer="q66 <daniel@octaforge.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz"
-checksum="
- df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf
- dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135
- b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708
- 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21
- acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c
- 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
 lib32disabled=yes
 python_version=3
 
-_lldb_enable=yes
+conflicts="llvm11>=0"
 
-if [ "$CROSS_BUILD" ]; then
-	_lldb_enable=no
-fi
-
-case "$XBPS_TARGET_MACHINE" in
-	ppc64le*) ;;
-	ppc*) _lldb_enable=no ;;
-esac
-
-subpackages="clang-tools-extra clang clang-analyzer libclang libclang-cpp libllvm10"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm10"
 
 post_patch() {
 	# patches
@@ -62,65 +36,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/clang-${version}.src
-	for i in ${FILESDIR}/patches/clang/clang-*.patch; do
-		msg_normal "Applying $i to clang\n"
-		patch -sNp1 -i ${i}
-	done
-
-	case "$XBPS_TARGET_MACHINE" in
-	armv5*)
-		cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src
-		for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do
-			msg_normal "Applying $i to compiler-rt\n"
-			patch -sNp1 -i ${i}
-		done
-		;;
-	esac
-
-	if [ "$_lldb_enable" = "yes" ]; then
-		cd ${XBPS_BUILDDIR}/lldb-${version}.src
-		for i in ${FILESDIR}/patches/lldb/*.patch; do
-			msg_normal "Applying $i to lldb\n"
-			patch -sNp1 -i ${i}
-		done
-		case "$XBPS_TARGET_MACHINE" in
-			*-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;;
-		esac
-	fi
-
-	# Move clang files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang
-	fi
-	# Move clang-tools-extra files into llvm source.
-	if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ${wrksrc}/tools/clang/tools/extra
-	fi
-	# Move lld files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld
-	fi
-	# Move lldb files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		if [ "$_lldb_enable" = "yes" ]; then
-			mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-		else
-			rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src
-		fi
-	fi
-	# Move compiler-rt files into the llvm source.
-	if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src ${wrksrc}/projects/compiler-rt
-	fi
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl)
-			# Disable sanitizers
-			sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake
-			;;
-	esac
-
 }
 
 pre_configure() {
@@ -143,9 +58,7 @@ pre_configure() {
 			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
 			cmake ../.. -DCMAKE_BUILD_TYPE=Release
 		make ${makejobs} -C utils/TableGen
-		make ${makejobs} -C tools/clang/utils/TableGen
 		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
 		cd ../..
 	fi
 
@@ -188,120 +101,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - A source code analysis framework"
-	homepage="https://clang-analyzer.llvm.org/"
-	pkg_install() {
-		vmove usr/share/man/man1/scan-build.1
-		vmove "/usr/bin/scan-*"
-		vmove "/usr/share/scan-*"
-		vmove "/usr/libexec/*analyzer"
-	}
-}
-
-clang-tools-extra_package() {
-	lib32disabled=yes
-	depends="clang-${version}_${revision} python3"
-	short_desc+=" - Extra Clang tools"
-	homepage="https://clang.llvm.org/extra/"
-	pkg_install() {
-		vmove usr/bin/clang-apply-replacements
-		vmove usr/bin/clang-query
-		vmove usr/bin/clang-rename
-		vmove usr/bin/clang-tidy
-		vmove usr/bin/diagtool
-		vmove usr/bin/find-all-symbols
-		vmove usr/bin/hmaptool
-		vmove usr/bin/modularize
-		vmove usr/bin/pp-trace
-		vmove usr/bin/sancov
-		vmove "usr/lib/libclangApplyReplacements*"
-		vmove "usr/lib/libclangQuery*"
-		vmove "usr/lib/libclangTidy*"
-		vmove "usr/share/clang/*tidy*"
-	}
-}
-
-clang_package() {
-	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang-${version}_${revision}"
-	short_desc+=" - C language family frontend"
-	homepage="https://clang.llvm.org/"
-	pkg_install() {
-		vmove usr/include/clang
-		vmove usr/include/clang-c
-		vmove "usr/bin/*clang*"
-		vmove usr/bin/c-index-test
-		vmove usr/lib/clang
-		vmove usr/lib/cmake/clang
-		vmove "usr/lib/libclang*.a"
-		vmove "usr/lib/libclang*.so"
-		vmove "usr/share/clang"
-	}
-}
-
-libclang_package() {
-	short_desc+=" - C frontend runtime library"
-	pkg_install() {
-		vmove "usr/lib/libclang.so.*"
-	}
-}
-
-libclang-cpp_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
-	pkg_install() {
-		vmove "usr/lib/libclang-cpp.so.*"
-	}
-}
-
-lld_package() {
-	lib32disabled=yes
-	short_desc+=" - linker"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/bin/lld*
-		vmove usr/bin/wasm-ld
-		vmove usr/bin/ld.lld*
-	}
-}
-
-lld-devel_package() {
-	lib32disabled=yes
-	short_desc+=" - linker - development files"
-	homepage="https://lld.llvm.org"
-	pkg_install() {
-		vmove usr/include/lld
-		vmove "usr/lib/liblld*a"
-	}
-}
-
-lldb_package() {
-	lib32disabled=yes
-	depends+=" python3-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vmove /usr/lib/python*
-		# Depend on python3-six instead of conflicting
-		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
-	}
-}
-
-lldb-devel_package() {
-	lib32disabled=yes
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm10_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 5ce860e47ae647dee6f12a85d444bb28d06c5b17 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Sun, 8 Nov 2020 18:28:52 +0100
Subject: [PATCH 04/23] llvm-libunwind: update to 11.0.0

---
 srcpkgs/llvm-libunwind/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index 6e20a791e65..8fce56efd70 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=10.0.0
+version=11.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm10"
-makedepends="llvm10"
+hostmakedepends="llvm11"
+makedepends="llvm11"
 make_build_args="VERBOSE=1"
 short_desc="LLVM version of libunwind library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
-checksum=09dc5ecc4714809ecf62908ae8fe8635ab476880455287036a2730966833c626
+checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
 
 post_install() {
 	vmkdir usr/include

From 855b1e78b094003cf20534ba521882813117a3c2 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:26 +0100
Subject: [PATCH 05/23] libcxxabi: update to 11.0.0

---
 srcpkgs/libcxxabi/template | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index 393aefc5b31..21cba4dbc5f 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,23 +1,23 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
-configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
+configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
  -DLIBCXXABI_USE_LLVM_UNWINDER=1
  -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
 make_build_args="VERBOSE=1"
-hostmakedepends="clang-tools-extra llvm10"
-makedepends="llvm10 llvm-libunwind-devel"
+hostmakedepends="clang-tools-extra llvm11"
+makedepends="llvm11 llvm-libunwind-devel"
 short_desc="Low-level support for libc++ standard library"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
  https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
- 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"
+checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)
@@ -26,11 +26,8 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 post_extract() {
-	# Break dependency cycle, we just need the headers here
-	mv ../libcxx-${version}.src libcxx
-
-	# For musl
-	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
+	# Since llvm 11, libcxx needs to be present next to the libcxxabi root
+	mv ../libcxx-${version}.src ../libcxx
 }
 
 post_install() {

From ecc37be2127da750ee3f8584070301903fa2b56a Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 01:17:50 +0100
Subject: [PATCH 06/23] libcxx: update to 11.0.0

---
 srcpkgs/libcxx/template | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index 95a16bccf57..3f15b63d3a7 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,21 +1,27 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=10.0.0
+version=11.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
 configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
  -DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
  -DLIBCXXABI_USE_LLVM_UNWINDER=1"
-hostmakedepends="llvm10 clang-tools-extra python3"
-makedepends="libcxxabi-devel llvm10 llvm-libunwind-devel"
+hostmakedepends="llvm11 clang-tools-extra python3"
+makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
-checksum=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
+distfiles="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="
+ 6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
+ 58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
+ 913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
@@ -23,9 +29,12 @@ esac
 
 post_extract() {
 	case "$XBPS_TARGET_MACHINE" in
-	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch
-		sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' include/stddef.h ;;
+	*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
 	esac
+
+	# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
+	mv ../libcxxabi-${version}.src ../libcxxabi
+	mv ../llvm-${version}.src ../llvm
 }
 
 post_install() {

From b79366c5e56f25ce3af534fc635ed2223cba2671 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:22:52 +0100
Subject: [PATCH 07/23] mesa: rebuild for llvm11

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 0ec6360e0b3..7c08820279e 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=20.2.1
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true

From 55dfbbe344a6c0fe74cc1f63f1642675eede0932 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:37:38 +0100
Subject: [PATCH 08/23] shiboken2: rebuild for llvm11

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 20ea5aae7e2..d0072254842 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.0
-revision=2
+revision=3
 _pkgname="pyside-setup-opensource-src-${version}"
 wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
 build_wrksrc="sources/shiboken2"

From 72a1716259d16440ce5b23c8ccbaa6c73756d6a4 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:48:41 +0100
Subject: [PATCH 09/23] gnome-builder: rebuild for llvm11

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 22144f3536e..3d5932a67a0 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=3.38.0
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"

From 247ae03fcafbe7145fca4180e0421776be654a96 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 02:49:46 +0100
Subject: [PATCH 10/23] juCi++: rebuild for llvm11

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 69bbc07ab01..ca4650f8f1f 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.6.0
-revision=1
+revision=2
 _libclangmm_commit="043d96d0bfbfe4bbb216a0954992d744a35c60ab"
 _tiny_commit="953b19c4c0692b18fb729ffd30f1cc3412797cda"
 wrksrc="jucipp-v${version}"

From 9039929902d69eaf6637558913ae4f9402f6c7a5 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:25:28 +0100
Subject: [PATCH 11/23] qt5: rebuild for llvm11

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 1954048e2b1..b717438d4dd 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.15.1
-revision=2
+revision=3
 wrksrc="qt-everywhere-src-${version}"
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config

From 8cd2e2026b0c14c8bdbf6534ad6208a865b4444b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 03:38:52 +0100
Subject: [PATCH 12/23] qtcreator: rebuild for llvm11

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index ddbd0168fa5..67bb0e81199 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.13.2
-revision=1
+revision=2
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 2d21d4b84717cb66b15e782e494afba7c04ccd52 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 12:48:23 +0100
Subject: [PATCH 13/23] kdevelop: rebuild for llvm11

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 3cea3eb2e3e..bdab6e149cb 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.6.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From 03aaa6306dc2c3184b476937d65c37eab8d81d09 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:05:02 +0100
Subject: [PATCH 14/23] codelite: rebuild for llvm11

---
 srcpkgs/codelite/template                                   | 2 +-
 .../llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index a2a09d79fa1..2cb5d35bccb 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=3
+revision=4
 archs="i686* x86_64* ppc64le*"
 build_style=cmake
 configure_args="-DWITH_PCH=0
diff --git a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
index fcbaba86335..5be8de4f068 100644
--- a/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
+++ b/srcpkgs/llvm11/files/patches/llvm/llvm-003-ppc-secureplt.patch
@@ -1,11 +1,11 @@
 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
-@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
- 
+@@ -153,7 +153,7 @@
+
    if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) ||
        TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
 -      TargetTriple.isMusl())
 +      isTargetLinux())
      SecurePlt = true;
- 
+
    if (HasSPE && IsPPC64)

From 9365a6f16f079b600b39c34114aee1209a34b670 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:07:44 +0100
Subject: [PATCH 15/23] rtags: rebuild for llvm11

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 715f2e0c731..d718e6c3090 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=3
+revision=4
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From b674578c892fd01168126d3fe3d7da5d3ad2171b Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:08:56 +0100
Subject: [PATCH 16/23] ccls: rebuild for llvm11

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index 1eb6d9bafc7..35a73955e11 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20201025
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang llvm ncurses-devel rapidjson zlib-devel"

From d871410d6f50cef031983657ceaaf75846c8e208 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 13:32:48 +0100
Subject: [PATCH 17/23] ispc: rebuild for llvm11

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index 2f36d45157a..054e3a1523d 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.14.1
-revision=1
+revision=2
 archs="x86_64*"
 build_style=cmake
 configure_args="-DISPC_NO_DUMPS=ON -DARM_ENABLED=OFF"

From 80806fcc24c0b3fb9134225af392ca2b888796bf Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:24:20 +0100
Subject: [PATCH 18/23] zig: update to 0.7.0

---
 srcpkgs/zig/template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index e34d6471728..727a675383a 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,16 +1,16 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.6.0
-revision=2
+version=0.7.0
+revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
-makedepends="clang llvm10 lld-devel"
+makedepends="clang llvm11 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="MIT"
 homepage="https://ziglang.org/"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=5d167dc19354282dd35dd17b38e99e1763713b9be8a4ba9e9e69284e059e7204
+checksum=0efd2cf6c3b05723db80e9cf193bc55150bba84ca41f855a90f53fc756445f83
 nopie=yes
 nocross=yes
 

From 1f0b5174e873d207778eebe336414e7e9212b866 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 14:41:53 +0100
Subject: [PATCH 19/23] clazy: rebuild for llvm11

---
 .../files/clazy-001-llvm11-stringref.patch    | 343 ++++++++++++++++++
 .../files/clazy-002-llvm11-stringref.patch    |  28 ++
 srcpkgs/clazy/template                        |   8 +-
 3 files changed, 378 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch

diff --git a/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..48049fa594a
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-001-llvm11-stringref.patch
@@ -0,0 +1,343 @@
+From 30d6a2b64f5a05722fdc5d8e3754dbf13425cd62 Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Thu, 4 Jun 2020 17:10:21 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+Also included header file clang/Basic/FileManager.h in src/MiniDumper
+because without this header, class clang::FileEntry in incomplete class
+---
+ src/FixItExporter.cpp                                 | 5 +++--
+ src/MiniAstDumper.cpp                                 | 1 +
+ src/Utils.cpp                                         | 2 +-
+ src/checkbase.cpp                                     | 2 +-
+ src/checks/detachingbase.cpp                          | 2 +-
+ src/checks/level0/qenums.cpp                          | 2 +-
+ src/checks/level0/qt-macros.cpp                       | 4 ++--
+ src/checks/level0/unused-non-trivial-variable.cpp     | 2 +-
+ src/checks/level1/detaching-temporary.cpp             | 2 +-
+ src/checks/level1/non-pod-global-static.cpp           | 2 +-
+ src/checks/level1/qproperty-without-notify.cpp        | 2 +-
+ src/checks/level2/missing-typeinfo.cpp                | 2 +-
+ src/checks/level2/old-style-connect.cpp               | 6 +++---
+ src/checks/level2/rule-of-three.cpp                   | 2 +-
+ src/checks/manuallevel/ifndef-define-typo.cpp         | 6 +++---
+ src/checks/manuallevel/qproperty-type-mismatch.cpp    | 2 +-
+ src/checks/manuallevel/qrequiredresult-candidates.cpp | 2 +-
+ src/checks/manuallevel/qt-keywords.cpp                | 4 ++--
+ src/checks/manuallevel/reserve-candidates.cpp         | 3 ++-
+ 19 files changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/src/FixItExporter.cpp b/src/FixItExporter.cpp
+index f3af2e54..44240cf5 100644
+--- a/src/FixItExporter.cpp
++++ b/src/FixItExporter.cpp
+@@ -68,7 +68,7 @@ void FixItExporter::BeginSourceFile(const LangOptions &LangOpts, const Preproces
+ 
+     const auto id = SourceMgr.getMainFileID();
+     const auto entry = SourceMgr.getFileEntryForID(id);
+-    getTuDiag().MainSourceFile = entry->getName();
++    getTuDiag().MainSourceFile = static_cast<std::string>(entry->getName());
+ }
+ 
+ bool FixItExporter::IncludeInDiagnosticCounts() const
+@@ -89,7 +89,8 @@ tooling::Diagnostic FixItExporter::ConvertDiagnostic(const Diagnostic &Info)
+     // TODO: This returns an empty string: DiagEngine->getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
+     // HACK: capture it at the end of the message: Message text [check-name]
+ 
+-    std::string checkName = DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID());
++    std::string checkName =
++        static_cast<std::string>(DiagEngine.getDiagnosticIDs()->getWarningOptionForDiag(Info.getID()));
+     std::string messageText;
+ 
+     if (checkName.empty()) {
+diff --git a/src/MiniAstDumper.cpp b/src/MiniAstDumper.cpp
+index 47661749..6124e6e8 100644
+--- a/src/MiniAstDumper.cpp
++++ b/src/MiniAstDumper.cpp
+@@ -24,6 +24,7 @@
+ 
+ #include <clang/Frontend/CompilerInstance.h>
+ #include <clang/Frontend/FrontendPluginRegistry.h>
++#include <clang/Basic/FileManager.h>
+ 
+ using namespace clang;
+ using namespace std;
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index 001ced98..b0812fe3 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -878,7 +878,7 @@ string Utils::filenameForLoc(SourceLocation loc, const clang::SourceManager &sm)
+     if (loc.isMacroID())
+         loc = sm.getExpansionLoc(loc);
+ 
+-    const string filename = sm.getFilename(loc);
++    const string filename = static_cast<std::string>(sm.getFilename(loc));
+     auto splitted = clazy::splitString(filename, '/');
+     if (splitted.empty())
+         return {};
+diff --git a/src/checkbase.cpp b/src/checkbase.cpp
+index 8b40e19d..22a426cf 100644
+--- a/src/checkbase.cpp
++++ b/src/checkbase.cpp
+@@ -188,7 +188,7 @@ bool CheckBase::shouldIgnoreFile(SourceLocation loc) const
+     if (!loc.isValid())
+         return true;
+ 
+-    string filename = sm().getFilename(loc);
++    string filename = static_cast<std::string>(sm().getFilename(loc));
+ 
+     return clazy::any_of(m_filesToIgnore, [filename](const std::string &ignored) {
+         return clazy::contains(filename, ignored);
+diff --git a/src/checks/detachingbase.cpp b/src/checks/detachingbase.cpp
+index 70311f42..1b094ee7 100644
+--- a/src/checks/detachingbase.cpp
++++ b/src/checks/detachingbase.cpp
+@@ -57,7 +57,7 @@ bool DetachingBase::isDetachingMethod(CXXMethodDecl *method, DetachingMethodType
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = detachingMethodType == DetachingMethod ? clazy::detachingMethods()
+                                                                                                                      : clazy::detachingMethodsWithConstCounterParts();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     if (it != methodsByType.cend()) {
+         const auto &methods = it->second;
+         if (clazy::contains(methods, clazy::name(method)))
+diff --git a/src/checks/level0/qenums.cpp b/src/checks/level0/qenums.cpp
+index 00075b5c..db8910f2 100644
+--- a/src/checks/level0/qenums.cpp
++++ b/src/checks/level0/qenums.cpp
+@@ -59,7 +59,7 @@ void QEnums::VisitMacroExpands(const Token &MacroNameTok, const SourceRange &ran
+         // We simply check if :: is present because it's very cumbersome to to check for different classes when dealing with the pre-processor
+ 
+         CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+-        string text = Lexer::getSourceText(crange, sm(), lo());
++        string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+         if (clazy::contains(text, "::"))
+             return;
+     }
+diff --git a/src/checks/level0/qt-macros.cpp b/src/checks/level0/qt-macros.cpp
+index d3a587cb..ab8e9f52 100644
+--- a/src/checks/level0/qt-macros.cpp
++++ b/src/checks/level0/qt-macros.cpp
+@@ -44,7 +44,7 @@ void QtMacros::VisitMacroDefined(const Token &MacroNameTok)
+         return;
+ 
+     IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
+-    if (ii && clazy::startsWith(ii->getName(), "Q_OS_"))
++    if (ii && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_"))
+         m_OSMacroExists = true;
+ }
+ 
+@@ -58,7 +58,7 @@ void QtMacros::checkIfDef(const Token &macroNameTok, SourceLocation Loc)
+     if (preProcessorVisitor && preProcessorVisitor->qtVersion() < 51204 && ii->getName() == "Q_OS_WINDOWS") {
+         // Q_OS_WINDOWS was introduced in 5.12.4
+         emitWarning(Loc, "Q_OS_WINDOWS was only introduced in Qt 5.12.4, use Q_OS_WIN instead");
+-    } else if (!m_OSMacroExists && clazy::startsWith(ii->getName(), "Q_OS_")) {
++    } else if (!m_OSMacroExists && clazy::startsWith(static_cast<std::string>(ii->getName()), "Q_OS_")) {
+         emitWarning(Loc, "Include qglobal.h before testing Q_OS_ macros");
+     }
+ }
+diff --git a/src/checks/level0/unused-non-trivial-variable.cpp b/src/checks/level0/unused-non-trivial-variable.cpp
+index 4e4b8303..93815f27 100644
+--- a/src/checks/level0/unused-non-trivial-variable.cpp
++++ b/src/checks/level0/unused-non-trivial-variable.cpp
+@@ -91,7 +91,7 @@ bool UnusedNonTrivialVariable::isUninterestingType(const CXXRecordDecl *record)
+     static const vector<StringRef> blacklistedTemplates = { "QScopedPointer", "QSetValueOnDestroy", "QScopedValueRollback" };
+     StringRef className = clazy::name(record);
+     for (StringRef templateName : blacklistedTemplates) {
+-        if (clazy::startsWith(className, templateName))
++        if (clazy::startsWith(static_cast<std::string>(className), static_cast<std::string>(templateName)))
+             return true;
+     }
+ 
+diff --git a/src/checks/level1/detaching-temporary.cpp b/src/checks/level1/detaching-temporary.cpp
+index fedfc81c..60c75532 100644
+--- a/src/checks/level1/detaching-temporary.cpp
++++ b/src/checks/level1/detaching-temporary.cpp
+@@ -140,7 +140,7 @@ void DetachingTemporary::VisitStmt(clang::Stmt *stm)
+     StringRef className = clazy::name(classDecl);
+ 
+     const std::unordered_map<string, std::vector<StringRef>> &methodsByType = clazy::detachingMethods();
+-    auto it = methodsByType.find(className);
++    auto it = methodsByType.find(static_cast<std::string>(className));
+     auto it2 = m_writeMethodsByType.find(className);
+ 
+     std::vector<StringRef> allowedFunctions;
+diff --git a/src/checks/level1/non-pod-global-static.cpp b/src/checks/level1/non-pod-global-static.cpp
+index 5879bff8..433b5c5f 100644
+--- a/src/checks/level1/non-pod-global-static.cpp
++++ b/src/checks/level1/non-pod-global-static.cpp
+@@ -74,7 +74,7 @@ void NonPodGlobalStatic::VisitStmt(clang::Stmt *stm)
+     const SourceLocation declStart = clazy::getLocStart(varDecl);
+ 
+     if (declStart.isMacroID()) {
+-        auto macroName = Lexer::getImmediateMacroName(declStart, sm(), lo());
++        auto macroName = static_cast<std::string>(Lexer::getImmediateMacroName(declStart, sm(), lo()));
+         if (clazy::startsWithAny(macroName, { "Q_IMPORT_PLUGIN", "Q_CONSTRUCTOR_FUNCTION", "Q_DESTRUCTOR_FUNCTION"})) // Don't warn on these
+             return;
+     }
+diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp
+index e1d6db4a..3af9fee2 100644
+--- a/src/checks/level1/qproperty-without-notify.cpp
++++ b/src/checks/level1/qproperty-without-notify.cpp
+@@ -69,7 +69,7 @@ void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok,
+         return;
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/level2/missing-typeinfo.cpp b/src/checks/level2/missing-typeinfo.cpp
+index 98df2cd4..03b44e06 100644
+--- a/src/checks/level2/missing-typeinfo.cpp
++++ b/src/checks/level2/missing-typeinfo.cpp
+@@ -74,7 +74,7 @@ void MissingTypeInfo::VisitDecl(clang::Decl *decl)
+         if (sm().isInSystemHeader(clazy::getLocStart(record)))
+             return;
+ 
+-        std::string typeName = clazy::name(record);
++        std::string typeName = static_cast<std::string>(clazy::name(record));
+         if (typeName == "QPair") // QPair doesn't use Q_DECLARE_TYPEINFO, but rather a explicit QTypeInfo.
+             return;
+ 
+diff --git a/src/checks/level2/old-style-connect.cpp b/src/checks/level2/old-style-connect.cpp
+index 0fe68c13..396cb703 100644
+--- a/src/checks/level2/old-style-connect.cpp
++++ b/src/checks/level2/old-style-connect.cpp
+@@ -274,7 +274,7 @@ void OldStyleConnect::VisitMacroExpands(const Token &macroNameTok, const SourceR
+         return;
+ 
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(Q_PRIVATE_SLOT\s*\((.*)\s*,\s*.*\s+(.*)\(.*)");
+     smatch match;
+@@ -293,7 +293,7 @@ string OldStyleConnect::signalOrSlotNameFromMacro(SourceLocation macroLoc)
+     CharSourceRange expansionRange = clazy::getImmediateExpansionRange(macroLoc, sm());
+     SourceRange range = SourceRange(expansionRange.getBegin(), expansionRange.getEnd());
+     auto charRange = Lexer::getAsCharRange(range, sm(), lo());
+-    const string text = Lexer::getSourceText(charRange, sm(), lo());
++    const string text = static_cast<std::string>(Lexer::getSourceText(charRange, sm(), lo()));
+ 
+     static regex rx(R"(\s*(SIGNAL|SLOT)\s*\(\s*(.+)\s*\(.*)");
+ 
+@@ -315,7 +315,7 @@ bool OldStyleConnect::isSignalOrSlot(SourceLocation loc, string &macroName) cons
+     if (!loc.isMacroID() || loc.isInvalid())
+         return false;
+ 
+-    macroName = Lexer::getImmediateMacroName(loc, sm(), lo());
++    macroName = static_cast<std::string>(Lexer::getImmediateMacroName(loc, sm(), lo()));
+     return macroName == "SIGNAL" || macroName == "SLOT";
+ }
+ 
+diff --git a/src/checks/level2/rule-of-three.cpp b/src/checks/level2/rule-of-three.cpp
+index 8db55d53..7583fcc5 100644
+--- a/src/checks/level2/rule-of-three.cpp
++++ b/src/checks/level2/rule-of-three.cpp
+@@ -140,7 +140,7 @@ void RuleOfThree::VisitDecl(clang::Decl *decl)
+ 
+     const string className = record->getNameAsString();
+     const string classQualifiedName = record->getQualifiedNameAsString();
+-    const string filename = sm().getFilename(recordStart);
++    const string filename = static_cast<std::string>(sm().getFilename(recordStart));
+     if (clazy::endsWith(className, "Private") && clazy::endsWithAny(filename, { ".cpp", ".cxx", "_p.h" }))
+         return; // Lots of RAII classes fall into this category. And even Private (d-pointer) classes, warning in that case would just be noise
+ 
+diff --git a/src/checks/manuallevel/ifndef-define-typo.cpp b/src/checks/manuallevel/ifndef-define-typo.cpp
+index edb6cdf4..e9c50a45 100644
+--- a/src/checks/manuallevel/ifndef-define-typo.cpp
++++ b/src/checks/manuallevel/ifndef-define-typo.cpp
+@@ -44,7 +44,7 @@ void IfndefDefineTypo::VisitMacroDefined(const Token &macroNameTok)
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -53,7 +53,7 @@ void IfndefDefineTypo::VisitDefined(const Token &macroNameTok, const SourceRange
+ {
+     if (!m_lastIfndef.empty()) {
+         if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo()) {
+-            maybeWarn(ii->getName(), macroNameTok.getLocation());
++            maybeWarn(static_cast<std::string>(ii->getName()), macroNameTok.getLocation());
+         }
+     }
+ }
+@@ -66,7 +66,7 @@ void IfndefDefineTypo::VisitIfdef(SourceLocation, const Token &)
+ void IfndefDefineTypo::VisitIfndef(SourceLocation, const Token &macroNameTok)
+ {
+     if (IdentifierInfo *ii = macroNameTok.getIdentifierInfo())
+-        m_lastIfndef = ii->getName();
++        m_lastIfndef = static_cast<std::string>(ii->getName());
+ }
+ 
+ void IfndefDefineTypo::VisitIf(SourceLocation, SourceRange, PPCallbacks::ConditionValueKind)
+diff --git a/src/checks/manuallevel/qproperty-type-mismatch.cpp b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+index f91159cb..952d9f1d 100644
+--- a/src/checks/manuallevel/qproperty-type-mismatch.cpp
++++ b/src/checks/manuallevel/qproperty-type-mismatch.cpp
+@@ -237,7 +237,7 @@ void QPropertyTypeMismatch::VisitMacroExpands(const clang::Token &MacroNameTok,
+ 
+     CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo());
+ 
+-    string text = Lexer::getSourceText(crange, sm(), lo());
++    string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo()));
+     if (!text.empty() && text.back() == ')')
+         text.pop_back();
+ 
+diff --git a/src/checks/manuallevel/qrequiredresult-candidates.cpp b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+index 912dbaa0..6375bd7b 100644
+--- a/src/checks/manuallevel/qrequiredresult-candidates.cpp
++++ b/src/checks/manuallevel/qrequiredresult-candidates.cpp
+@@ -65,7 +65,7 @@ void QRequiredResultCandidates::VisitDecl(clang::Decl *decl)
+ 
+ 
+     if (returnClass == classDecl) {
+-        const std::string methodName = clazy::name(method);
++        const std::string methodName = static_cast<std::string>(clazy::name(method));
+         if (methodName.empty()) // fixes assert
+             return;
+ 
+diff --git a/src/checks/manuallevel/qt-keywords.cpp b/src/checks/manuallevel/qt-keywords.cpp
+index e792e95a..b60752c9 100644
+--- a/src/checks/manuallevel/qt-keywords.cpp
++++ b/src/checks/manuallevel/qt-keywords.cpp
+@@ -59,12 +59,12 @@ void QtKeywords::VisitMacroExpands(const Token &macroNameTok, const SourceRange
+     }
+ 
+     static const vector<StringRef> keywords = { "foreach", "signals", "slots", "emit" };
+-    std::string name = ii->getName();
++    std::string name = static_cast<std::string>(ii->getName());
+     if (!clazy::contains(keywords, name))
+         return;
+ 
+     // Make sure the macro is Qt's. It must be defined in Qt's headers, not 3rdparty
+-    std::string qtheader = sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc()));
++    std::string qtheader = static_cast<std::string>(sm().getFilename(sm().getSpellingLoc(minfo->getDefinitionLoc())));
+     if (!clazy::endsWith(qtheader, "qglobal.h") && !clazy::endsWith(qtheader, "qobjectdefs.h"))
+         return;
+ 
+diff --git a/src/checks/manuallevel/reserve-candidates.cpp b/src/checks/manuallevel/reserve-candidates.cpp
+index 389cac5a..92e4491c 100644
+--- a/src/checks/manuallevel/reserve-candidates.cpp
++++ b/src/checks/manuallevel/reserve-candidates.cpp
+@@ -78,7 +78,8 @@ static bool isCandidateMethod(CXXMethodDecl *methodDecl)
+     if (!classDecl)
+         return false;
+ 
+-    if (!clazy::equalsAny(clazy::name(methodDecl), { "append", "push_back", "push", "operator<<", "operator+=" }))
++    if (!clazy::equalsAny(static_cast<std::string>(clazy::name(methodDecl)),
++                 { "append", "push_back", "push", "operator<<", "operator+=" }))
+         return false;
+ 
+     if (!clazy::isAReserveClass(classDecl))
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
new file mode 100644
index 00000000000..28cbb60b091
--- /dev/null
+++ b/srcpkgs/clazy/files/clazy-002-llvm11-stringref.patch
@@ -0,0 +1,28 @@
+From 25aa102cc49def9573ffbed88155589cd60a2e8f Mon Sep 17 00:00:00 2001
+From: Egor Gabov <egor.gabov@waveaccess.ru>
+Date: Fri, 5 Jun 2020 16:52:53 +0300
+Subject: [PATCH] updated for compatibility with LLVM 10 (clazy-standalone)
+
+In LLVM 10 llvm::StringRef operator std::string() is marked as explicit.
+In this commit all implicit conversion from llvm::StringRef to
+std::string are changed by explicit.
+---
+ src/checks/manuallevel/jnisignatures.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/checks/manuallevel/jnisignatures.cpp b/src/checks/manuallevel/jnisignatures.cpp
+index 81e61d48..5d4fe203 100644
+--- a/src/checks/manuallevel/jnisignatures.cpp
++++ b/src/checks/manuallevel/jnisignatures.cpp
+@@ -103,7 +103,7 @@ void JniSignatures::checkFunctionCall(Stmt *stm)
+         return;
+     }
+ 
+-    const std::string name = clazy::name(funDecl);
++    const std::string name = static_cast<std::string>(clazy::name(funDecl));
+ 
+     if (name == "callObjectMethod" || name == "callMethod") {
+         checkArgAt(callExpr, 0, methodNameRegex, "Invalid method name");
+-- 
+GitLab
+
diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 4d8557be669..5af2b918e14 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.7
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"
@@ -12,3 +12,9 @@ homepage="https://cgit.kde.org/clazy.git/about/"
 distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
 checksum=754da5815f769dd6b72a040a2430525c93f294eb7769c78271603df9614f1b21
 nocross="Clang cannot be installed as makedep"
+
+post_extract() {
+	for i in ${FILESDIR}/clazy-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}

From 707f6512d487fee86031eb7e189df1eccc27e175 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 15:19:37 +0100
Subject: [PATCH 20/23] include-what-you-use: rebuild for llvm11

---
 ...de-what-you-use-001-llvm11-stringref.patch | 146 ++++++++++++++++++
 ...ude-what-you-use-002-clang-astdumper.patch |  54 +++++++
 srcpkgs/include-what-you-use/template         |   8 +-
 3 files changed, 207 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
 create mode 100644 srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch

diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
new file mode 100644
index 00000000000..171dca28e34
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-001-llvm11-stringref.patch
@@ -0,0 +1,146 @@
+From 53487d209729d5781007dc0fd6076dc585cb3727 Mon Sep 17 00:00:00 2001
+From: Andrea Bocci <andrea.bocci@cern.ch>
+Date: Fri, 28 Feb 2020 17:45:03 +0100
+Subject: [PATCH] Add explicit conversion from llvm::StringRef to std::string
+
+llvm/llvm-project@777180a makes the llvm::StringRef conversion operator
+to std::string explicit.
+These changes add a call to the str() method to perform the conversion.
+
+Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
+---
+ iwyu_driver.cc       | 2 +-
+ iwyu_globals.cc      | 4 ++--
+ iwyu_lexer_utils.cc  | 2 +-
+ iwyu_location_util.h | 2 +-
+ iwyu_output.cc       | 2 +-
+ iwyu_path_util.cc    | 6 +++---
+ iwyu_preprocessor.cc | 4 ++--
+ 7 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/iwyu_driver.cc b/iwyu_driver.cc
+index bd163144..42fea35b 100644
+--- a/iwyu_driver.cc
++++ b/iwyu_driver.cc
+@@ -79,7 +79,7 @@ std::string GetExecutablePath(const char *Argv0) {
+ }
+ 
+ const char *SaveStringInSet(std::set<std::string> &SavedStrings, StringRef S) {
+-  return SavedStrings.insert(S).first->c_str();
++  return SavedStrings.insert(S.str()).first->c_str();
+ }
+ 
+ void ExpandArgsFromBuf(const char *Arg,
+diff --git a/iwyu_globals.cc b/iwyu_globals.cc
+index 0f58b4dc..26998966 100644
+--- a/iwyu_globals.cc
++++ b/iwyu_globals.cc
+@@ -293,7 +293,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+   for (auto it = header_search->system_dir_begin();
+        it != header_search->system_dir_end(); ++it) {
+     if (const DirectoryEntry* entry = it->getDir()) {
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map[path] = HeaderSearchPath::kSystemPath;
+     }
+   }
+@@ -303,7 +303,7 @@ static vector<HeaderSearchPath> ComputeHeaderSearchPaths(
+       // search_dir_begin()/end() includes both system and user paths.
+       // If it's a system path, it's already in the map, so everything
+       // new is a user path.  The insert only 'takes' for new entries.
+-      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName()));
++      const string path = NormalizeDirPath(MakeAbsolutePath(entry->getName().str()));
+       search_path_map.insert(make_pair(path, HeaderSearchPath::kUserPath));
+     }
+   }
+diff --git a/iwyu_lexer_utils.cc b/iwyu_lexer_utils.cc
+index fcea2d28..648c9da8 100644
+--- a/iwyu_lexer_utils.cc
++++ b/iwyu_lexer_utils.cc
+@@ -70,7 +70,7 @@ SourceLocation GetLocationAfter(
+ string GetIncludeNameAsWritten(
+     SourceLocation include_loc,
+     const CharacterDataGetterInterface& data_getter) {
+-  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter);
++  const string data = GetSourceTextUntilEndOfLine(include_loc, data_getter).str();
+   if (data.empty())
+     return data;
+   string::size_type endpos = string::npos;
+diff --git a/iwyu_location_util.h b/iwyu_location_util.h
+index 3892a424..6f8cf81c 100644
+--- a/iwyu_location_util.h
++++ b/iwyu_location_util.h
+@@ -89,7 +89,7 @@ bool IsInScratchSpace(clang::SourceLocation loc);
+ 
+ inline string GetFilePath(const clang::FileEntry* file) {
+   return (IsBuiltinFile(file) ? "<built-in>" :
+-          NormalizeFilePath(file->getName()));
++          NormalizeFilePath(file->getName().str()));
+ }
+ 
+ //------------------------------------------------------------
+diff --git a/iwyu_output.cc b/iwyu_output.cc
+index ca145710..8666c26c 100644
+--- a/iwyu_output.cc
++++ b/iwyu_output.cc
+@@ -168,7 +168,7 @@ string GetKindName(const clang::TagDecl* tag_decl) {
+   if (const FakeNamedDecl* fake = FakeNamedDeclIfItIsOne(named_decl)) {
+     return fake->kind_name();
+   }
+-  return tag_decl->getKindName();
++  return tag_decl->getKindName().str();
+ }
+ 
+ string GetQualifiedNameAsString(const clang::NamedDecl* named_decl) {
+diff --git a/iwyu_path_util.cc b/iwyu_path_util.cc
+index ab4fc800..9987ea47 100644
+--- a/iwyu_path_util.cc
++++ b/iwyu_path_util.cc
+@@ -134,7 +134,7 @@ string NormalizeFilePath(const string& path) {
+   std::replace(normalized.begin(), normalized.end(), '\\', '/');
+ #endif
+ 
+-  return normalized.str();
++  return normalized.str().str();
+ }
+ 
+ string NormalizeDirPath(const string& path) {
+@@ -154,14 +154,14 @@ string MakeAbsolutePath(const string& path) {
+   std::error_code error = llvm::sys::fs::make_absolute(absolute_path);
+   CHECK_(!error);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string MakeAbsolutePath(const string& base_path, const string& relative_path) {
+   llvm::SmallString<128> absolute_path(base_path);
+   llvm::sys::path::append(absolute_path, relative_path);
+ 
+-  return absolute_path.str();
++  return absolute_path.str().str();
+ }
+ 
+ string GetParentPath(const string& path) {
+diff --git a/iwyu_preprocessor.cc b/iwyu_preprocessor.cc
+index 58e78595..88b93144 100644
+--- a/iwyu_preprocessor.cc
++++ b/iwyu_preprocessor.cc
+@@ -313,7 +313,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+       break;
+     }
+     const string filename = GetSourceTextUntilEndOfLine(current_loc,
+-                                                        DefaultDataGetter());
++                                                        DefaultDataGetter()).str();
+     // Use "" or <> based on where the file lives.
+     string quoted_private_include;
+     if (IsSystemIncludeFile(GetFilePath(current_loc)))
+@@ -332,7 +332,7 @@ void IwyuPreprocessorInfo::ProcessHeadernameDirectivesInFile(
+     }
+ 
+     string after_text = GetSourceTextUntilEndOfLine(current_loc,
+-                                                    DefaultDataGetter());
++                                                    DefaultDataGetter()).str();
+     const string::size_type close_brace_pos = after_text.find('}');
+     if (close_brace_pos == string::npos) {
+       Warn(current_loc, "@headername directive missing a closing brace");
diff --git a/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
new file mode 100644
index 00000000000..663a883fa91
--- /dev/null
+++ b/srcpkgs/include-what-you-use/files/include-what-you-use-002-clang-astdumper.patch
@@ -0,0 +1,54 @@
+From 30549c6931972456d1e09ff5dbeecd258a8df72b Mon Sep 17 00:00:00 2001
+From: Kim Grasman <kim.grasman@gmail.com>
+Date: Thu, 9 Jul 2020 18:47:56 +0200
+Subject: [PATCH] Implement Stmt printing with ASTDumper
+
+The Clang API changed in commit 473fbc90d1fbf17e so that Stmt::dump
+takes an ASTContext instead of a SourceManager.
+
+Rather than wire a global ASTContext, reimplement PrintableStmt and
+PrintStmt to duplicate the most trivial implementations not requiring
+ASTContext.
+
+No functional change.
+---
+ iwyu_ast_util.cc | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/iwyu_ast_util.cc b/iwyu_ast_util.cc
+index d3d4dd1f..b19a11fb 100644
+--- a/iwyu_ast_util.cc
++++ b/iwyu_ast_util.cc
+@@ -25,6 +25,7 @@
+ #include "llvm/Support/Casting.h"
+ #include "llvm/Support/raw_ostream.h"
+ #include "clang/AST/ASTContext.h"
++#include "clang/AST/ASTDumper.h"
+ #include "clang/AST/CanonicalType.h"
+ #include "clang/AST/Decl.h"
+ #include "clang/AST/DeclBase.h"
+@@ -46,6 +47,7 @@ namespace clang {
+ class FileEntry;
+ }  // namespace clang
+ 
++using clang::ASTDumper;
+ using clang::BlockPointerType;
+ using clang::CXXConstructExpr;
+ using clang::CXXConstructorDecl;
+@@ -450,12 +452,14 @@ string PrintableDecl(const Decl* decl, bool terse/*=true*/) {
+ string PrintableStmt(const Stmt* stmt) {
+   std::string buffer;
+   raw_string_ostream ostream(buffer);
+-  stmt->dump(ostream, *GlobalSourceManager());
++  ASTDumper dumper(ostream, /*ShowColors=*/false);
++  dumper.Visit(stmt);
+   return ostream.str();
+ }
+ 
+ void PrintStmt(const Stmt* stmt) {
+-  stmt->dump(*GlobalSourceManager());  // This prints to errs().
++  ASTDumper dumper(llvm::errs(), /*ShowColors=*/false);
++  dumper.Visit(stmt);
+ }
+ 
+ string PrintableType(const Type* type) {
diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 22c9d09d091..3811309bdde 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.14
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
@@ -15,6 +15,12 @@ distfiles="https://include-what-you-use.org/downloads/${pkgname}-${version}.src.
 checksum=43184397db57660c32e3298a6b1fd5ab82e808a1f5ab0591d6745f8d256200ef
 python_version=3
 
+post_extract() {
+	for i in ${FILESDIR}/include-what-you-use-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
+
 post_install() {
 	vlicense LICENSE.TXT
 }

From f932b52169f6a182b2e3645017e70bff9e00016c Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 16:17:54 +0100
Subject: [PATCH 21/23] bpftrace: update to 0.11.2

---
 ...trace-001-six-args-bpf_attach_uprobe.patch | 126 +++++++++++++++
 ...ace-002-seven-args-bpf_attach_uprobe.patch | 148 ++++++++++++++++++
 srcpkgs/bpftrace/template                     |  10 +-
 3 files changed, 282 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
 create mode 100644 srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch

diff --git a/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..e2b1ad1351b
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-001-six-args-bpf_attach_uprobe.patch
@@ -0,0 +1,126 @@
+From 52fb793c6423c19696e07cc14ad5f9182f7eca0e Mon Sep 17 00:00:00 2001
+From: Viktor Malik <viktor.malik@gmail.com>
+Date: Wed, 12 Aug 2020 09:45:29 +0200
+Subject: [PATCH] Feature-detect bpf_attach_kprobe signature
+
+The function has 6 parameters in current versions of BCC and 5
+parameters in older versions.
+
+This is detected in CMake using CHECK_CXX_SOURCE_COMPILES. For static
+compilation, we also need to retrieve and link static libbpf, libelf,
+and libz. This may cause libbpf, libelf and libz to be searched for
+twice, but it should be fine since CMake caches results.
+
+Fixes iovisor#1027.
+---
+ cmake/FindLibBcc.cmake | 24 ++++++++++++++++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 31 ++++++++++++++-----------------
+ tests/CMakeLists.txt   |  3 +++
+ 4 files changed, 44 insertions(+), 17 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 9d30b04bc..ec216271d 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -70,3 +70,27 @@ include (FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBcc "Please install the bcc library package, which is required. Depending on your distro, it may be called bpfcclib or bcclib (Ubuntu), bcc-devel (Fedora), or something else. If unavailable, install bcc from source (github.com/iovisor/bcc)."
+   LIBBCC_LIBRARIES
+   LIBBCC_INCLUDE_DIRS)
++
++# Check bpf_attach_kprobe signature
++if(${LIBBCC_FOUND})
++if(STATIC_LINKING)
++  # libbcc.a is not statically linked with libbpf.a, libelf.a, and libz.a.
++  # If we do a static bpftrace build, we must link them in.
++  find_package(LibBpf)
++  find_package(LibElf)
++  find_package(LibZ)
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_BPF_LIBRARY_STATIC} ${LIBBPF_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBZ_LIBRARIES})
++else()
++  SET(CMAKE_REQUIRED_LIBRARIES ${LIBBCC_LIBRARIES})
++endif()
++INCLUDE(CheckCXXSourceCompiles)
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_kprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++SET(CMAKE_REQUIRED_LIBRARIES)
++endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 647a23f1c..448a045fc 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -80,6 +80,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 587a11576..afad9ed18 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -754,26 +754,23 @@ void AttachedProbe::load_prog()
+   }
+ }
+ 
+-// XXX(mmarchini): bcc changed the signature of bpf_attach_kprobe, adding a new
+-// int parameter at the end. Since there's no reliable way to feature-detect
+-// this, we create a function pointer with the long signature and cast
+-// bpf_attach_kprobe to this function pointer. If we're on an older bcc
+-// version, bpf_attach_kprobe call will be augmented with an extra register
+-// being used for the last parameter, even though this register won't be used
+-// inside the function. Since the register won't be used this is kinda safe,
+-// although not ideal.
+-typedef int (*attach_probe_wrapper_signature)(int, enum bpf_probe_attach_type, const char*, const char*, uint64_t, int);
+-
+ void AttachedProbe::attach_kprobe(bool safe_mode)
+ {
+   resolve_offset_kprobe(safe_mode);
+-  int perf_event_fd = cast_signature<attach_probe_wrapper_signature>(
+-      &bpf_attach_kprobe)(progfd_,
+-                          attachtype(probe_.type),
+-                          eventname().c_str(),
+-                          probe_.attach_point.c_str(),
+-                          offset_,
+-                          0);
++#ifdef LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_,
++                                        0);
++#else
++  int perf_event_fd = bpf_attach_kprobe(progfd_,
++                                        attachtype(probe_.type),
++                                        eventname().c_str(),
++                                        probe_.attach_point.c_str(),
++                                        offset_);
++#endif
+ 
+   if (perf_event_fd < 0) {
+     if (probe_.orig_name != probe_.name) {
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 3688b8487..84daeb2aa 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -102,6 +102,9 @@ if(HAVE_BFD_DISASM)
+     target_link_libraries(bpftrace_test ${LIBOPCODES_LIBRARIES})
+   endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
++if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
new file mode 100644
index 00000000000..2cc55c86555
--- /dev/null
+++ b/srcpkgs/bpftrace/files/bpftrace-002-seven-args-bpf_attach_uprobe.patch
@@ -0,0 +1,148 @@
+From c7dbab451484b96178da1a8c43330154ce4c9d7a Mon Sep 17 00:00:00 2001
+From: Daniel Xu <dxu@dxuuu.xyz>
+Date: Wed, 14 Oct 2020 17:09:46 -0700
+Subject: [PATCH] Detect 7 arg bpf_attach_uprobe() API
+
+The 7th arg allows us to specify the usdt semaphore location.
+---
+ cmake/FindLibBcc.cmake | 11 +++++++++++
+ src/CMakeLists.txt     |  3 +++
+ src/attached_probe.cpp | 42 ++++++++++++++++++++++++++++++++++--------
+ src/main.cpp           |  6 ++++++
+ tests/CMakeLists.txt   |  3 +++
+ 5 files changed, 57 insertions(+), 8 deletions(-)
+
+diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake
+index 4c09a8ca2..92cedab5e 100644
+--- a/cmake/FindLibBcc.cmake
++++ b/cmake/FindLibBcc.cmake
+@@ -7,6 +7,8 @@
+ #  LIBBCC_DEFINITIONS - Compiler switches required for using libbcc
+ #  LIBBCC_BPF_LIBRARY_STATIC - libbpf static library (for static compilation)
+ #  LIBBCC_LOADER_LIBRARY_STATIC - libbcc helper static library (for static compilation)
++#  LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE
++#  LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ #
+ # Note that the shared libbcc binary has libbpf and bcc_loader already compiled in but
+ # the static doesn't. So when creating a static build those have to be included too.
+@@ -94,6 +96,15 @@ int main(void) {
+   return 0;
+ }
+ " LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++
++CHECK_CXX_SOURCE_COMPILES("
++#include <bcc/libbpf.h>
++
++int main(void) {
++  bpf_attach_uprobe(0, BPF_PROBE_ENTRY, \"\", \"\", 0, 0, 0);
++  return 0;
++}
++" LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ SET(CMAKE_REQUIRED_LIBRARIES)
+ SET(CMAKE_REQUIRED_INCLUDES)
+ endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 9162356e3..cef94d144 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -88,6 +88,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ if (ALLOW_UNSAFE_PROBE)
+   target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp
+index 93fbfa876..a5d8bc56d 100644
+--- a/src/attached_probe.cpp
++++ b/src/attached_probe.cpp
+@@ -698,12 +698,23 @@ void AttachedProbe::attach_uprobe(bool safe_mode)
+ {
+   resolve_offset_uprobe(safe_mode);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_,
+-                                        attachtype(probe_.type),
+-                                        eventname().c_str(),
+-                                        probe_.path.c_str(),
+-                                        offset_,
+-                                        probe_.pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        probe_.pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+     throw std::runtime_error("Error attaching probe: " + probe_.name);
+@@ -812,8 +823,23 @@ void AttachedProbe::attach_usdt(int pid)
+ 
+   offset_ = resolve_offset(probe_.path, probe_.attach_point, probe_.loc);
+ 
+-  int perf_event_fd = bpf_attach_uprobe(progfd_, attachtype(probe_.type),
+-      eventname().c_str(), probe_.path.c_str(), offset_, pid == 0 ? -1 : pid);
++  int perf_event_fd =
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid,
++                        0);
++#else
++      bpf_attach_uprobe(progfd_,
++                        attachtype(probe_.type),
++                        eventname().c_str(),
++                        probe_.path.c_str(),
++                        offset_,
++                        pid == 0 ? -1 : pid);
++#endif // LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
+ 
+   if (perf_event_fd < 0)
+   {
+diff --git a/src/main.cpp b/src/main.cpp
+index 48fcf5aa0..09f4d9677 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -162,6 +162,12 @@ static int info()
+             << "yes" << std::endl;
+ #else
+             << "no" << std::endl;
++#endif
++  std::cerr << "  bcc bpf_attach_uprobe refcount: "
++#ifdef LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE
++            << "yes" << std::endl;
++#else
++            << "no" << std::endl;
+ #endif
+   std::cerr << "  libbpf: "
+ #ifdef HAVE_LIBBPF
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index ace5ff106..332eba2b5 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -116,6 +116,9 @@ endif(HAVE_BFD_DISASM)
+ if(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+   target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
+ endif(LIBBCC_ATTACH_KPROBE_SIX_ARGS_SIGNATURE)
++if(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++  target_compile_definitions(bpftrace_test PRIVATE LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
++endif(LIBBCC_ATTACH_UPROBE_SEVEN_ARGS_SIGNATURE)
+ 
+ target_link_libraries(bpftrace_test arch ast parser resources)
+ 
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index d8367fa5c03..44e6c174107 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,6 +1,6 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
-version=0.11.1
+version=0.11.2
 revision=1
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
@@ -12,7 +12,13 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
 license="Apache-2.0"
 homepage="https://github.com/iovisor/bpftrace/"
 distfiles="https://github.com/iovisor/bpftrace/archive/v${version}.tar.gz"
-checksum=98efc9396451bc1a4f73378cec4755e07e7718cb5d698472606f5ffc2b9e48e8
+checksum=1f0fc30073547e3b285e1a373aa469bb18d3ba27f8c05f91016df0ca84f77f90
+
+post_extract() {
+	for i in ${FILESDIR}/bpftrace-*.patch; do
+		patch -sNp1 -i ${i}
+	done
+}
 
 post_install() {
 	# clashes with bcc-tools

From 33c9bc04ccf3d1af0e58db890dc8d6c9443d0324 Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 19:29:15 +0100
Subject: [PATCH 22/23] beignet: rebuild for llvm11

---
 srcpkgs/beignet/patches/llvm11.patch | 945 +++++++++++++++++++++++++++
 srcpkgs/beignet/template             |   2 +-
 2 files changed, 946 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/beignet/patches/llvm11.patch

diff --git a/srcpkgs/beignet/patches/llvm11.patch b/srcpkgs/beignet/patches/llvm11.patch
new file mode 100644
index 00000000000..9f328267698
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm11.patch
@@ -0,0 +1,945 @@
+Source: Snektron
+
+There were a few changes required for LLVM 11:
+* llvm::StringRef requires .str(), implicit conversion was removed
+* llvm::CallSite was removed, but the required methods are available on llvm::CallInst
+* VectorTyID was split into FixedVectorTyID and ScalableVectorTyID, FixedVectorTyID was used
+* CallInst::getCalledValue() was renamed to CallInst::getCalledOperand()
+* Implicit conversion from MaybeAlign to Align was removed, so MaybeAlign::valueOrOne was used instead.
+
+--- backend/src/llvm/StripAttributes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/StripAttributes.cpp	2020-11-09 19:04:19.641897141 +0100
+@@ -107,9 +107,8 @@
+        BB != E; ++BB) {
+     for (BasicBlock::iterator Inst = BB->begin(), E = BB->end();
+          Inst != E; ++Inst) {
+-      CallSite Call(&*Inst);
+-      if (Call)
+-        Call.setCallingConv(CallingConv::C);
++      if (CallInst* callInst = dyn_cast<CallInst>(&*Inst))
++        callInst->setCallingConv(CallingConv::C);
+     }
+   }
+
+--- backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_bitcode_link.cpp	2020-11-09 17:04:09.633753428 +0100
+@@ -98,7 +98,7 @@
+         if (callFunc && callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        std::string fnName = call->getCalledValue()->stripPointerCasts()->getName();
++        std::string fnName = call->getCalledOperand()->stripPointerCasts()->getName().str();
+
+         if (!MFS.insert(fnName).second) {
+           continue;
+--- backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_device_enqueue.cpp	2020-11-09 19:01:49.201915008 +0100
+@@ -45,7 +45,7 @@
+       return NULL;
+
+     /* This is a fake, to check the function bitcast is for block or not */
+-    std::string fnName = Fn->getName();
++    std::string fnName = Fn->getName().str();
+     if(fnName.find("_invoke") == std::string::npos)
+       return NULL;
+
+@@ -119,18 +119,18 @@
+       ParamTys.push_back(ty);
+     }
+     FunctionType* NewFT = FunctionType::get(Fn->getReturnType(), ParamTys, false);
+-    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName());
++    Function* NewFn = Function::Create(NewFT, Function::ExternalLinkage, Fn->getName().str());
+     SmallVector<ReturnInst*, 8> Returns;
+
+     Function::arg_iterator NewFnArgIt = NewFn->arg_begin();
+     for (Function::arg_iterator I = Fn->arg_begin(), E = Fn->arg_end(); I != E; ++I) {
+-      std::string ArgName = I->getName();
++      std::string ArgName = I->getName().str();
+       NewFnArgIt->setName(ArgName);
+       VMap[&*I] = &(*NewFnArgIt++);
+     }
+     CloneFunctionInto(NewFn, Fn, VMap, /*ModuleLevelChanges=*/true, Returns);
+
+-    Fn->setName("__d" + Fn->getName());
++    Fn->setName("__d" + Fn->getName().str());
+     mod->getFunctionList().push_back(NewFn);
+     //mod->getOrInsertFunction(NewFn->getName(), NewFn->getFunctionType(),
+     //                         NewFn->getAttributes());
+@@ -147,7 +147,7 @@
+       argTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argBaseTypeNames.push_back(llvm::MDString::get(Context, "char*"));
+       argTypeQuals.push_back(llvm::MDString::get(Context, ""));
+-      argNames.push_back(llvm::MDString::get(Context, I->getName()));
++      argNames.push_back(llvm::MDString::get(Context, I->getName().str()));
+     }
+
+     //If run to here, llvm version always > 3.9, add the version check just for build.
+@@ -198,7 +198,7 @@
+            * invoke pointer to store the index in the unit's block functions index.*/
+           Function *Fn = dyn_cast<Function>(bt->getOperand(0));
+
+-          std::string fnName = Fn->getName();
++          std::string fnName = Fn->getName().str();
+           int index = -1;
+           for(size_t i=0; i<unit.blockFuncs.size(); i++) {
+             if(unit.blockFuncs[i] == fnName) {
+@@ -241,7 +241,7 @@
+             //unnamed call function, parse the use to find the define of called function
+             SmallVector<Value*, 16> args(CI->op_begin(), CI->op_end()-1);
+
+-            Value *v = CI->getCalledValue();
++            Value *v = CI->getCalledOperand();
+             BitCastInst* bt = dyn_cast<BitCastInst>(v);
+             if(bt == NULL)
+               continue;
+@@ -316,7 +316,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+
+@@ -332,7 +332,7 @@
+           } else {
+             //handle enqueue_kernel function call
+             Function *fn = CI->getCalledFunction();
+-            if (fn->getName().find("enqueue_kernel") == std::string::npos)
++            if (fn->getName().str().find("enqueue_kernel") == std::string::npos)
+               continue;
+
+             //block parameter's index, 3 or 6
+@@ -361,7 +361,7 @@
+                   ConstantExpr *expr = dyn_cast<ConstantExpr>(c->getOperand(3));
+                   BitCastInst *bt = dyn_cast<BitCastInst>(expr->getAsInstruction());
+                   Function* f = dyn_cast<Function>(bt->getOperand(0));
+-                  blocks[v] = f->getName();
++                  blocks[v] = f->getName().str();
+                 }
+               }
+             } else if(isa<AllocaInst>(block)) {
+--- backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_gen_backend.cpp	2020-11-09 18:33:50.919114327 +0100
+@@ -376,7 +376,7 @@
+           GBE_ASSERT(index == 0);
+           return this->_newScalar(value, key, type, index, uniform);
+           break;
+-        case Type::VectorTyID:
++        case Type::FixedVectorTyID:
+         {
+           auto vectorType = cast<VectorType>(type);
+           auto elementType = vectorType->getElementType();
+@@ -743,20 +743,20 @@
+ #undef DECL_VISIT_FN
+
+     // Emit rounding instructions from gen native function
+-    void emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode);
++    void emitRoundingCallInst(CallInst &I, ir::Opcode opcode);
+     // Emit unary instructions from gen native function
+-    void emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
++    void emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type = ir::TYPE_FLOAT);
+     // Emit unary instructions from gen native function
+-    void emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode);
++    void emitAtomicInst(CallInst &I, ir::AtomicOps opcode);
+     // Emit workgroup instructions
+-    void emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode);
++    void emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode);
+     // Emit subgroup instructions
+-    void emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+-    void emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
++    void emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type = ir::TYPE_U32);
+
+-    uint8_t appendSampler(CallSite::arg_iterator AI);
++    uint8_t appendSampler(User::op_iterator AI);
+     uint8_t getImageID(CallInst &I);
+
+     // These instructions are not supported at all
+@@ -1320,13 +1320,13 @@
+ #endif
+
+       if(typeNameNode) {
+-        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+       }
+       if(typeBaseNameNode) {
+-        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++        llvmInfo.typeBaseName= (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+       }
+-      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
+-      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++      llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
++      llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+       bool isImage = llvmInfo.isImageType();
+       bool isPipe = llvmInfo.isPipeType();
+       if (I->getType()->isPointerTy() || isImage || isPipe) {
+@@ -1531,7 +1531,7 @@
+             EltTy = getEltType(EltTy, TypeIndex);
+         }
+
+-        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName());
++        ir::Constant cc = unit.getConstantSet().getConstant(pointer->getName().str());
+         unsigned int defOffset = cc.getOffset();
+         relocs.push_back(ir::RelocEntry(offset, defOffset + constantOffset));
+
+@@ -1546,7 +1546,7 @@
+       return;
+     }
+     if (isa<GlobalVariable>(c)) {
+-      ir::Constant cc = unit.getConstantSet().getConstant(c->getName());
++      ir::Constant cc = unit.getConstantSet().getConstant(c->getName().str());
+       unsigned int defOffset = cc.getOffset();
+
+       relocs.push_back(ir::RelocEntry(offset, defOffset));
+@@ -1609,7 +1609,7 @@
+           }
+           break;
+         }
+-      case Type::TypeID::VectorTyID:
++      case Type::TypeID::FixedVectorTyID:
+         {
+           const ConstantDataSequential *cds = dyn_cast<ConstantDataSequential>(c);
+           const VectorType *vecTy = cast<VectorType>(type);
+@@ -1936,7 +1936,7 @@
+       case Type::PointerTyID:
+         regTranslator.newScalar(value, key, 0, uniform);
+         break;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         auto vectorType = cast<VectorType>(type);
+         const uint32_t elemNum = vectorType->getNumElements();
+@@ -2395,7 +2395,7 @@
+ #endif
+         }
+         if(typeNameNode) {
+-          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeName = (cast<MDString>(typeNameNode->getOperand(opID)))->getString().str();
+           //LLVM 3.9 image's type name include access qual, don't match OpenCL spec, erase them.
+           std::vector<std::string> filters = {"__read_only ", "__write_only "};
+           for (uint32_t i = 0; i < filters.size(); i++) {
+@@ -2406,16 +2406,16 @@
+           }
+         }
+         if(typeBaseNameNode){
+-          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString();
++          llvmInfo.typeBaseName = (cast<MDString>(typeBaseNameNode->getOperand(opID)))->getString().str();
+         }
+         if(accessQualNode) {
+-          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString();
++          llvmInfo.accessQual = (cast<MDString>(accessQualNode->getOperand(opID)))->getString().str();
+         }
+         if(typeQualNode) {
+-          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString();
++          llvmInfo.typeQual = (cast<MDString>(typeQualNode->getOperand(opID)))->getString().str();
+         }
+         if(argNameNode){
+-          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString();
++          llvmInfo.argName = (cast<MDString>(argNameNode->getOperand(opID)))->getString().str();
+         }
+
+         // function arguments are uniform values.
+@@ -3010,7 +3010,7 @@
+         } else {
+           this->newRegister(const_cast<GlobalVariable*>(&v));
+           ir::Register reg = regTranslator.getScalar(const_cast<GlobalVariable*>(&v), 0);
+-          ir::Constant &con = unit.getConstantSet().getConstant(v.getName());
++          ir::Constant &con = unit.getConstantSet().getConstant(v.getName().str());
+           if (!legacyMode) {
+             ir::Register regload = ctx.reg(getFamily(getType(ctx, v.getType())));
+             ctx.LOADI(getType(ctx, v.getType()), regload, ctx.newIntegerImmediate(con.getOffset(), getType(ctx, v.getType())));
+@@ -3212,7 +3212,7 @@
+         GBE_ASSERTM(false, "Unsupported calling convention");
+     }
+
+-    ctx.startFunction(F.getName());
++    ctx.startFunction(F.getName().str());
+
+     ir::Function &fn = ctx.getFunction();
+     this->regTranslator.clear();
+@@ -3810,9 +3810,9 @@
+
+   void GenWriter::regAllocateCallInst(CallInst &I) {
+     Value *dst = &I;
+-    Value *Callee = I.getCalledValue();
++    Value *Callee = I.getCalledOperand();
+     GBE_ASSERT(ctx.getFunction().getProfile() == ir::PROFILE_OCL);
+-    GBE_ASSERT(isa<InlineAsm>(I.getCalledValue()) == false);
++    GBE_ASSERT(isa<InlineAsm>(I.getCalledOperand()) == false);
+     if(I.getNumArgOperands()) GBE_ASSERT(I.hasStructRetAttr() == false);
+
+     // We only support a small number of intrinsics right now
+@@ -3870,7 +3870,7 @@
+       }
+     }
+     // Get the name of the called function and handle it
+-    const std::string fnName = Callee->stripPointerCasts()->getName();
++    const std::string fnName = Callee->stripPointerCasts()->getName().str();
+     auto genIntrinsicID = intrinsicMap.find(fnName);
+     switch (genIntrinsicID) {
+       case GEN_OCL_GET_GROUP_ID0:
+@@ -4166,7 +4166,7 @@
+     };
+   }
+
+-  void GenWriter::emitRoundingCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode) {
++  void GenWriter::emitRoundingCallInst(CallInst &I, ir::Opcode opcode) {
+     if (I.getType()->isHalfTy()) {
+       const ir::Register src = this->getRegister(I.getOperand(0));
+       const ir::Register srcFloat = ctx.reg(ir::FAMILY_DWORD);
+@@ -4177,14 +4177,14 @@
+       ctx.F32TO16(ir::TYPE_U16, ir::TYPE_FLOAT, dst, dstFloat);
+     } else {
+       GBE_ASSERT(I.getType()->isFloatTy());
+-      this->emitUnaryCallInst(I,CS,opcode);
++      this->emitUnaryCallInst(I,opcode);
+     }
+   }
+
+-  void GenWriter::emitUnaryCallInst(CallInst &I, CallSite &CS, ir::Opcode opcode, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
++  void GenWriter::emitUnaryCallInst(CallInst &I, ir::Opcode opcode, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+     GBE_ASSERT(AI != AE);
+     const ir::Register src = this->getRegister(*AI);
+@@ -4293,9 +4293,9 @@
+     this->emitAtomicInstHelper(opcode, type, dst, llvmPtr, payloadTuple);
+   }
+
+-  void GenWriter::emitAtomicInst(CallInst &I, CallSite &CS, ir::AtomicOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitAtomicInst(CallInst &I, ir::AtomicOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+     Value *llvmPtr = *AI;
+     ir::AddressSpace addrSpace = addressSpaceLLVMToGen(llvmPtr->getType()->getPointerAddressSpace());
+@@ -4348,7 +4348,7 @@
+     }
+   }
+
+-  void GenWriter::emitWorkGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
++  void GenWriter::emitWorkGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
+     ir::Function &f = ctx.getFunction();
+
+     if (f.getwgBroadcastSLM() < 0 && opcode == ir::WORKGROUP_OP_BROADCAST) {
+@@ -4378,8 +4378,8 @@
+       GBE_ASSERT(f.gettidMapSLM() >= 0);
+     }
+
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4391,14 +4391,14 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 3);
+       ctx.WORKGROUP(opcode, (uint32_t)f.gettidMapSLM(), getRegister(&I), srcTuple, 3, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+         src[i] = this->getRegister(*(AI++));
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.WORKGROUP(ir::WORKGROUP_OP_BROADCAST, (uint32_t)f.getwgBroadcastSLM(), getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4423,9 +4423,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitSubGroupInst(CallInst &I, CallSite &CS, ir::WorkGroupOps opcode) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitSubGroupInst(CallInst &I, ir::WorkGroupOps opcode) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     if (opcode == ir::WORKGROUP_OP_ALL || opcode == ir::WORKGROUP_OP_ANY) {
+@@ -4435,7 +4435,7 @@
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 1);
+       ctx.SUBGROUP(opcode, getRegister(&I), srcTuple, 1, ir::TYPE_S32);
+     } else if (opcode == ir::WORKGROUP_OP_BROADCAST) {
+-      int argNum = CS.arg_size();
++      int argNum = I.arg_size();
+       GBE_ASSERT(argNum == 2);
+       std::vector<ir::Register> src(argNum);
+       for (int i = 0; i < argNum; i++) {
+@@ -4443,7 +4443,7 @@
+       }
+       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], argNum);
+       ctx.SUBGROUP(ir::WORKGROUP_OP_BROADCAST, getRegister(&I), srcTuple, argNum,
+-          getType(ctx, (*CS.arg_begin())->getType()));
++          getType(ctx, (*I.arg_begin())->getType()));
+     } else {
+       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
+       GBE_ASSERT(sign);
+@@ -4466,9 +4466,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteMemInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     Value *llvmPtr = *(AI++);
+@@ -4522,9 +4522,9 @@
+     GBE_ASSERT(AI == AE);
+   }
+
+-  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, CallSite &CS, bool isWrite, uint8_t vec_size, ir::Type type) {
+-    CallSite::arg_iterator AI = CS.arg_begin();
+-    CallSite::arg_iterator AE = CS.arg_end();
++  void GenWriter::emitBlockReadWriteImageInst(CallInst &I, bool isWrite, uint8_t vec_size, ir::Type type) {
++    User::op_iterator AI = I.arg_begin();
++    User::op_iterator AE = I.arg_end();
+     GBE_ASSERT(AI != AE);
+
+     const uint8_t imageID = getImageID(I);
+@@ -4557,7 +4557,7 @@
+
+   /* append a new sampler. should be called before any reference to
+    * a sampler_t value. */
+-  uint8_t GenWriter::appendSampler(CallSite::arg_iterator AI) {
++  uint8_t GenWriter::appendSampler(User::op_iterator AI) {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+     CallInst *TC = dyn_cast<CallInst>(*AI);
+     Constant *CPV = TC ? dyn_cast<Constant>(TC->getOperand(0)) : NULL;
+@@ -4595,10 +4595,9 @@
+         const ir::Function &fn = ctx.getFunction();
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+         switch (F->getIntrinsicID()) {
+           case Intrinsic::stacksave:
+@@ -4764,17 +4763,17 @@
+             ctx.MAD(srcType, dst, src0, src1, src2);
+           }
+           break;
+-          case Intrinsic::sqrt: this->emitUnaryCallInst(I,CS,ir::OP_SQR); break;
+-          case Intrinsic::ceil: this->emitRoundingCallInst(I,CS,ir::OP_RNDU); break;
+-          case Intrinsic::trunc: this->emitRoundingCallInst(I,CS,ir::OP_RNDZ); break;
+-          case Intrinsic::rint: this->emitRoundingCallInst(I,CS,ir::OP_RNDE); break;
+-          case Intrinsic::floor: this->emitRoundingCallInst(I,CS,ir::OP_RNDD); break;
+-          case Intrinsic::sin: this->emitUnaryCallInst(I,CS,ir::OP_SIN); break;
+-          case Intrinsic::cos: this->emitUnaryCallInst(I,CS,ir::OP_COS); break;
+-          case Intrinsic::log2: this->emitUnaryCallInst(I,CS,ir::OP_LOG); break;
+-          case Intrinsic::exp2: this->emitUnaryCallInst(I,CS,ir::OP_EXP); break;
++          case Intrinsic::sqrt: this->emitUnaryCallInst(I,ir::OP_SQR); break;
++          case Intrinsic::ceil: this->emitRoundingCallInst(I,ir::OP_RNDU); break;
++          case Intrinsic::trunc: this->emitRoundingCallInst(I,ir::OP_RNDZ); break;
++          case Intrinsic::rint: this->emitRoundingCallInst(I,ir::OP_RNDE); break;
++          case Intrinsic::floor: this->emitRoundingCallInst(I,ir::OP_RNDD); break;
++          case Intrinsic::sin: this->emitUnaryCallInst(I,ir::OP_SIN); break;
++          case Intrinsic::cos: this->emitUnaryCallInst(I,ir::OP_COS); break;
++          case Intrinsic::log2: this->emitUnaryCallInst(I,ir::OP_LOG); break;
++          case Intrinsic::exp2: this->emitUnaryCallInst(I,ir::OP_EXP); break;
+           case Intrinsic::bswap:
+-            this->emitUnaryCallInst(I,CS,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
++            this->emitUnaryCallInst(I,ir::OP_BSWAP, getUnsignedType(ctx, I.getType())); break;
+           case Intrinsic::pow:
+           {
+             const ir::Register src0 = this->getRegister(*AI); ++AI;
+@@ -4794,21 +4793,20 @@
+         }
+       } else {
+         // Get the name of the called function and handle it
+-        Value *Callee = I.getCalledValue();
+-        const std::string fnName = Callee->stripPointerCasts()->getName();
++        Value *Callee = I.getCalledOperand();
++        const std::string fnName = Callee->stripPointerCasts()->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(&I);
+-        CallSite::arg_iterator AI = CS.arg_begin();
++        User::op_iterator AI = I.arg_begin();
+ #if GBE_DEBUG
+-        CallSite::arg_iterator AE = CS.arg_end();
++        User::op_iterator AE = I.arg_end();
+ #endif /* GBE_DEBUG */
+
+         switch (genIntrinsicID) {
+-          case GEN_OCL_FBH: this->emitUnaryCallInst(I,CS,ir::OP_FBH, ir::TYPE_U32); break;
+-          case GEN_OCL_FBL: this->emitUnaryCallInst(I,CS,ir::OP_FBL, ir::TYPE_U32); break;
+-          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,CS,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
++          case GEN_OCL_FBH: this->emitUnaryCallInst(I,ir::OP_FBH, ir::TYPE_U32); break;
++          case GEN_OCL_FBL: this->emitUnaryCallInst(I,ir::OP_FBL, ir::TYPE_U32); break;
++          case GEN_OCL_CBIT: this->emitUnaryCallInst(I,ir::OP_CBIT, getUnsignedType(ctx, (*AI)->getType())); break;
+           case GEN_OCL_ABS:
+           {
+             const ir::Register src = this->getRegister(*AI);
+@@ -4915,8 +4913,8 @@
+             ctx.REGION(dst, src, x.getIntegerValue());
+             break;
+           }
+-          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,CS,ir::OP_RSQ); break;
+-          case GEN_OCL_RCP: this->emitUnaryCallInst(I,CS,ir::OP_RCP); break;
++          case GEN_OCL_RSQ: this->emitUnaryCallInst(I,ir::OP_RSQ); break;
++          case GEN_OCL_RCP: this->emitUnaryCallInst(I,ir::OP_RCP); break;
+           case GEN_OCL_FORCE_SIMD8: ctx.setSimdWidth(8); break;
+           case GEN_OCL_FORCE_SIMD16: ctx.setSimdWidth(16); break;
+           case GEN_OCL_LBARRIER: ctx.SYNC(ir::syncLocalBarrier); break;
+@@ -4947,31 +4945,31 @@
+             break;
+           }
+           case GEN_OCL_ATOMIC_ADD0:
+-          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_ADD); break;
++          case GEN_OCL_ATOMIC_ADD1: this->emitAtomicInst(I,ir::ATOMIC_OP_ADD); break;
+           case GEN_OCL_ATOMIC_SUB0:
+-          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_SUB); break;
++          case GEN_OCL_ATOMIC_SUB1: this->emitAtomicInst(I,ir::ATOMIC_OP_SUB); break;
+           case GEN_OCL_ATOMIC_AND0:
+-          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_AND); break;
++          case GEN_OCL_ATOMIC_AND1: this->emitAtomicInst(I,ir::ATOMIC_OP_AND); break;
+           case GEN_OCL_ATOMIC_OR0:
+-          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_OR); break;
++          case GEN_OCL_ATOMIC_OR1: this->emitAtomicInst(I,ir::ATOMIC_OP_OR); break;
+           case GEN_OCL_ATOMIC_XOR0:
+-          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XOR); break;
++          case GEN_OCL_ATOMIC_XOR1: this->emitAtomicInst(I,ir::ATOMIC_OP_XOR); break;
+           case GEN_OCL_ATOMIC_XCHG0:
+-          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_XCHG); break;
++          case GEN_OCL_ATOMIC_XCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_XCHG); break;
+           case GEN_OCL_ATOMIC_INC0:
+-          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_INC); break;
++          case GEN_OCL_ATOMIC_INC1: this->emitAtomicInst(I,ir::ATOMIC_OP_INC); break;
+           case GEN_OCL_ATOMIC_DEC0:
+-          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_DEC); break;
++          case GEN_OCL_ATOMIC_DEC1: this->emitAtomicInst(I,ir::ATOMIC_OP_DEC); break;
+           case GEN_OCL_ATOMIC_UMIN0:
+-          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMIN); break;
++          case GEN_OCL_ATOMIC_UMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMIN); break;
+           case GEN_OCL_ATOMIC_UMAX0:
+-          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_UMAX); break;
++          case GEN_OCL_ATOMIC_UMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_UMAX); break;
+           case GEN_OCL_ATOMIC_IMIN0:
+-          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMIN); break;
++          case GEN_OCL_ATOMIC_IMIN1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMIN); break;
+           case GEN_OCL_ATOMIC_IMAX0:
+-          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_IMAX); break;
++          case GEN_OCL_ATOMIC_IMAX1: this->emitAtomicInst(I,ir::ATOMIC_OP_IMAX); break;
+           case GEN_OCL_ATOMIC_CMPXCHG0:
+-          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,CS,ir::ATOMIC_OP_CMPXCHG); break;
++          case GEN_OCL_ATOMIC_CMPXCHG1: this->emitAtomicInst(I,ir::ATOMIC_OP_CMPXCHG); break;
+           case GEN_OCL_GET_IMAGE_WIDTH:
+           case GEN_OCL_GET_IMAGE_HEIGHT:
+           case GEN_OCL_GET_IMAGE_DEPTH:
+@@ -5429,48 +5427,48 @@
+             ctx.WAIT();
+             break;
+           }
+-          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ALL); break;
+-          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_ANY); break;
++          case GEN_OCL_WORK_GROUP_ALL: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ALL); break;
++          case GEN_OCL_WORK_GROUP_ANY: this->emitWorkGroupInst(I, ir::WORKGROUP_OP_ANY); break;
+           case GEN_OCL_WORK_GROUP_BROADCAST:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_WORK_GROUP_REDUCE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_WORK_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitWorkGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitWorkGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_BROADCAST:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_BROADCAST); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_BROADCAST); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_ADD); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MAX); break;
+           case GEN_OCL_SUB_GROUP_REDUCE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_REDUCE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_REDUCE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_EXCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_EXCLUSIVE_MIN); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_ADD:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_ADD); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MAX:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MAX); break;
+           case GEN_OCL_SUB_GROUP_SCAN_INCLUSIVE_MIN:
+-            this->emitSubGroupInst(I, CS, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
++            this->emitSubGroupInst(I, ir::WORKGROUP_OP_INCLUSIVE_MIN); break;
+           case GEN_OCL_LRP:
+           {
+             const ir::Register dst  = this->getRegister(&I);
+@@ -5484,69 +5482,69 @@
+             break;
+           }
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteMemInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteMemInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteMemInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteMemInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteMemInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteMemInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteMemInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteMemInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1); break;
++            this->emitBlockReadWriteImageInst(I, false, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2); break;
++            this->emitBlockReadWriteImageInst(I, false, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4); break;
++            this->emitBlockReadWriteImageInst(I, false, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8); break;
++            this->emitBlockReadWriteImageInst(I, false, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1); break;
++            this->emitBlockReadWriteImageInst(I, true, 1); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2); break;
++            this->emitBlockReadWriteImageInst(I, true, 2); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4); break;
++            this->emitBlockReadWriteImageInst(I, true, 4); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_UI_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8); break;
++            this->emitBlockReadWriteImageInst(I, true, 8); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM2:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM4:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_MEM8:
+-            this->emitBlockReadWriteMemInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteMemInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_READ_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, false, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, false, 8, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 1, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 1, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE2:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 2, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 2, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE4:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 4, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 4, ir::TYPE_U16); break;
+           case GEN_OCL_SUB_GROUP_BLOCK_WRITE_US_IMAGE8:
+-            this->emitBlockReadWriteImageInst(I, CS, true, 8, ir::TYPE_U16); break;
++            this->emitBlockReadWriteImageInst(I, true, 8, ir::TYPE_U16); break;
+           case GEN_OCL_GET_PIPE:
+           case GEN_OCL_MAKE_RID:
+           case GEN_OCL_GET_RID:
+--- backend/src/llvm/llvm_includes.hpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_includes.hpp	2020-11-09 19:00:09.955926795 +0100
+@@ -103,7 +103,6 @@
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+ #include "llvm/IR/Mangler.h"
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #include "llvm/IR/InstVisitor.h"
+ #include "llvm/IR/IRPrintingPasses.h"
+--- backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_loadstore_optimization.cpp	2020-11-09 19:10:37.141852308 +0100
+@@ -160,7 +160,7 @@
+     Value *vecPtr = Builder.CreateBitCast(ld->getPointerOperand(),
+                                         PointerType::get(vecTy, addrSpace));
+     LoadInst *vecValue = Builder.CreateLoad(vecPtr);
+-    vecValue->setAlignment(align);
++    vecValue->setAlignment(align.valueOrOne());
+
+     for (unsigned i = 0; i < size; ++i) {
+       Value *S = Builder.CreateExtractElement(vecValue, Builder.getInt32(i));
+@@ -251,7 +251,7 @@
+       return;
+     Value *newPtr = Builder.CreateBitCast(stPointer, PointerType::get(vecTy, addrSpace));
+     StoreInst *newST = Builder.CreateStore(parent, newPtr);
+-    newST->setAlignment(align);
++    newST->setAlignment(align.valueOrOne());
+   }
+
+   // Find the safe iterator we can point to. If reorder happens, we need to
+--- backend/src/llvm/llvm_passes.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_passes.cpp	2020-11-09 18:48:55.997006837 +0100
+@@ -87,14 +87,14 @@
+   }
+
+   int32_t getPadding(int32_t offset, int32_t align) {
+-    return (align - (offset % align)) % align;
++    return (align - (offset % align)) % align;
+   }
+
+   uint32_t getAlignmentByte(const ir::Unit &unit, Type* Ty)
+   {
+     switch (Ty->getTypeID()) {
+       case Type::VoidTyID: NOT_SUPPORTED;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t elemNum = VecTy->getNumElements();
+@@ -138,7 +138,7 @@
+       case Type::HalfTyID:    return 16;
+       case Type::FloatTyID:   return 32;
+       case Type::DoubleTyID:  return 64;
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       {
+         const VectorType* VecTy = cast<VectorType>(Ty);
+         uint32_t numElem = VecTy->getNumElements();
+@@ -184,10 +184,12 @@
+     Type *elementType = NULL;
+     if (PointerType* ptrType = dyn_cast<PointerType>(eltTy))
+       elementType = ptrType->getElementType();
+-    else if(SequentialType * seqType = dyn_cast<SequentialType>(eltTy))
+-      elementType = seqType->getElementType();
+-    else if(CompositeType * compTy= dyn_cast<CompositeType>(eltTy))
+-      elementType = compTy->getTypeAtIndex(index);
++    else if (ArrayType * arrType = dyn_cast<ArrayType>(eltTy))
++      elementType = arrType->getElementType();
++    else if(VectorType * vecType = dyn_cast<VectorType>(eltTy))
++      elementType = vecType->getElementType();
++    else if(StructType * structType = dyn_cast<StructType>(eltTy))
++      elementType = structType->getTypeAtIndex(index);
+     GBE_ASSERT(elementType);
+     return elementType;
+   }
+--- backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_printf_parser.cpp	2020-11-09 18:57:52.618943105 +0100
+@@ -323,8 +323,7 @@
+
+   bool PrintfParser::parseOnePrintfInstruction(CallInst * call)
+   {
+-    CallSite CS(call);
+-    CallSite::arg_iterator CI_FMT = CS.arg_begin();
++    User::op_iterator CI_FMT = call->arg_begin();
+     int param_num = 0;
+
+     llvm::Constant* arg0 = dyn_cast<llvm::ConstantExpr>(*CI_FMT);
+@@ -341,7 +340,7 @@
+       return false;
+     }
+
+-    std::string fmt = fmt_arg->getAsCString();
++    std::string fmt = fmt_arg->getAsCString().str();
+     if (fmt.size() == 0)
+       return false;
+
+@@ -437,8 +436,8 @@
+         if ( callFunc->getIntrinsicID() != 0)
+           continue;
+
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+
+         if (fnName != "__gen_ocl_printf_stub" && fnName != "__gen_ocl_puts_stub")
+           continue;
+@@ -582,7 +581,7 @@
+             if (!fmt_arg || !fmt_arg->isCString()) {
+               return false;
+             }
+-            slot.state.str = fmt_arg->getAsCString();
++            slot.state.str = fmt_arg->getAsCString().str();
+             return true;
+           }
+           case PRINTF_CONVERSION_P: {
+@@ -595,10 +594,10 @@
+
+         break;
+
+-      case Type::VectorTyID: {
+-        Type* vect_type = arg->getType();
+-        Type* elt_type = vect_type->getVectorElementType();
+-        int vec_num = vect_type->getVectorNumElements();
++      case Type::FixedVectorTyID: {
++        VectorType* vect_type = dyn_cast<VectorType>(arg->getType());
++        Type* elt_type = vect_type->getElementType();
++        int vec_num = vect_type->getNumElements();
+         bool sign = false;
+
+         if (vec_num != slot.state.vector_n) {
+--- backend/src/llvm/llvm_profiling.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_profiling.cpp	2020-11-09 18:59:50.120929150 +0100
+@@ -35,7 +35,6 @@
+ #include "llvm/IR/IRBuilder.h"
+
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+-#include "llvm/IR/CallSite.h"
+ #include "llvm/IR/CFG.h"
+ #else
+ #include "llvm/Support/CallSite.h"
+--- backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_sampler_fix.cpp	2020-11-09 17:01:09.407774832 +0100
+@@ -45,8 +45,8 @@
+     bool visitCallInst(CallInst *I) {
+       if(!I)
+         return false;
+-      Value *Callee = I->getCalledValue();
+-      const std::string fnName = Callee->getName();
++      Value *Callee = I->getCalledOperand();
++      const std::string fnName = Callee->getName().str();
+       bool changed = false;
+       Type *boolTy = IntegerType::get(I->getContext(), 1);
+       Type *i32Ty = IntegerType::get(I->getContext(), 32);
+@@ -59,7 +59,7 @@
+         Value *needFixVal;
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+@@ -113,7 +113,7 @@
+         Value *needFixVal;
+  #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+         CallInst *init = dyn_cast<CallInst>(I->getOperand(0));
+-        if (init && init->getCalledValue()->getName().compare("__translate_sampler_initializer"))
++        if (init && init->getCalledOperand()->getName().compare("__translate_sampler_initializer"))
+         {
+           const ConstantInt *ci = dyn_cast<ConstantInt>(init->getOperand(0));
+           uint32_t samplerInt = ci->getZExtValue();
+--- backend/src/llvm/llvm_scalarize.cpp	2020-11-09 16:48:20.823866112 +0100
++++ backend/src/llvm/llvm_scalarize.cpp	2020-11-09 18:51:16.888990104 +0100
+@@ -178,7 +178,7 @@
+       if(!type)
+         return type;
+       switch(type->getTypeID()) {
+-      case Type::VectorTyID:
++      case Type::FixedVectorTyID:
+       case Type::ArrayTyID:
+         return GetBasicType(type->getContainedType(0));
+       default:
+@@ -188,7 +188,7 @@
+     }
+
+     int GetComponentCount(const Type* type)  {
+-      if (type && type->getTypeID() == Type::VectorTyID)
++      if (type && type->getTypeID() == Type::FixedVectorTyID)
+         return llvm::dyn_cast<VectorType>(type)->getNumElements();
+       else
+         return 1;
+@@ -652,13 +652,12 @@
+           break;
+         }
+       } else {
+-        Value *Callee = call->getCalledValue();
+-        const std::string fnName = Callee->getName();
++        Value *Callee = call->getCalledOperand();
++        const std::string fnName = Callee->getName().str();
+         auto genIntrinsicID = intrinsicMap.find(fnName);
+
+         // Get the function arguments
+-        CallSite CS(call);
+-        CallSite::arg_iterator CI = CS.arg_begin() + 1;
++        User::op_iterator CI = call->arg_begin() + 1;
+
+         switch (genIntrinsicID) {
+           case GEN_OCL_NOT_FOUND:
+@@ -729,7 +728,7 @@
+             extractFromVector(call);
+             break;
+           case GEN_OCL_PRINTF:
+-            for (; CI != CS.arg_end(); ++CI)
++            for (; CI != call->arg_end(); ++CI)
+               if ((*CI)->getType()->isVectorTy())
+                 *CI = InsertToVector(call, *CI);
+             break;
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index a7b6dff107f..e37102ce14f 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=8
+revision=9
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From 493c35e66d5c06670eb3c674f7fa2139dfc64ccd Mon Sep 17 00:00:00 2001
From: Robin Voetter <robin@voetter.nl>
Date: Mon, 9 Nov 2020 21:03:06 +0100
Subject: [PATCH 23/23] [ci skip] ldc: rebuild for llvm11

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index 63e5c52db87..45d5c7f7be0 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.24.0
-revision=1
+revision=2
 wrksrc="ldc-${version}-src"
 build_style=cmake
 configure_args="
@@ -10,7 +10,7 @@ configure_args="
  -DCMAKE_BUILD_TYPE=RelWithDebInfo
  -DBASH_COMPLETION_COMPLETIONSDIR=/usr/share/bash-completion"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm10 perl pkg-config"
+hostmakedepends="dmd llvm11 perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel"
 depends="ldc-runtime"
 short_desc="Portable D programming language compiler based on LLVM"

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PR PATCH] [Closed]: llvm: Update to 11.0.0
  2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
                   ` (31 preceding siblings ...)
  2020-11-12 14:06 ` [PR PATCH] [Updated] " Snektron
@ 2020-11-17  3:16 ` q66
  32 siblings, 0 replies; 34+ messages in thread
From: q66 @ 2020-11-17  3:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1067 bytes --]

There's a closed pull request on the void-packages repository

llvm: Update to 11.0.0
https://github.com/void-linux/void-packages/pull/26231

Description:
Update llvm and its subprojects to 11.0.0.

There were a few details i solved as follows:
* For llvm11, files/llvm-Config-config.h was not used, so i removed it. Same for llvm10
* I just copied all patches from llvm10, which yielded a few problems:
  - Some code near clang-004-ppc64-musl-elfv2.patch got changed so i re-made the patch
  - llvm-007-ppc-d85007.patch [seems to have been implemented upstream](https://github.com/llvm/llvm-project/commit/cbea17568f4301582c1d5d43990f089ca6cff522)
* subpackages (clang, lld, lldb, etc) were removed from llvm10 as they are provided by llvm11 now 
* llvm-unwind(-devel) and libcxx(-devel) were updated to 11.0.0
* There was a [sed expression](https://github.com/void-linux/void-packages/blob/4712555551b5140760a17948a5c38eac1cf13ddc/srcpkgs/libcxx/template#L27) in the extract step for libcxx, it seems that this has been changed upstream so i removed it.


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2020-11-17  3:16 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09  0:46 [PR PATCH] llvm: Update to 11.0.0 Snektron
2020-11-09  1:05 ` [PR PATCH] [Updated] " Snektron
2020-11-09  1:33 ` [PR REVIEW] [WIP] " fosslinux
2020-11-09  1:33 ` fosslinux
2020-11-09  1:33 ` fosslinux
2020-11-09  1:33 ` fosslinux
2020-11-09  1:33 ` fosslinux
2020-11-09  1:34 ` fosslinux
2020-11-09  1:57 ` [PR REVIEW] " Snektron
2020-11-09  1:58 ` [PR PATCH] [Updated] " Snektron
2020-11-09  2:39 ` Snektron
2020-11-09  3:02 ` [PR REVIEW] " fosslinux
2020-11-09  7:42 ` fosslinux
2020-11-09  7:42 ` fosslinux
2020-11-09 12:11 ` [PR PATCH] [Updated] " Snektron
2020-11-09 12:59 ` Snektron
2020-11-09 13:01 ` Snektron
2020-11-09 13:03 ` Snektron
2020-11-09 14:20 ` Snektron
2020-11-09 16:46 ` Snektron
2020-11-09 16:56 ` q66
2020-11-09 17:14 ` [PR PATCH] [Updated] " Snektron
2020-11-09 17:15 ` Snektron
2020-11-09 18:29 ` Snektron
2020-11-09 19:00 ` Snektron
2020-11-09 19:11 ` Snektron
2020-11-09 19:52 ` Snektron
2020-11-09 20:03 ` Snektron
2020-11-09 20:32 ` Snektron
2020-11-09 20:32 ` Snektron
2020-11-11 11:20 ` Snektron
2020-11-12  6:22 ` fosslinux
2020-11-12 14:06 ` [PR PATCH] [Updated] " Snektron
2020-11-17  3:16 ` [PR PATCH] [Closed]: " q66

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).